Re: [tipc-discussion] port name - port_id ?

2008-02-25 Thread Stephens, Allan
Hi Erich:

I've just started submissions.  It's going to take a while to get
everything submitted, since the Linux kernel folks require things to be
submitted as individual updates.

-- Al 

-Original Message-
From: Erich Focht [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 23, 2008 11:36 AM
To: Stephens, Allan
Cc: tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion] port name - port_id ?

On Freitag 22 Februar 2008, Stephens, Allan wrote:
 The Linux 2.6.24 kernel contains TIPC 1.6.2 code.

Oh, that old... Any chance for pushing something newer into the
mainline?

Thanks,
Erich

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-25 Thread Erich Focht
Hi Al,

On Montag 25 Februar 2008, Stephens, Allan wrote:
 Erich, is it possible for you to upgrade to TIPC 1.7.5?

yes, I will try. Not sure I can do it today, though (I'm in CET timezone).

Thanks,
Erich

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-25 Thread Horvath, Elmer
Hi,

Yes, this is possible that the code is suffering from the native API
issue.  I don't have a copy of the 1.6.2 code installed, so...

Erich, if TIPC 1.6.2 has the following code in
port.c:port_dispatcher_sigh()
case TIPC_CONN_MSG:{
tipc_conn_msg_event cb =
up_ptr-conn_msg_cb;
u32 peer_port = port_peerport(p_ptr);
u32 peer_node = port_peernode(p_ptr);

spin_unlock_bh(p_ptr-publ.lock);
if (unlikely(!connected)) {
if (unlikely(published))
goto reject;
tipc_connect2port(dref,orig);
}
if (unlikely(msg_origport(msg) !=
peer_port))
goto reject;
if (unlikely(msg_orignode(msg) !=
peer_node))
goto reject;

Then you have the problem that was found trying to establish a
connection with the Native API.  You would be best off upgrading to TIPC
1.7.5.  A very quick *TEST* would be to change the checks to what is
below; if it allows the connection to be established with the topology
server, then upgrade to TIPC 1.7.5 (don't just apply this change since
there are a number of other changes required for a real fix).

case TIPC_CONN_MSG:{
tipc_conn_msg_event cb =
up_ptr-conn_msg_cb;
u32 peer_port = port_peerport(p_ptr);
u32 peer_node = port_peernode(p_ptr);

spin_unlock_bh(p_ptr-publ.lock);
if (unlikely(!connected)) {
if (tipc_connect2port(dref,
orig))
goto reject;
} else if (unlikely(
(msg_origport(msg) !=
peer_port) ||
(msg_orignode(msg) !=
peer_node)))
goto reject;

Elmer

-Original Message-
From: Stephens, Allan 
Sent: Monday, February 25, 2008 9:15 AM
To: [EMAIL PROTECTED]; Horvath, Elmer
Cc: tipc-discussion@lists.sourceforge.net
Subject: RE: [tipc-discussion] port name - port_id ?

Hi guys:

Since Erich is using TIPC 1.6.2, I wonder if he's running into a native
API problem Elmer discovered and which is fixed in TIPC 1.7.5.  I think
it had something to do with a check being done incorrectly during
connection setup.  (Does this ring a bell, Elmer?)

Erich, is it possible for you to upgrade to TIPC 1.7.5?

-- Al

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Erich Focht
Sent: Saturday, February 23, 2008 4:12 PM
To: Horvath, Elmer
Cc: tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion] port name - port_id ?

Hello,

by the way, I added a conn_error_callback, as in your code.
Interestingly:
after sending the empty tipc_send2name the conn_error_cb gets invoked
with reason=2. The tipc_send fails and returns something like -22 or
-28, so I let the module loading fail.

If instead I send directly the subscription message with tipc_send2name
(without sending an empty message first), the conn_error_cb gets called
when the first publish event should be comming.

Regards,
Erich


On Samstag 23 Februar 2008, Erich Focht wrote:
 Dear Elmer,
 
 thanks for the example. I actually added your callback to my init 
 code, and changed the subscription type to 1, such that the 
 example should work fine with the tipc_demo-1.16/topology_subscr_demo/
example.
 
 But it doesn't (2.6.24, on x86_64). Loading the module shows the 
 messages are sent fine, and a new connection is in the tipc-config
-p output:
 2818850801: connected to 1.1.178:2818850799
 
 But when I start the user-space subscriptions monitor from the 
 topology_subscr_demo the ports output shows something like:
 2818850753: connected to 1.1.178:2818850751 via {1,1}
 2818850751: connected to 1.1.178:2818850753
 
 So I'm missing one of the connections.
 
 The user-space subscription monitor is reporting correctly 
 publish/withdraw events, e.g. when starting server_tipc from the demo.
 This tells me that either I'm doing something really wrong, or 
 something is broken with the native interface in 2.6.24. If you want 
 to try reproducing, the source is attached.
 
 Best regards,
 Erich
 




-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion

Re: [tipc-discussion] port name - port_id ?

2008-02-23 Thread Erich Focht
Hello,

by the way, I added a conn_error_callback, as in your code. Interestingly:
after sending the empty tipc_send2name the conn_error_cb gets invoked with
reason=2. The tipc_send fails and returns something like -22 or -28, so
I let the module loading fail.

If instead I send directly the subscription message with tipc_send2name
(without sending an empty message first), the conn_error_cb gets called
when the first publish event should be comming.

Regards,
Erich


On Samstag 23 Februar 2008, Erich Focht wrote:
 Dear Elmer,
 
 thanks for the example. I actually added your callback to my init code,
 and changed the subscription type to 1, such that the example should
 work fine with the tipc_demo-1.16/topology_subscr_demo/ example.
 
 But it doesn't (2.6.24, on x86_64). Loading the module shows the messages are
 sent fine, and a new connection is in the tipc-config -p output:
 2818850801: connected to 1.1.178:2818850799
 
 But when I start the user-space subscriptions monitor from the
 topology_subscr_demo the ports output shows something like:
 2818850753: connected to 1.1.178:2818850751 via {1,1}
 2818850751: connected to 1.1.178:2818850753
 
 So I'm missing one of the connections.
 
 The user-space subscription monitor is reporting correctly publish/withdraw
 events, e.g. when starting server_tipc from the demo. This tells me that
 either I'm doing something really wrong, or something is broken with the
 native interface in 2.6.24. If you want to try reproducing, the source is
 attached.
 
 Best regards,
 Erich
 



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


[tipc-discussion] port name - port_id ?

2008-02-22 Thread Erich Focht
Hello,

with the native interface I'd like to do (inside a kernel module):

   tipc_connect2port(myref, subscr_service);

I know the target port name {1, 1} but how can I get the port_id, which is
required as argument to tipc_connect2port? The function tipc_nametbl_translate
isn't exported...

Thanks,
Erich

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-22 Thread Horvath, Elmer
*/
int  i; /* loop counter */
int  nsent; /* how many bytes sent */

/* initialize and check parameters */
retval = ERROR;

res = tipc_attach(port_ref, NULL, NULL);
if (res)
return res;

/* set up addressing */
name.type = TIPC_EXPERIMENT_TYPE;
name.instance = TIPC_EXPERIMENT_INSTANCE;
msg_sect.iov_base = globalBuffer;
msg_sect.iov_len = size;

/* Create the new port */
res = tipc_createport(port_ref, NULL, TIPC_LOW_IMPORTANCE,
NULL, NULL, NULL,
msg_event_cb, c_named_msg_event_cb,
conn_msg_event_cb,
c_continue_cb, port_ref);
if (res)
return res;

/* send first message to port */
tipc_send2name(port_ref, 
   name, 
   0 /* domain of 0:own zone */,
   1 /* num_sect */,
   msg_sect);

/* Let the callbacks take care of everything */

/* wait for the whole process to be completed */
[ receive a signal that everything is completed ]

/* everything looks good, set return value */
retval = OK;

res = tipc_shutdown(port_ref);
if (res)
{
retval = res;
}
res = tipc_deleteport(port_ref);
if (res)
{
retval = res;
}
return retval;
}
 
Thanks,
Elmer


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Erich Focht
Sent: Friday, February 22, 2008 12:05 PM
To: tipc-discussion@lists.sourceforge.net
Subject: [tipc-discussion] port name - port_id ?

Hello,

with the native interface I'd like to do (inside a kernel module):

   tipc_connect2port(myref, subscr_service);

I know the target port name {1, 1} but how can I get the port_id, which
is required as argument to tipc_connect2port? The function
tipc_nametbl_translate isn't exported...

Thanks,
Erich


-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-22 Thread Jon Maloy
Hi,
1) You do tipc_send2name(ref,name(1,1)) with an empty 
   message to establish the connection to 
   the topology server. 
