networking guru question

Till Straumann strauman at
Thu Oct 17 16:10:01 UTC 2002

Thanks for all responses.

Eric Norum wrote:

> On Wednesday, October 16, 2002, at 11:21  PM, Till Straumann wrote:
>> Hi Eric :-)
>> I want to use soreceive() to avoid copying mbufs into a user buffer.
>> I guess I have to hold the bsdnet_semaphore around soreceive().
>> But once I got hold of the mbuf chain - is it safe to access / use / 
>> release
>> it without holding the semaphore (well, maybe I need to hold it
>> for freeing the chain)?
> I take it that you're doing this to provide 'zero-copy' network 
> operation.    


> Perhaps we should think about adding a more general API for this (like 
> the zero-copy I/O routines provided by pSOS+/pNA which specify a 
> callback function to be invoked when I/O is complete). 

Yeah - OTOH, soreceive() already is an API - one could think of a wrapper
for hiding the semaphore, i.e. doing exactly what you state a few lines 
However, I'm not sure if it's worth the effort...

> Anyhow, I think you should be safe if you:
> obtain network semahore
> soreceive()
> release network semaphore
> do something with the received data
> obtain network semahore
> free mbufs()
> release network semaphore
> BTW -- what's your application that needs this high a level of network 
> performance???

I'm playing with NFS (vers2). So it's not an application but a 
filesystem implementation.
It seems to be straightforward to implement an XDR-MBUF stream derived from
What I have so far (but rather untested) is an asynchronous RPC 
facility, i.e.
a multiplexor daemon which routes RPCs from arbitrary client threads
through a common socket to arbitrary servers.
Once I have simple client working, I can think about caching :-)

-- Till


More information about the users mailing list