From nobody@FreeBSD.org  Tue Jan  4 13:50:55 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 22AAD16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Jan 2005 13:50:55 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0BE6843D5A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Jan 2005 13:50:55 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j04DosCX014148
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 4 Jan 2005 13:50:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j04DosRc014145;
	Tue, 4 Jan 2005 13:50:54 GMT
	(envelope-from nobody)
Message-Id: <200501041350.j04DosRc014145@www.freebsd.org>
Date: Tue, 4 Jan 2005 13:50:54 GMT
From: Sten Spans <sten@blinkenlights.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: em driver alignment problems
X-Send-Pr-Version: www-2.3

>Number:         75794
>Category:       kern
>Synopsis:       [em] em(4) driver alignment problems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 04 14:00:44 GMT 2005
>Closed-Date:    Mon Apr 10 03:46:15 GMT 2006
>Last-Modified:  Mon Apr 10 03:46:15 GMT 2006
>Originator:     Sten Spans
>Release:        5.3-STABLE
>Organization:
Blinkenlights
>Environment:
FreeBSD deepthought.blinkenlights.nl 5.3-STABLE FreeBSD 5.3-STABLE #15: Tue Dec 21 03:05:04 CET 2004     root@deepthought.blinkenlights.nl:/usr/obj/usr/src/sys/DEEPTHOUGHT  alpha

>Description:
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.  
>How-To-Repeat:

ifconfig em0 mtu 1501.
>Fix:
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.
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_em.c.diff?r1=1.22&r2=1.23

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.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->tackerman 
Responsible-Changed-By: kris 
Responsible-Changed-When: Wed Jan 5 01:08:46 GMT 2005 
Responsible-Changed-Why:  
Assign to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Wed Apr 5 00:39:00 UTC 2006 
State-Changed-Why:  
Is this still a problem with recent versions of FreeBSD? 


Responsible-Changed-From-To: tackerman->linimon 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 5 00:39:00 UTC 2006 
Responsible-Changed-Why:  
Reset PR assigned to inactive committer. 

Hat:	gnats-admin 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 

From: linimon@lonesome.com (Mark Linimon)
To: bug-followup@FreeBSD.org
Cc: Mark Linimon <linimon@lonesome.com>
Subject: Re: kern/75794: [em] em(4) driver alignment problems
Date: Wed, 5 Apr 2006 02:04:16 -0500

 ----- Forwarded message from Sten Spans <sten@blinkenlights.nl> -----
 
 On Wed, 5 Apr 2006, Mark Linimon wrote:
 
 >Is this still a problem with recent versions of FreeBSD?
 
 the code in current disables jumboframes for strict alignmnet
 architectures, which "solves" the crash issue. The em driver still 
 doesnt properly handle jumboframes on strict alignment architectures.
 So closing the pr would be premature imho.
 
 -- 
 Sten Spans
 
 "There is a crack in everything, that's how the light gets in."
 Leonard Cohen - Anthem
State-Changed-From-To: feedback->suspended 
State-Changed-By: linimon 
State-Changed-When: Wed Apr 5 20:00:44 UTC 2006 
State-Changed-Why:  
The problem apparently still persists but is not a show-stopper.  Mark 
suspended awaiting an interested committer to take a look. 


Responsible-Changed-From-To: linimon->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 5 20:00:44 UTC 2006 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 
Responsible-Changed-From-To: freebsd-bugs->yongari 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Fri Apr 7 08:55:34 UTC 2006 
Responsible-Changed-Why:  
AFAIK, Pyun has fixed this problem and PR should be closed. Let 
Pyun himself evaluate this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 
State-Changed-From-To: suspended->feedback 
State-Changed-By: yongari 
State-Changed-When: Sat Apr 8 00:55:35 UTC 2006 
State-Changed-Why:  
Jumbo frame support for strict alignment architectures was 
committed to HEAD(if_em.c, rev. 1.92). Would you try the 
driver from HEAD? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 
State-Changed-From-To: feedback->closed 
State-Changed-By: yongari 
State-Changed-When: Mon Apr 10 03:45:18 UTC 2006 
State-Changed-Why:  
Jumbo frame support code for strict alignment architectures 
was already committed to HEAD(if_em.c, rev. 1.92). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75794 
>Unformatted:
