kern/75794: em driver alignment problems

Sten Spans sten at
Tue Jan 4 14:00:45 GMT 2005

>Number:         75794
>Category:       kern
>Synopsis:       em driver alignment problems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 04 14:00:44 GMT 2005
>Originator:     Sten Spans
>Release:        5.3-STABLE
FreeBSD 5.3-STABLE FreeBSD 5.3-STABLE #15: Tue Dec 21 03:05:04 CET 2004     root at  alpha

The mbufs created by the em driver aren't aligned properly. This causes
problems on alpha which crashes on non-aligned pointers to ip adresses.
For ethernet mtu packets the mbufs are alinged by the following section
of code:

   2517         if (ifp->if_mtu <= ETHERMTU) {
   2518                 m_adj(mp, ETHER_ALIGN);
   2519         }

However when one uses jumbo frames this solution doesn't work 
( ethermtu ) and I guess that packets in multiple mbufs wouldn't
be fixed with this code.  

ifconfig em0 mtu 1501.
There are quite a few ways to solve this problem. Sadly I don't know
enough about coding device drivers to suggest the corrent one.

Openbsd has a quite complex mbuf shifting trick, which is quite
crufty imho, but does solve the problem.

In freebsd it might be possible to do the same mbuf shift in a bit
more elegant fashion. It might also be possible to correct the alignment
problem in the busdma code, which would be the ideal solution.

The problem is clear, how and who is going to solve it sadly isn't.

More information about the freebsd-bugs mailing list