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 Fix mutex related problem reported by Uwe ...



details:   https://anonhg.NetBSD.org/src/rev/a53716f5d081
branches:  trunk
changeset: 335975:a53716f5d081
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Feb 04 09:05:53 2015 +0000

description:
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.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c        |   6 +++++-
 sys/dev/pci/ixgbe/ixgbe.h        |   4 ++--
 sys/dev/pci/ixgbe/ixgbe_netbsd.c |  10 +++++-----
 3 files changed, 12 insertions(+), 8 deletions(-)

diffs (91 lines):

diff -r 89af98d9d797 -r a53716f5d081 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Feb 04 07:10:47 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Feb 04 09:05:53 2015 +0000
@@ -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 @@
        /* 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;
diff -r 89af98d9d797 -r a53716f5d081 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Wed Feb 04 07:10:47 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Wed Feb 04 09:05:53 2015 +0000
@@ -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 @@
 
 
 #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)
diff -r 89af98d9d797 -r a53716f5d081 sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Wed Feb 04 07:10:47 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Wed Feb 04 09:05:53 2015 +0000
@@ -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 @@
 
        *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_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;



Home | Main Index | Thread Index | Old Index