alpha and em mtu

John Baldwin jhb at FreeBSD.org
Tue Nov 23 11:19:59 PST 2004


On Monday 22 November 2004 10:09 pm, Sten Spans wrote:
> On Tue, 23 Nov 2004, Sten Spans wrote:
> >> doesn't seem to print anything, but ...
> >>
> >> if_em.c
> >>   2442
> >>   2443         /*if (ifp->if_mtu <= ETHERMTU) { */
> >>   2444                 m_adj(mp, ETHER_ALIGN);
> >>   2445         /*} */
> >>   2446
> >>
> >> does seem to fix the crash, also trashes the performance,
> >> but that's another matter. It looks like mbuf alignment is
> >> needed, if_bge seems to provide reasonable examples.
> >
> > And looking at netbsd/openbsd clarifies the whole issue,
> >
> > #ifdef __STRICT_ALIGNMENT
> > 			/*
> > 			 * The ethernet payload is not 32-bit aligned when
> > 			 * Jumbo packets are enabled, so on architectures
> > with
> > 			 * strict alignment we need to shift the entire
> > packet
> > 			 * ETHER_ALIGN bytes. Ugh.
> > 			 */
> >
> >
> > This diff probably should be merged.
> > http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_em.c.diff?r1=1.2
> >2&r2=1.23
> >
> > Although I don't know wether freebsd has the STRICT_ALIGNMENT define.
>
> This is an initial patch based on the openbsd code,
> which solves the if_em issue, and seems to give ok performance
> ( note to self: turn off debugging when testing network performance ).
>
> Comments welcome.

We do need some kind of __STRICT_ALIGNMENT macro I think if we don't already 
have one as archs other than i386 might not need the alignment.  At the least 
there could be a block near the top of if_em.h that was:

#if defined(__alpha__)
#define	STRICT_ALIGNMENT
#endif

and other architectures could be fixed by simply adding another 
'defined(__foo__)' clause without having to change the ifdef and comments 
down in the code itself.  As to the correctness of the em(4) change, 
hopefully Robert can speak to that.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-alpha mailing list