Skip to contentSkip to conversation

RTNET and rtskb size

DISCUSSION François Legal 2 participants 2 messages Nov 9, 2020 – Nov 10, 2020

lore
Share & tools
lore
#0 lore raw

Hello list,

I'm working on a project with a custom MAC which is using up to 2048 ethernet frame length.
Lately, I was having weird crash in RX interrupt code, or even sometimes in RTNET packet dispatch logic.
It turned out that while rt_alloc_etherdev () requests the number of rtskb to allocate in the device pool (and with associated packet buffers of RTSKB_SIZE bytes), rtnetdev_alloc_rtskb (that is usually called after one packet is received to allocate a new rtskb for another packet to be received) takes a size parameter, and uses this as the rtskb buffer actual length whereas RTSKB_SIZE only is allocated. Because of this, I believe I might be having the MAC overwriting rtskbs that are being used.

I was wondering if it would not be a good thing to either make rtnetdev_alloc_rtskb check size against RTSKB_SIZE or even discard size parameters, or maybe add a new rt_alloc_etherdev function which would allow passing the max frame length.

Any thoughs on this ?

François

#1 lore raw
Quoted 10 lines · François Legal via Xenomai

Hello list,

I'm working on a project with a custom MAC which is using up to 2048 ethernet frame length.
Lately, I was having weird crash in RX interrupt code, or even sometimes in RTNET packet dispatch logic.
It turned out that while rt_alloc_etherdev () requests the number of rtskb to allocate in the device pool (and with associated packet buffers of RTSKB_SIZE bytes), rtnetdev_alloc_rtskb (that is usually called after one packet is received to allocate a new rtskb for another packet to be received) takes a size parameter, and uses this as the rtskb buffer actual length whereas RTSKB_SIZE only is allocated. Because of this, I believe I might be having the MAC overwriting rtskbs that are being used.

I was wondering if it would not be a good thing to either make rtnetdev_alloc_rtskb check size against RTSKB_SIZE or even discard size parameters, or maybe add a new rt_alloc_etherdev function which would allow passing the max frame length.

Any thoughs on this ?

The RTnet core is limited to raw packets with RTSKB_SIZE, and that is so far static. It has to fit to all cards attached in a system as buffers may circle across them. So, dynamic control can be hard to impossible.

Fixing blind overruns would be definitely valuable, and maybe there is also value in making that size configurable at build time. Though we do not have a use case for larger frames in-tree so far.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux