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 Ensure we don't call workqueue_enqueue() i...



details:   https://anonhg.NetBSD.org/src/rev/f1f9b478d1c8
branches:  trunk
changeset: 744552:f1f9b478d1c8
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Feb 06 06:28:49 2020 +0000

description:
Ensure we don't call workqueue_enqueue() if the pluggable optics
handler is already pending.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  31 +++++++++++++++++++------------
 sys/dev/pci/ixgbe/ixgbe.h |   3 ++-
 2 files changed, 21 insertions(+), 13 deletions(-)

diffs (104 lines):

diff -r 1e160bc92cef -r f1f9b478d1c8 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Feb 06 02:17:24 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Feb 06 06:28:49 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.225 2020/02/05 07:45:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.226 2020/02/06 06:28:49 thorpej Exp $ */
 
 /******************************************************************************
 
@@ -1507,6 +1507,18 @@
        }
 } /* ixgbe_is_sfp */
 
+static void
+ixgbe_schedule_msf_tasklet(struct adapter *adapter)
+{
+       if (adapter->schedule_wqs_ok) {
+               if (!adapter->msf_pending) {
+                       adapter->msf_pending = true;
+                       workqueue_enqueue(adapter->msf_wq,
+                           &adapter->msf_wc, NULL);
+               }
+       }
+}
+
 /************************************************************************
  * ixgbe_config_link
  ************************************************************************/
@@ -1523,9 +1535,7 @@
                if (hw->phy.multispeed_fiber) {
                        ixgbe_enable_tx_laser(hw);
                        kpreempt_disable();
-                       if (adapter->schedule_wqs_ok)
-                               workqueue_enqueue(adapter->msf_wq,
-                                   &adapter->msf_wc, NULL);
+                       ixgbe_schedule_msf_tasklet(adapter);
                        kpreempt_enable();
                }
                kpreempt_disable();
@@ -3099,9 +3109,7 @@
                    (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
                        IXGBE_WRITE_REG(hw, IXGBE_EICR,
                            IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-                       if (adapter->schedule_wqs_ok)
-                               workqueue_enqueue(adapter->msf_wq,
-                                   &adapter->msf_wc, NULL);
+                       ixgbe_schedule_msf_tasklet(adapter);
                }
        }
 
@@ -4674,8 +4682,7 @@
                        goto out;
                }
        }
-       if (adapter->schedule_wqs_ok)
-               workqueue_enqueue(adapter->msf_wq, &adapter->msf_wc, NULL);
+       ixgbe_schedule_msf_tasklet(adapter);
 out:
        IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mod */
@@ -4703,6 +4710,7 @@
        IFNET_LOCK(ifp);
 
        IXGBE_CORE_LOCK(adapter);
+       adapter->msf_pending = false;
        ++adapter->msf_sicount.ev_count;
        /* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
        adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
@@ -4754,6 +4762,7 @@
        IXGBE_CORE_UNLOCK(adapter);
 
        workqueue_wait(adapter->msf_wq, &adapter->msf_wc);
+       adapter->msf_pending = false;
 }
 
 /************************************************************************
@@ -5122,9 +5131,7 @@
                    (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
                        IXGBE_WRITE_REG(hw, IXGBE_EICR,
                            IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-                       if (adapter->schedule_wqs_ok)
-                               workqueue_enqueue(adapter->msf_wq,
-                                   &adapter->msf_wc, NULL);
+                       ixgbe_schedule_msf_tasklet(adapter);
                }
        }
 
diff -r 1e160bc92cef -r f1f9b478d1c8 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Feb 06 02:17:24 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Thu Feb 06 06:28:49 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.64 2020/02/05 07:45:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.65 2020/02/06 06:28:49 thorpej Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -515,6 +515,7 @@
        void                    *mod_si;   /* SFP tasklet */
        struct workqueue        *msf_wq;   /* Multispeed Fiber */
        struct work              msf_wc;
+       bool                     msf_pending;
        void                    *mbx_si;   /* VF -> PF mailbox interrupt */
 
        /* Flow Director */



Home | Main Index | Thread Index | Old Index