Module Name:    src
Committed By:   sborrill
Date:           Fri Apr  8 13:56:51 UTC 2011

Modified Files:
        src/sys/dev/pci: if_alc.c if_bge.c
        src/sys/net: if_vlan.c

Log Message:
PR kern/38871

Fix LAN on bge(4), alc(4). Flag VLAN capability in ec_capenable as used by 
network
card drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.190 -r1.191 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.66 -r1.67 src/sys/net/if_vlan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.2 src/sys/dev/pci/if_alc.c:1.3
--- src/sys/dev/pci/if_alc.c:1.2	Wed Feb 23 02:25:04 2011
+++ src/sys/dev/pci/if_alc.c	Fri Apr  8 13:56:51 2011
@@ -2586,11 +2586,10 @@
 static void
 alc_rxvlan(struct alc_softc *sc)
 {
-	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	uint32_t reg;
 
 	reg = CSR_READ_4(sc, ALC_MAC_CFG);
-	if (ifp->if_capabilities & ETHERCAP_VLAN_HWTAGGING)
+	if (sc->sc_ec.ec_capenable & ETHERCAP_VLAN_HWTAGGING)
 		reg |= MAC_CFG_VLAN_TAG_STRIP;
 	else
 		reg &= ~MAC_CFG_VLAN_TAG_STRIP;

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.190 src/sys/dev/pci/if_bge.c:1.191
--- src/sys/dev/pci/if_bge.c:1.190	Sun Jan  9 13:01:03 2011
+++ src/sys/dev/pci/if_bge.c	Fri Apr  8 13:56:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.190 2011/01/09 13:01:03 jruoho Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.191 2011/04/08 13:56:51 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.190 2011/01/09 13:01:03 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.191 2011/04/08 13:56:51 sborrill Exp $");
 
 #include "vlan.h"
 #include "rnd.h"
@@ -221,6 +221,7 @@
 static uint8_t bge_eeprom_getbyte(struct bge_softc *, int, uint8_t *);
 static int bge_read_eeprom(struct bge_softc *, void *, int, int);
 static void bge_setmulti(struct bge_softc *);
+static void bge_setvlan(struct bge_softc *);
 
 static void bge_handle_events(struct bge_softc *);
 static int bge_alloc_jumbo_mem(struct bge_softc *);
@@ -1648,6 +1649,18 @@
 }
 
 static void
+bge_setvlan(struct bge_softc *sc)
+{
+	struct ethercom *ac = &sc->ethercom;
+
+	/* Enable or disable VLAN tag stripping as needed. */
+	if (ac->ec_capenable & ETHERCAP_VLAN_HWTAGGING)
+		BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_KEEP_VLAN_DIAG);
+	else
+		BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_KEEP_VLAN_DIAG);
+}
+
+static void
 bge_sig_pre_reset(struct bge_softc *sc, int type)
 {
 	/*
@@ -4318,6 +4331,9 @@
 	/* Program multicast filter. */
 	bge_setmulti(sc);
 
+	/* Program VLAN tag stripping */
+	bge_setvlan(sc);
+
 	/* Init RX ring. */
 	bge_init_rx_ring_std(sc);
 

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.66 src/sys/net/if_vlan.c:1.67
--- src/sys/net/if_vlan.c:1.66	Mon Apr  5 07:22:24 2010
+++ src/sys/net/if_vlan.c	Fri Apr  8 13:56:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.66 2010/04/05 07:22:24 joerg Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.67 2011/04/08 13:56:51 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.66 2010/04/05 07:22:24 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.67 2011/04/08 13:56:51 sborrill Exp $");
 
 #include "opt_inet.h"
 
@@ -316,7 +316,8 @@
 		 * assisted checksumming flags and tcp segmentation
 		 * offload.
 		 */
-		if (ec->ec_capabilities & ETHERCAP_VLAN_HWTAGGING)
+		if (ec->ec_capabilities & ETHERCAP_VLAN_HWTAGGING) {
+		        ec->ec_capenable |= ETHERCAP_VLAN_HWTAGGING;
 			ifp->if_capabilities = p->if_capabilities &
 			    (IFCAP_TSOv4 | IFCAP_TSOv6 |
 			     IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
@@ -324,7 +325,7 @@
 			     IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx|
 			     IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|
 			     IFCAP_CSUM_UDPv6_Tx|IFCAP_CSUM_UDPv6_Rx);
-
+                }
 		/*
 		 * We inherit the parent's Ethernet address.
 		 */

Reply via email to