Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys PR kern/38871



details:   https://anonhg.NetBSD.org/src/rev/56a5a1cabd86
branches:  trunk
changeset: 763961:56a5a1cabd86
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Fri Apr 08 13:56:51 2011 +0000

description:
PR kern/38871

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

diffstat:

 sys/dev/pci/if_alc.c |   3 +--
 sys/dev/pci/if_bge.c |  20 ++++++++++++++++++--
 sys/net/if_vlan.c    |   9 +++++----
 3 files changed, 24 insertions(+), 8 deletions(-)

diffs (108 lines):

diff -r c84a4e7dcf28 -r 56a5a1cabd86 sys/dev/pci/if_alc.c
--- a/sys/dev/pci/if_alc.c      Fri Apr 08 11:15:11 2011 +0000
+++ b/sys/dev/pci/if_alc.c      Fri Apr 08 13:56:51 2011 +0000
@@ -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;
diff -r c84a4e7dcf28 -r 56a5a1cabd86 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Fri Apr 08 11:15:11 2011 +0000
+++ b/sys/dev/pci/if_bge.c      Fri Apr 08 13:56:51 2011 +0000
@@ -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);
 
diff -r c84a4e7dcf28 -r 56a5a1cabd86 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Fri Apr 08 11:15:11 2011 +0000
+++ b/sys/net/if_vlan.c Fri Apr 08 13:56:51 2011 +0000
@@ -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.
                 */



Home | Main Index | Thread Index | Old Index