2) The server will respond with an empty message, which 
   will fulfil the connection. Just ignore this message. 
   No need to do connect2port(),it is already done by TIPC.
3)  Then you do tipc_send() on the new connection, with a message
containing your subscription.
4) Wait for messages containing events.

Regards
///jon


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Erich Focht
Sent: February 22, 2008 1:30 PM
To: Stephens, Allan
Cc: tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion] port name - port_id ?

Hi Allan,

sorry, just saw your reply. Actually I was sending my subscription info
in the first send2name, but none of the callbacks gets alive. You say I
should at least get an empty message for the handshake...

By the way, this is with the vanilla 2.6.24 kernel (what tipc version is
that, approximately?).

Best regards,
Erich

On Freitag 22 Februar 2008, Stephens, Allan wrote:
 Hi Erich:
 
 If you're trying to establish a connection to the TIPC topology server

 (which uses port name {1,1}), you want to use tipc_send2name() rather 
 than tipc_connect2port().
 
 The most basic approach is to send a zero length message, after which 
 the topology server will respond with a zero length message that 
 completes the connection handshaking (i.e. automatically calling
 tipc_connect2port() for you).  You can then use tipc_send() to send 
 your subscription requests to the topology server.
 
 Alternatively, if you only need to send a single subscription, you can

 send it when you do the initial tipc_send2name() call.
 
 Regards,
 Al


