Resource manager for a down producer

I’m creating a down producer for an in-house protocol. Is there any
documentation on how the resource manager should be structured?
Specifically, I expect the resource-manager will open
/dev/io-net/myprotocol0. Do I then simply MsgSend() the packets I rx_up() to
some client process, and create a thread to tx_down() the packets I
MsgReceive()?

Thanks,
Shaun

I’ll answer my own question as I just figured it out. There’s no need to
create another thread. Just use message_attach() to register a specific type
of message that you’ll receive. Then ion->reg() a down-producer. This will
create the file /dev/io-net/myprotocol0. The client can then simply call
coid = open( “/dev/io-net/myprotocol0”, O_RDRW);
MsgSend( coid, …);
to send packets to the io-net driver. The driver can then tx_down() the
packets to send them.

Receiving up packets is a little trickier. The way I handled it was to
pulse_attach() a special pulse message. When a client wants to receive
packets it creates a channel, and then sends the channel id in the pulse to
the io-net driver. The io-net driver then ConnectAttach()es to the client.
When the io-net driver receives a packet, it MsgSend()s to the channel that
it opened previously.

Hope somebody finds this useful.
Cheers,
Shaun

Shaun Jackman <sjackman@nospam.vortek.com> wrote:

I’ll answer my own question as I just figured it out. There’s no need to
create another thread. Just use message_attach() to register a specific type
of message that you’ll receive. Then ion->reg() a down-producer. This will
create the file /dev/io-net/myprotocol0. The client can then simply call
coid = open( “/dev/io-net/myprotocol0”, O_RDRW);
MsgSend( coid, …);
to send packets to the io-net driver. The driver can then tx_down() the
packets to send them.

Receiving up packets is a little trickier. The way I handled it was to
pulse_attach() a special pulse message. When a client wants to receive
packets it creates a channel, and then sends the channel id in the pulse to
the io-net driver. The io-net driver then ConnectAttach()es to the client.
When the io-net driver receives a packet, it MsgSend()s to the channel that
it opened previously.

That is not the “proper way”. You should check for “MsgDeliverEvent”.

The client will create channel, connect attach to the channel, (got
a coid), and prepare a “event”.

The client then send the event to the server, tell server “if
happened, deliver this event back to me”.

-xtang

Hope somebody finds this useful.
Cheers,
Shaun