Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/4bead916a2da
branches:  netbsd-8
changeset: 449282:4bead916a2da
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Mar 01 17:33:24 2019 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1199):

        sys/dev/pci/ixgbe/ixv.c: revision 1.109
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.54
        sys/dev/pci/ixgbe/ix_txrx.c: revision 1.52
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.174

  Fix a bug that if_link_state_change(ifp, LINK_STATE_DOWN) isn't called unless
link goes up at least one time. Without this change, never linkup-ed media
keeps LINK_STATE_UNKNOWN instead of LINK_STATE_DOWN.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c |   6 +++---
 sys/dev/pci/ixgbe/ixgbe.c   |  21 +++++++++++++--------
 sys/dev/pci/ixgbe/ixgbe.h   |   4 ++--
 sys/dev/pci/ixgbe/ixv.c     |  19 ++++++++++++-------
 4 files changed, 30 insertions(+), 20 deletions(-)

diffs (163 lines):

diff -r 00699b0fb5db -r 4bead916a2da sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Fri Mar 01 17:29:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Fri Mar 01 17:33:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.14 2018/12/20 11:34:33 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.15 2019/03/01 17:33:24 martin Exp $ */
 
 /******************************************************************************
 
@@ -136,7 +136,7 @@
 
        IXGBE_TX_LOCK_ASSERT(txr);
 
-       if (!adapter->link_active) {
+       if (adapter->link_active != LINK_STATE_UP) {
                /*
                 * discard all packets buffered in IFQ to avoid
                 * sending old packets at next link up timing.
@@ -282,7 +282,7 @@
        struct mbuf    *next;
        int            enqueued = 0, err = 0;
 
-       if (!txr->adapter->link_active) {
+       if (txr->adapter->link_active != LINK_STATE_UP) {
                /*
                 * discard all packets buffered in txr_interq to avoid
                 * sending old packets at next link up timing.
diff -r 00699b0fb5db -r 4bead916a2da sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 01 17:29:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 01 17:33:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.27 2019/01/28 13:03:02 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.28 2019/03/01 17:33:24 martin Exp $ */
 
 /******************************************************************************
 
@@ -1594,7 +1594,7 @@
        stats->mpctotal.ev_count += total_missed_rx;
 
        /* Document says M[LR]FC are valid when link is up and 10Gbps */
-       if ((adapter->link_active == TRUE)
+       if ((adapter->link_active == LINK_STATE_UP)
            && (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)) {
                stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
                stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
@@ -2692,7 +2692,7 @@
        ifmr->ifm_status = IFM_AVALID;
        ifmr->ifm_active = IFM_ETHER;
 
-       if (!adapter->link_active) {
+       if (adapter->link_active != LINK_STATE_UP) {
                ifmr->ifm_active |= IFM_NONE;
                IXGBE_CORE_UNLOCK(adapter);
                return;
@@ -4665,7 +4665,7 @@
        KASSERT(mutex_owned(&adapter->core_mtx));
 
        if (adapter->link_up) {
-               if (adapter->link_active == FALSE) {
+               if (adapter->link_active != LINK_STATE_UP) {
                        /*
                         * To eliminate influence of the previous state
                         * in the same way as ixgbe_init_locked().
@@ -4714,7 +4714,7 @@
                                device_printf(dev, "Link is up %s %s \n",
                                    bpsmsg, "Full Duplex");
                        }
-                       adapter->link_active = TRUE;
+                       adapter->link_active = LINK_STATE_UP;
                        /* Update any Flow Control changes */
                        ixgbe_fc_enable(&adapter->hw);
                        /* Update DMA coalescing config */
@@ -4724,12 +4724,17 @@
                        if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
                                ixgbe_ping_all_vfs(adapter);
                }
-       } else { /* Link down */
-               if (adapter->link_active == TRUE) {
+       } else {
+               /*
+                * Do it when link active changes to DOWN. i.e.
+                * a) LINK_STATE_UNKNOWN -> LINK_STATE_DOWN
+                * b) LINK_STATE_UP      -> LINK_STATE_DOWN
+                */
+               if (adapter->link_active != LINK_STATE_DOWN) {
                        if (bootverbose)
                                device_printf(dev, "Link is Down\n");
                        if_link_state_change(ifp, LINK_STATE_DOWN);
-                       adapter->link_active = FALSE;
+                       adapter->link_active = LINK_STATE_DOWN;
                        if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
                                ixgbe_ping_all_vfs(adapter);
                        ixgbe_drain_all(adapter);
diff -r 00699b0fb5db -r 4bead916a2da sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 01 17:29:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 01 17:33:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.15 2019/01/28 13:03:02 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.16 2019/03/01 17:33:24 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -492,7 +492,7 @@
        /* Info about the interface */
        int                     advertise;  /* link speeds */
        bool                    enable_aim; /* adaptive interrupt moderation */
-       bool                    link_active;
+       int                     link_active; /* Use LINK_STATE_* value */
        u16                     max_frame_size;
        u16                     num_segs;
        u32                     link_speed;
diff -r 00699b0fb5db -r 4bead916a2da sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Fri Mar 01 17:29:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Fri Mar 01 17:33:24 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.19 2019/01/27 18:35:19 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.20 2019/03/01 17:33:24 martin Exp $*/
 
 /******************************************************************************
 
@@ -1032,7 +1032,7 @@
        ifmr->ifm_status = IFM_AVALID;
        ifmr->ifm_active = IFM_ETHER;
 
-       if (!adapter->link_active) {
+       if (adapter->link_active != LINK_STATE_UP) {
                ifmr->ifm_active |= IFM_NONE;
                IXGBE_CORE_UNLOCK(adapter);
                return;
@@ -1307,7 +1307,7 @@
        KASSERT(mutex_owned(&adapter->core_mtx));
 
        if (adapter->link_up) {
-               if (adapter->link_active == FALSE) {
+               if (adapter->link_active != LINK_STATE_UP) {
                        if (bootverbose) {
                                const char *bpsmsg;
 
@@ -1337,15 +1337,20 @@
                                device_printf(dev, "Link is up %s %s \n",
                                    bpsmsg, "Full Duplex");
                        }
-                       adapter->link_active = TRUE;
+                       adapter->link_active = LINK_STATE_UP;
                        if_link_state_change(ifp, LINK_STATE_UP);
                }
-       } else { /* Link down */
-               if (adapter->link_active == TRUE) {
+       } else {
+               /*
+                * Do it when link active changes to DOWN. i.e.
+                * a) LINK_STATE_UNKNOWN -> LINK_STATE_DOWN
+                * b) LINK_STATE_UP      -> LINK_STATE_DOWN
+                */
+               if (adapter->link_active != LINK_STATE_DOWN) {
                        if (bootverbose)
                                device_printf(dev, "Link is Down\n");
                        if_link_state_change(ifp, LINK_STATE_DOWN);
-                       adapter->link_active = FALSE;
+                       adapter->link_active = LINK_STATE_DOWN;
                }
        }
 } /* ixv_update_link_status */



Home | Main Index | Thread Index | Old Index