Module Name:    src
Committed By:   msaitoh
Date:           Wed Feb  4 09:05:53 UTC 2015

Modified Files:
        src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h ixgbe_netbsd.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c

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.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.17	Wed Feb  4 04:37:13 2015
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Feb  4 09:05:53 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.17 2015/02/04 04:37:13 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.18 2015/02/04 09:05:53 msaitoh Exp $*/
 
 #include "opt_inet.h"
 
@@ -3933,12 +3933,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;

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.2
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.1	Fri Aug 12 21:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed Feb  4 09:05:53 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.2 2015/02/04 09:05:53 msaitoh 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)

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.3
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.2	Wed Jan 28 00:30:25 2015
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Wed Feb  4 09:05:53 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.2 2015/01/28 00:30:25 christos Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.3 2015/02/04 09:05:53 msaitoh Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -56,7 +56,7 @@ ixgbe_dma_tag_create(bus_dma_tag_t dmat,
 
 	*dtp = NULL;
 
-	if ((dt = kmem_zalloc(sizeof(*dt), KM_NOSLEEP)) == NULL)
+	if ((dt = kmem_zalloc(sizeof(*dt), KM_SLEEP)) == NULL)
 		return ENOMEM;
 
 	dt->dt_dmat = dmat;
@@ -136,19 +136,19 @@ ixgbe_newext(ixgbe_extmem_head_t *eh, bu
 	ixgbe_extmem_t *em;
 	int nseg, rc;
 
-	em = kmem_zalloc(sizeof(*em), KM_NOSLEEP);
+	em = kmem_zalloc(sizeof(*em), KM_SLEEP);
 
 	if (em == NULL)
 		return NULL;
 
 	rc = bus_dmamem_alloc(dmat, size, PAGE_SIZE, 0, &em->em_seg, 1, &nseg,
-	    BUS_DMA_NOWAIT);
+	    BUS_DMA_WAITOK);
 
 	if (rc != 0)
 		goto post_zalloc_err;
 
 	rc = bus_dmamem_map(dmat, &em->em_seg, 1, size, &em->em_vaddr,
-	    BUS_DMA_NOWAIT);
+	    BUS_DMA_WAITOK);
 
 	if (rc != 0)
 		goto post_dmamem_err;

Reply via email to