Questions about MBUF allocation in bsdnet
alberthuang314 at gmail.com
Sun Mar 22 17:13:51 UTC 2015
During developing/tracing an Ethernet device driver for ARM, I also
setup an i386 RTEMS on qemu with NE2000 as a comparison. I found that
MBUF allocation on both hosts does not behave the same, and might be one
of the source of issues. One of the strange behavior is that MSIZE=128
on both hosts, 98-byte packets are not segmented on i386 while segmented
on ARM. Another issue is sometimes M_LEADINGSPACE for 84-byte/98-byte
packet get 0 or negative.
In order to clarify these issues, I would like to know more about
MBUF. So my questions about MBUF are:
1. Is MSIZE adjustable? Currently, it is set to 128, and I couldn't find
where to modify it. Do I need to modify it to support larger Ethernet
2. What does M_EXT mean exactly? They're different on both hosts as
3. If a packet size is larger than MSIZE, would MCLGET() gives me two
MBUF, or a "cluster," which means a larger chunk of MBUF's, which are
grouped and treated as one MBUF. Am I correct on this part? Then is it
normal that I saw 98-byte packet segmented into two Etherent segments?
I would appreciate any idea/suggestion. Thanks in advance.
More information about the users