Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Fix a bug that the VLAN HW tagging functio...



details:   https://anonhg.NetBSD.org/src/rev/9d4015ea463e
branches:  trunk
changeset: 449618:9d4015ea463e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Mar 13 10:08:02 2019 +0000

description:
Fix a bug that the VLAN HW tagging function is not correctly disabled when
all vlan is detached. Part of ixgbe.c rev. 1.177.

diffstat:

 sys/dev/pci/ixgbe/ixv.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r fb9804fe2d2e -r 9d4015ea463e sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Wed Mar 13 10:02:13 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Wed Mar 13 10:08:02 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.109 2019/02/22 06:49:15 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.110 2019/03/13 10:08:02 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -1972,27 +1972,31 @@
        struct ixgbe_hw *hw = &adapter->hw;
        struct rx_ring  *rxr;
        u32             ctrl, vid, vfta, retry;
+       bool            hwtagging;
 
        /*
-        * We get here thru init_locked, meaning
-        * a soft reset, this has already cleared
-        * the VFTA and other state, so if there
-        * have been no vlan's registered do nothing.
+        *  This function is called from both if_init and ifflags_cb()
+        * on NetBSD.
         */
-       if (!VLAN_ATTACHED(ec))
-               return;
+
+       /* Enalble HW tagging only if any vlan is attached */
+       hwtagging = (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING)
+           && VLAN_ATTACHED(&adapter->osdep.ec);
 
        /* Enable the queues */
        for (int i = 0; i < adapter->num_queues; i++) {
                rxr = &adapter->rx_rings[i];
                ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(rxr->me));
-               ctrl |= IXGBE_RXDCTL_VME;
+               if (hwtagging)
+                       ctrl |= IXGBE_RXDCTL_VME;
+               else
+                       ctrl &= ~IXGBE_RXDCTL_VME;
                IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(rxr->me), ctrl);
                /*
                 * Let Rx path know that it needs to store VLAN tag
                 * as part of extra mbuf info.
                 */
-               rxr->vtag_strip = TRUE;
+               rxr->vtag_strip = hwtagging ? TRUE : FALSE;
        }
 
 #if 1



Home | Main Index | Thread Index | Old Index