About USRP2_MIN_RX_SAMPLES

Hi all!
I ran into the constant USRP2_MIN_RX_SAMPLES = 371 defined in
usrp2_base.h, but I don’t get what it is used for (it comes with the
comment “BIG ASS FIXME: get from lower layer MTU calculation”).

Does anyone know anything about this constant and what it affects? …
what is depending on that it has the value 371?

(I got seg faults when trying to run less than 371 items out of a USRP2
source block, I believe this constant has something to do with that
perhaps?)

Regards,
/Ulrika

Ulrika U. wrote:

Hi all!
I ran into the constant USRP2_MIN_RX_SAMPLES = 371 defined in usrp2_base.h, but I don’t get what it is used for (it comes with the comment “BIG ASS FIXME: get from lower layer MTU calculation”).

Does anyone know anything about this constant and what it affects? … what is depending on that it has the value 371?

(I got seg faults when trying to run less than 371 items out of a USRP2 source block, I believe this constant has something to do with that perhaps?)

I think it had something to do with 371items*4bytes = 1484 bytes. I
think it was excluding the header, which I can’t remember the exact size
of on top of my head. But I have a feeling that the size of a packet was
1498 bytes or so. I have a feeling that I sent a code- snippet to Eric
Blossom last summer which read/re- wrote the MTU of the NIC, but as he
pointed out, the code should work on a whole bunch of platforms and
systems. The code should work in most cases, since MTU=1500 is more or
less standard, except some odd cards which have 1400 bytes MTU.

I think it was set to 371 in order to minimize overhead.

//Mattias

On Tue, Sep 15, 2009 at 04:41:39PM +0200, Ulrika U. wrote:

Hi all!

I ran into the constant USRP2_MIN_RX_SAMPLES = 371 defined in
usrp2_base.h, but I don’t get what it is used for (it comes with the
comment “BIG ASS FIXME: get from lower layer MTU calculation”).

I believe you’re referring to USRP2_MAX_RX_SAMPLES. It’s the largest
number of samples that will fit in a 1500 byte ethernet packet
including overhead. The constant sizes some structures. (BTW, it was
recently adjusted downward to 370 samples to ensure alignment for dual
channel apps).

Does anyone know anything about this constant and what it affects?
… what is depending on that it has the value 371?

(I got seg faults when trying to run less than 371 items out of a
USRP2 source block, I believe this constant has something to do with
that perhaps?)

How we’re you trying to do this? Hint: don’t change the constant.

We don’t currently expose this in the gr-usrp2 interface.

We do expose it in the usrp2::usrp2::start_rx_streaming interface.
items_per_frame = 0 gets you the default (currently 370 or 371
depending on rev). You can set it lower if you like.
usrp2_source_base::start currently passes 0 to get the default.

Eric

Thank you both Mattias and Eric for your replies!

However, I believe you are talking about the U2_MAX_SAMPLES and
U2_MIN_SAMPLES defined in usrp2_eth_packet.h. So, is this U2_MAX_SAMPLES
the same as the USRP2_MIN_SAMPLES since they are both set to 371 (but
the later is not changed to 370 in later rev), or is USRP2_MIN_SAMPLES
not used at all?

/Ulrika

-----Ursprungligt meddelande-----
Från: Eric B. [mailto:[email protected]]
Skickat: den 15 september 2009 20:23
Till: Ulrika U.
Kopia: GNU Radio D.ion
Ämne: Re: [Discuss-gnuradio] about USRP2_MIN_RX_SAMPLES

On Tue, Sep 15, 2009 at 04:41:39PM +0200, Ulrika U. wrote:

Hi all!

I ran into the constant USRP2_MIN_RX_SAMPLES = 371 defined in
usrp2_base.h, but I don’t get what it is used for (it comes with the
comment “BIG ASS FIXME: get from lower layer MTU calculation”).

I believe you’re referring to USRP2_MAX_RX_SAMPLES. It’s the largest
number of samples that will fit in a 1500 byte ethernet packet including
overhead. The constant sizes some structures. (BTW, it was recently
adjusted downward to 370 samples to ensure alignment for dual channel
apps).

Does anyone know anything about this constant and what it affects?
… what is depending on that it has the value 371?

(I got seg faults when trying to run less than 371 items out of a
USRP2 source block, I believe this constant has something to do with
that perhaps?)

How we’re you trying to do this? Hint: don’t change the constant.

We don’t currently expose this in the gr-usrp2 interface.

We do expose it in the usrp2::usrp2::start_rx_streaming interface.
items_per_frame = 0 gets you the default (currently 370 or 371 depending
on rev). You can set it lower if you like.
usrp2_source_base::start currently passes 0 to get the default.

Eric

Sorry, but it seems that the windows find-function wasn’t finding all
occurrences as expected… I found that the USRP2_MIN_SAMPLES is
actually used several times in the usrp2 source block.

-----Ursprungligt meddelande-----
Från: Ulrika U.
Skickat: den 16 september 2009 10:46
Till: ‘Eric B.’
Kopia: GNU Radio D.ion
Ämne: Re: [Discuss-gnuradio] about USRP2_MIN_RX_SAMPLES

Thank you both Mattias and Eric for your replies!

However, I believe you are talking about the U2_MAX_SAMPLES and
U2_MIN_SAMPLES defined in usrp2_eth_packet.h. So, is this U2_MAX_SAMPLES
the same as the USRP2_MIN_SAMPLES since they are both set to 371 (but
the later is not changed to 370 in later rev), or is USRP2_MIN_SAMPLES
not used at all?

/Ulrika

On Wed, Sep 16, 2009 at 12:33:31PM +0200, Ulrika U. wrote:

Sorry, but it seems that the windows find-function wasn’t finding
all occurrences as expected… I found that the USRP2_MIN_SAMPLES is
actually used several times in the usrp2 source block.

No problem.

Did you resolve your question, or is there more?

Why we have a U2_MIN_SAMPLES is that the current on-the-wire format
doesn’t specify a length field in the packet (this is a bug), and the
minimum allowable ethernet frame is 64 bytes total (including ethernet
header, payload and 4-byte CRC).

Eric