[USRP-users] Question on Receiving Data Samples on USRP N210

Josh Blum josh at ettus.com
Sat Jun 16 12:44:39 EDT 2012



On 06/15/2012 04:29 PM, Robert Palumbo wrote:
> Hello,
> 
> I have a question regarding how receive data packets are handled
> within the UHD ( I am currently using version 003.003.001). When I
> make a call to 'recv' for a single buffer of data samples, how is that
> receive action actually implemented? What I mean is, does the UHD:
> 
> a.) Have a separate thread running that constantly receives packets
> and dumps them into some internal buffer, so that when a receive call
> is made you are just receiving data from that internal buffer.
> b.) The call to 'recv' effectively just reads data directly from the
> socket, without any internal buffering.
> c.) Some other method I don't know about :)
> 

The stream->recv() call is basically a layer on top of the "transport"
(UDP, USB, etc) that converts samples to the user's requested data type
and parses the VITA header. Any buffering or threading is internal to
the transport. In the case of N210, it depends how your OS implements
the user space socket... which is probably a kernel thread and a lot of
buffering.

This kernel socket buffering is configurable, and you can actually not
call stream->recv() and have the thing entirely fill up with samples all
on its own. Careful, once its full, the kernel will start throwing away
packets.

A little not on resizing this buffer:
http://files.ettus.com/uhd_docs/manual/html/transport.html#resize-socket-buffers

And how overflows occur on network devices:
http://files.ettus.com/uhd_docs/manual/html/general.html#overflow-underflow-notes

-Josh




More information about the USRP-users mailing list