Module Name:    src
Committed By:   martin
Date:           Tue Feb 24 10:41:09 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #545):
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.2
        sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.3
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.16
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.17
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.18
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.19
 Add missing IXGBE_RX_LOCK_DESTROY() for the detach path.
 Remove extra IXGBE_TX_LOCK()/IXGBE_TX_UNLOCK() from
ixgbe_free_transmit_structures(). This function is called in the end of
the detach function. if_stop was called and almost all resources were
freed, so it's not required to block the TX stuff.
Fix mutex related problem reported by Uwe Toenjes in PR#49328:
 - Revert ixgbe_netbsd.c rev. 1.2
 - make CORE_LOCK adaptive
 - Release spin lock while reinitializing the jumb buffer structure.
disable preemption while scheduling the softint to configure the link.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.1 -r1.1.28.1 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.14.2.1 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.2
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1	Tue Feb 17 14:54:37 2015
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb 24 10:41:09 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.14.2.1 2015/02/17 14:54:37 martin Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.2 2015/02/24 10:41:09 martin Exp $*/
 
 #include "opt_inet.h"
 
@@ -2710,13 +2710,19 @@ ixgbe_config_link(struct adapter *adapte
 	sfp = ixgbe_is_sfp(hw);
 
 	if (sfp) { 
+		void *ip;
+
 		if (hw->phy.multispeed_fiber) {
 			hw->mac.ops.setup_sfp(hw);
 			ixgbe_enable_tx_laser(hw);
-			softint_schedule(adapter->msf_si);
+			ip = adapter->msf_si;
 		} else {
-			softint_schedule(adapter->mod_si);
+			ip = adapter->mod_si;
 		}
+
+		kpreempt_disable();
+		softint_schedule(ip);
+		kpreempt_enable();
 	} else {
 		if (hw->mac.ops.check_link)
 			err = ixgbe_check_link(hw, &autoneg,
@@ -3180,10 +3186,8 @@ ixgbe_free_transmit_structures(struct ad
 	struct tx_ring *txr = adapter->tx_rings;
 
 	for (int i = 0; i < adapter->num_queues; i++, txr++) {
-		IXGBE_TX_LOCK(txr);
 		ixgbe_free_transmit_buffers(txr);
 		ixgbe_dma_free(adapter, &txr->txdma);
-		IXGBE_TX_UNLOCK(txr);
 		IXGBE_TX_LOCK_DESTROY(txr);
 	}
 	free(adapter->tx_rings, M_DEVBUF);
@@ -3935,12 +3939,16 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/* Free current RX buffer structs and their mbufs */
 	ixgbe_free_receive_ring(rxr);
 
+	IXGBE_RX_UNLOCK(rxr);
+
 	/* Now reinitialize our supply of jumbo mbufs.  The number
 	 * or size of jumbo mbufs may have changed.
 	 */
 	ixgbe_jcl_reinit(&adapter->jcl_head, rxr->ptag->dt_dmat,
 	    2 * adapter->num_rx_desc, adapter->rx_mbuf_sz);
 
+	IXGBE_RX_LOCK(rxr);
+
 	/* Configure header split? */
 	if (ixgbe_header_split)
 		rxr->hdr_split = TRUE;
@@ -4226,6 +4234,7 @@ ixgbe_free_receive_structures(struct ada
 #endif /* LRO */
 		/* Free the ring memory as well */
 		ixgbe_dma_free(adapter, &rxr->rxdma);
+		IXGBE_RX_LOCK_DESTROY(rxr);
 	}
 
 	free(adapter->rx_rings, M_DEVBUF);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.1 src/sys/dev/pci/ixgbe/ixgbe.h:1.1.28.1
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.1	Fri Aug 12 21:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Feb 24 10:41:09 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.h,v 1.24 2011/04/28 23:21:40 jfv Exp $*/
-/*$NetBSD: ixgbe.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe.h,v 1.1.28.1 2015/02/24 10:41:09 martin Exp $*/
 
 
 #ifndef _IXGBE_H_
@@ -476,7 +476,7 @@ struct adapter {
 
 
 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
-        mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_NET)
+        mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
 #define IXGBE_CORE_LOCK_DESTROY(_sc)      mutex_destroy(&(_sc)->core_mtx)
 #define IXGBE_TX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->tx_mtx)
 #define IXGBE_RX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->rx_mtx)

Reply via email to