kern/64222: if_bfe correction for VLAN MTU

Steinar Haug sthaug at nethelp.no
Sat Mar 13 06:50:15 PST 2004


>Number:         64222
>Category:       kern
>Synopsis:       if_bfe correction for VLAN MTU
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 13 06:50:14 PST 2004
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list