Module Name:    src
Committed By:   martin
Date:           Tue Apr 17 08:20:06 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #769):

        sys/dev/pci/ixgbe/ixgbe.c: revision 1.147
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.42

Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.
The operation is not supported, however causing panic is problem.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.17 -r1.88.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.10 -r1.24.6.11 src/sys/dev/pci/ixgbe/ixgbe.h

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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.17 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.18 2018/04/17 08:20:06 martin Exp $ */
 
 /******************************************************************************
 
@@ -2487,7 +2487,7 @@ static inline void
 ixgbe_sched_handle_que(struct adapter *adapter, struct ix_queue *que)
 {
 
-	if (adapter->txrx_use_workqueue) {
+	if(que->txrx_use_workqueue) {
 		/*
 		 * adapter->que_wq is bound to each CPU instead of
 		 * each NIC queue to reduce workqueue kthread. As we
@@ -2531,6 +2531,12 @@ ixgbe_msix_que(void *arg)
 	ixgbe_disable_queue(adapter, que->msix);
 	++que->irqs.ev_count;
 
+	/*
+	 * Don't change "que->txrx_use_workqueue" from this point to avoid
+	 * flip-flopping softint/workqueue mode in one deferred processing.
+	 */
+	que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 	/* Don't run ixgbe_rxeof in interrupt context */
 	more = true;
@@ -3174,6 +3180,16 @@ ixgbe_add_device_sysctls(struct adapter 
 	    CTL_EOL) != 0)
 		aprint_error_dev(dev, "could not create sysctl\n");
 
+	/*
+	 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
+	 * it causesflip-flopping softint/workqueue mode in one deferred
+	 * processing. Therefore, preempt_disable()/preempt_enable() are
+	 * required in ixgbe_sched_handle_que() to avoid
+	 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
+	 * I think changing "que->txrx_use_workqueue" in interrupt handler
+	 * is lighter than doing preempt_disable()/preempt_enable() in every
+	 * ixgbe_sched_handle_que().
+	 */
 	adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
 	if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
 	    CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"),
@@ -4798,6 +4814,11 @@ ixgbe_legacy_irq(void *arg)
 	}
 
 	if ((ifp->if_flags & IFF_RUNNING) != 0) {
+		/*
+		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 */
+		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 		/* Don't run ixgbe_rxeof in interrupt context */
 		more = true;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.11
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10	Sat Apr 14 10:25:12 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.10 2018/04/14 10:25:12 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.11 2018/04/17 08:20:06 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -346,6 +346,7 @@ struct ix_queue {
 					 *     > 0 : this queue is disabled
 					 *           the value is ixgbe_disable_queue() called count
 					 */
+	bool             txrx_use_workqueue;
 };
 
 /*

Reply via email to