From sthaug@nethelp.no  Sat Mar 13 06:46:27 2004
Return-Path: <sthaug@nethelp.no>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 22F1B16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 13 Mar 2004 06:46:27 -0800 (PST)
Received: from bizet.nethelp.no (c510081D9.inet.catch.no [81.0.129.217])
	by mx1.FreeBSD.org (Postfix) with SMTP id A347143D41
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 13 Mar 2004 06:46:25 -0800 (PST)
	(envelope-from sthaug@nethelp.no)
Received: (qmail 1786 invoked by uid 1001); 13 Mar 2004 14:46:24 +0000 (GMT)
Message-Id: <20040313144624.1785.qmail@bizet.nethelp.no>
Date: 13 Mar 2004 14:46:24 +0000 (GMT)
From: Steinar Haug <sthaug@nethelp.no>
Reply-To: Steinar Haug <sthaug@nethelp.no>
To: FreeBSD-gnats-submit@freebsd.org
Cc: sthaug@nethelp.no
Subject: if_bfe correction for VLAN MTU
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         64222
>Category:       kern
>Synopsis:       if_bfe correction for VLAN MTU
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 13 06:50:14 PST 2004
>Closed-Date:    Sat Aug 07 20:48:02 GMT 2004
>Last-Modified:  Sat Aug 07 20:48:02 GMT 2004
>Originator:     Steinar Haug
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Nethelp Consulting
>Environment:
System: FreeBSD bizet.nethelp.no 4.9-STABLE FreeBSD 4.9-STABLE #2: Sat Mar 13 15:07:25 CET 2004 sthaug@bizet.nethelp.no:/local/freebsd/stable4/src/sys/compile/BIZET i386

Hardware is Dell Dimension 2400 with Broadcom 10/100 Ethernet onboard.

>Description:
	Configure a VLAN interface (vlan0) with bfe0 as vlandev. Observe that
MTU is set to 1496 for vlan0. However, the system is able to *receive* 1500
byte packets - but any outgoing traffic is fragmented if the Ethernet data
part is > 1496.
>How-To-Repeat:
	As described above.
>Fix:

	Unified diff included below. It sets ifp->if_data.ifi_hdrlen, the
same way that this is done in the fxp driver. With this change, normal 1500
byte packets work fine both receiving and sending.

The patch also corrects some other, minor points:

- The driver claims that miibus0 is required. This is simply not true, it
works fine with standard miibus.
- The DRIVER_MODULE name is set to if_bfe, not bfe, to be consistent
with other Ethernet drivers.
- The ifp->if_baudrate is set to 100M instead of 10M, to be consistent
with other Ethernet drivers for 10/100 cards.


--- if_bfe.c.diff begins here ---
--- if_bfe.c.orig	Sat Mar 13 10:05:59 2004
+++ if_bfe.c	Sat Mar 13 15:06:43 2004
@@ -84,7 +84,6 @@
 MODULE_DEPEND(bfe, ether, 1, 1, 1);
 MODULE_DEPEND(bfe, miibus, 1, 1, 1);
 
-/* "controller miibus0" required.  See GENERIC if you get errors here. */
 #include "miibus_if.h"
 
 #define BFE_DEVDESC_MAX		64	/* Maximum device description length */
@@ -166,7 +165,7 @@
 
 static devclass_t bfe_devclass;
 
-DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0);
+DRIVER_MODULE(if_bfe, pci, bfe_driver, bfe_devclass, 0, 0);
 DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0);
 
 /*
@@ -420,7 +419,7 @@
 	ifp->if_watchdog = bfe_watchdog;
 	ifp->if_init = bfe_init;
 	ifp->if_mtu = ETHERMTU;
-	ifp->if_baudrate = 10000000;
+	ifp->if_baudrate = 100000000;
 	ifp->if_snd.ifq_maxlen = BFE_TX_QLEN;
 
 	bfe_get_config(sc);
@@ -444,6 +443,11 @@
 	ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
 #endif
 	callout_handle_init(&sc->bfe_stat_ch);
+
+	/*
+	 * Tell the upper layer(s) we support long frames.
+	 */
+	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
 
 	/*
 	 * Hook interrupt last to avoid having to lock softc
--- if_bfe.c.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: brooks 
State-Changed-When: Fri Jul 23 17:06:55 GMT 2004 
State-Changed-Why:  
des commited most of these changes a few weeks ago. 


Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Fri Jul 23 17:06:55 GMT 2004 
Responsible-Changed-Why:  
des commited most of these changes a few weeks ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=64222 
State-Changed-From-To: patched->closed 
State-Changed-By: des 
State-Changed-When: Sat Aug 7 20:48:01 GMT 2004 
State-Changed-Why:  
Relevant portions of the proposed patch have been committed. 

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