Page MenuHomeFreeBSD

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

Authored by julien.grall_citrix.com on Oct 5 2015, 5:53 PM.

Details

Reviewers
royger
Group Reviewers
network
Summary

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

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

Event Timeline

julien.grall_citrix.com retitled this revision from to xen/netfront: Add 2 bytes padding in the rx mbuf.
julien.grall_citrix.com updated this object.
julien.grall_citrix.com edited the test plan for this revision. (Show Details)
julien.grall_citrix.com 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.

sys/dev/xen/netfront/netfront.c
91

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

cperciva removed a reviewer: cperciva.

Hi,

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.