Page MenuHomeFreeBSD

xen/netfront: Add 2 bytes padding in the rx mbuf
Needs ReviewPublic

Authored by on Oct 5 2015, 5:53 PM.


Group Reviewers

The ethernet header size is not word aligned. Therefore the IP packet and so
on won't be align. On some architecture (such as ARM) unaligned access may
be slower and/or not supported. Therefore we might reveice an alignement
fault. To avoid this case, we need to pull-up the data of ETHER_ALIGN bytes.

I'm not sure how this patch will impact x86, we need to do some benchmarking
without and with it.

Furthermore, I don't know if m_copyup is the rigth function to use here. Can
any expert to the network stack can tell me if there is a better solution?

Diff Detail

rS FreeBSD src repository - subversion
Lint OK
No Unit Test Coverage
Build Status
Buildable 686
Build 686: arc lint + arc unit

Event Timeline retitled this revision from to xen/netfront: Add 2 bytes padding in the rx mbuf. updated this object. edited the test plan for this revision. (Show Details) added a reviewer: royger.

Adding the network review group and Colin Percival.

Performance on x86 with this patch doesn't seem to be affected. I wonder however how do other drivers deal with this, since m_copyup it's only used by the bridge code.


Can't you use the ETHER_ALIGN already defined in net/ethernet.h?

cperciva removed a reviewer: cperciva.


I'd do a check whether we need to do alignment at compile time. net80211 does something like this.

that way you don't take the penalty if you're compiling for x86, and you DTRT for our alignment-unhappy architectures if you need it.