-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-22 Thread Stephens, Allan
Hi Erich:

The Linux 2.6.24 kernel contains TIPC 1.6.2 code.

-- Al

-Original Message-
From: Erich Focht [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 22, 2008 1:30 PM
To: Stephens, Allan
Cc: tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion] port name - port_id ?

Hi Allan,

sorry, just saw your reply. Actually I was sending my subscription info
in the first send2name, but none of the callbacks gets alive. You say I
should at least get an empty message for the handshake...

By the way, this is with the vanilla 2.6.24 kernel (what tipc version is
that, approximately?).

Best regards,
Erich

On Freitag 22 Februar 2008, Stephens, Allan wrote:
 Hi Erich:
 
 If you're trying to establish a connection to the TIPC topology server

 (which uses port name {1,1}), you want to use tipc_send2name() rather 
 than tipc_connect2port().
 
 The most basic approach is to send a zero length message, after which 
 the topology server will respond with a zero length message that 
 completes the connection handshaking (i.e. automatically calling
 tipc_connect2port() for you).  You can then use tipc_send() to send 
 your subscription requests to the topology server.
 
 Alternatively, if you only need to send a single subscription, you can

 send it when you do the initial tipc_send2name() call.
 
 Regards,
 Al

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


Re: [tipc-discussion] port name - port_id ?

2008-02-22 Thread Horvath, Elmer
 = TIPC_EXPERIMENT_INSTANCE;
subscr.timeout   = TIPC_WAIT_FOREVER;
subscr.filter= TIPC_SUB_PORTS;

/* set up addressing */
name.type = TIPC_TOP_SRV;
name.instance = TIPC_TOP_SRV;

res = tipc_attach(port_ref, NULL, NULL);
if (res)
higprintf(monitorBlastTask: tipc_attach returned %d
(errno=%d)\n, res, errno);
res = tipc_createport(port_ref, NULL, TIPC_LOW_IMPORTANCE,
NULL, NULL, mon_shutdown_cb,
NULL, NULL,
mon_conn_msg_event_cb, NULL, port_ref);

if (res)
return res;

/* send first message to port */
msg_sect.iov_base = (char *)subscr;
msg_sect.iov_len = sizeof(subscr);

tipc_send2name(port_ref, 
   name, 
   0 /* domain of 0:own zone */,
   1 /* num_sect */,
   msg_sect);
return OK;
}  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Erich Focht
Sent: Friday, February 22, 2008 1:22 PM
To: Horvath, Elmer
Cc: tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion] port name - port_id ?

Dear Elmer,

thanks for your reply. I roughly know how to deal with the port ref in a
callback. My problem is: I'd like to use the subscription service from a
kernel module and monitor the publishing of a certain set of ports.

What I tried (and didn't work) is listed below. The documentation on
subscriptions says that one needs to connect to the subscription
service, so I was looking for a way to do tipc_connect2port (meaning {1,
1}, the local subscription service).


static int __init subscr_monitor_init(void) {
struct tipc_name_seq seq;
struct iovec my_iov;
struct tipc_subscr sub;
struct tipc_name subsvc = { TIPC_TOP_SRV, TIPC_TOP_SRV };
u32 port_ref;
int res;

res = tipc_attach(user_ref, NULL, NULL);
if (res)
return res;

res = tipc_createport(user_ref, NULL, TIPC_LOW_IMPORTANCE,
  NULL, NULL, NULL,
  msg_event_cb, named_msg_event,
  c_named_msg_event_cb,
  NULL, port_ref);
if (res)
return res;

//tipc_connect2port(port_ref, ??);
sub.seq.type = 65;
sub.seq.lower = 0;
sub.seq.upper = 256;
sub.timeout = TIPC_WAIT_FOREVER;
sub.filter = TIPC_SUB_PORTS;

my_iov.iov_base = sub;
my_iov.iov_len = sizeof(sub);

//res = tipc_send2name(port_ref, subsvc, tipc_get_addr(), 1,
my_iov);
res = tipc_send2name(port_ref, subsvc, 0, 1, my_iov);

return res;
}


I never see anything spit out by the module though I publish ports in
the range that should be monitored :-(

What am I doing wrong?

Best regards,
Erich





-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion