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 - Fixes two problem:



details:   https://anonhg.NetBSD.org/src/rev/17599dd18385
branches:  trunk
changeset: 828241:17599dd18385
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Dec 04 09:29:42 2017 +0000

description:
- Fixes two problem:
  1) RX may accesses freed area.
  2) if_init() takes long time on many core machine.
  Call ixgbe_jcl_reinit() not in ixgbe_setup_receive_ring() but in the
  biginning of ixgbe_setup_receive_structures(). It was OK for pre multiqueue,
  but it's not OK now because we support multiqueue.
- Fix comment of ixgbe_free_receive_ring().

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c |  26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diffs (54 lines):

diff -r ce5bc78919ae -r 17599dd18385 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Mon Dec 04 09:14:23 2017 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Mon Dec 04 09:29:42 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.29 2017/09/26 07:42:06 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.30 2017/12/04 09:29:42 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1355,9 +1355,7 @@
 } /* ixgbe_allocate_receive_buffers */
 
 /************************************************************************
- * ixgbe_setup_receive_ring
- *
- *   Initialize a receive ring and its buffers.
+ * ixgbe_free_receive_ring
  ************************************************************************/
 static void
 ixgbe_free_receive_ring(struct rx_ring *rxr)
@@ -1409,17 +1407,6 @@
        /* 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->num_queues,
-           adapter->rx_mbuf_sz);
-
-       IXGBE_RX_LOCK(rxr);
-
        /* Now replenish the mbufs */
        for (int j = 0; j != rxr->num_desc; ++j) {
                struct mbuf *mp;
@@ -1526,6 +1513,15 @@
        struct rx_ring *rxr = adapter->rx_rings;
        int            j;
 
+       /*
+        * Now reinitialize our supply of jumbo mbufs.  The number
+        * or size of jumbo mbufs may have changed.
+        * Assume all of rxr->ptag are the same.
+        */
+       ixgbe_jcl_reinit(&adapter->jcl_head, rxr->ptag->dt_dmat,
+           (2 * adapter->num_rx_desc) * adapter->num_queues,
+           adapter->rx_mbuf_sz);
+
        for (j = 0; j < adapter->num_queues; j++, rxr++)
                if (ixgbe_setup_receive_ring(rxr))
                        goto fail;



Home | Main Index | Thread Index | Old Index