Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up the following (all via patch), requested by msait...



details:   https://anonhg.NetBSD.org/src/rev/e7589e628f5d
branches:  netbsd-8
changeset: 953513:e7589e628f5d
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 11 16:04:24 2021 +0000

description:
Pull up the following (all via patch), requested by msaitoh in ticket #1663:

        sys/dev/pci/ixgbe/ixgbe.c                       1.259, 1.278-1.279
        sys/dev/pci/ixgbe/ixgbe.h                       1.75
        sys/dev/pci/ixgbe/ixgbe_netbsd.h                1.12
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.24-1.26
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.17
        sys/dev/pci/ixgbe/ixv.c                         1.155-1.156
        sys/dev/pci/ixgbe/ix_txrx.c                     1.64-67
        sys/dev/pci/files.pci                           1.436
        share/man/man4/ixg.4                            1.13-1.14
        share/man/man4/ixv.4                            1.3, 1.6-1.7

- Fix a problem that the RX path stalled when the mbuf cluster is
  exhausted.
- Modify some parameters to reduce packet dropping. See also the
  manual's OPTIONS section for the detail.
- ixv(4): The max number of queue(pair) is not 7 but 8. Correctly
  reset the hardware.
- Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make
  it more understandable.
- Fix a bug that some advertise speeds can't be set with
  hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error
  message, too.
- Fix typo in comment or debug message.

diffstat:

 share/man/man4/ixg.4             |  24 ++++++++++++++-
 share/man/man4/ixv.4             |  32 +++++++++++++++++---
 sys/dev/pci/files.pci            |   3 +-
 sys/dev/pci/ixgbe/ix_txrx.c      |  62 +++++++++++++++++++++++++++++++++++----
 sys/dev/pci/ixgbe/ixgbe.c        |  18 +++++++++--
 sys/dev/pci/ixgbe/ixgbe.h        |   5 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.h |  16 +++++++++-
 sys/dev/pci/ixgbe/ixgbe_vf.c     |   9 +++--
 sys/dev/pci/ixgbe/ixgbe_x540.c   |   2 +-
 sys/dev/pci/ixgbe/ixv.c          |  14 +++++++-
 10 files changed, 156 insertions(+), 29 deletions(-)

diffs (truncated from 465 to 300 lines):

diff -r fa586d0a6e65 -r e7589e628f5d share/man/man4/ixg.4
--- a/share/man/man4/ixg.4      Tue Mar 09 16:00:14 2021 +0000
+++ b/share/man/man4/ixg.4      Thu Mar 11 16:04:24 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixg.4,v 1.10.4.1 2018/05/12 10:35:45 martin Exp $
+.\" $NetBSD: ixg.4,v 1.10.4.2 2021/03/11 16:04:25 martin Exp $
 .\"
 .\" Copyright (c) 2001-2008, Intel Corporation
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $
 .\"
-.Dd May 9, 2018
+.Dd March 9, 2021
 .Dt IXG 4
 .Os
 .Sh NAME
@@ -83,6 +83,26 @@
 .\" with a supported adapter, email the specific information related to the
 .\" issue to
 .\" .Aq freebsdnic%mailbox.intel.com@localhost .
+.Sh OPTIONS
+The
+.Nm
+driver doesn't use the common
+.Xr MCLGET 9
+interface and use the driver specific cluster allocation mechanism.
+If it's exhausted, the
+.Xr evcnt 9
+counter "ixgX qY Rx no jumbo mbuf" is incremented.
+If this is observed,
+the number can be changed by the following config parameter:
+.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
+.It Dv IXGBE_JCLNUM_MULTI
+The number of RX jumbo buffers (clusters) per queue is calculated by
+.Dv IXGBE_JCLNUM_MULTI
+* (number of rx descriptors).
+The total number of clusters per queue is available via the
+.Li hw.ixgN.num_jcl_per_queue
+.Xr sysctl 7 .
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ixv 4 ,
diff -r fa586d0a6e65 -r e7589e628f5d share/man/man4/ixv.4
--- a/share/man/man4/ixv.4      Tue Mar 09 16:00:14 2021 +0000
+++ b/share/man/man4/ixv.4      Thu Mar 11 16:04:24 2021 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ixv.4,v 1.3.2.3 2019/09/26 18:19:27 martin Exp $
+.\"    $NetBSD: ixv.4,v 1.3.2.4 2021/03/11 16:04:25 martin Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,20 +27,42 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 5, 2019
+.Dd March 9, 2021
 .Dt IXV 4
 .Os
 .Sh NAME
 .Nm ixv
-.Nd Intel 10 giabit Ethernet virtual function
+.Nd Intel 10 Gigabit Ethernet virtual function
 .Sh SYNOPSIS
 .Cd "ixv* at pci? dev ? function ?"
 .Sh DESCRIPTION
 The
 .Nm
-driver supports Intel 10 gigabit Ethernet virtual function that 82599 and
+driver supports Intel 10 Gigabit Ethernet virtual function that 82599 and
 newer chips support.
-It can be used on a NetBSD guest that the host supports SR-IOV.
+It can be used on a
+.Nx
+guest that the host supports SR-IOV.
+.Sh OPTIONS
+The
+.Nm
+driver doesn't use the common
+.Xr MCLGET 9
+interface and use the driver specific cluster allocation mechanism.
+If it's exhausted, the
+.Xr evcnt 9
+counter "ixgX qY Rx no jumbo mbuf" is incremented.
+If this is observed,
+the number can be changed by the following config parameter:
+.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
+.It Dv IXGBE_JCLNUM_MULTI
+The number of RX jumbo buffers (clusters) per queue is calculated by
+.Dv IXGBE_JCLNUM_MULTI
+* (number of rx descriptors).
+The total number of clusters per queue is available with the
+.Li hw.ixgN.num_jcl_per_queue
+.Xr sysctl 7 .
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ixg 4 ,
diff -r fa586d0a6e65 -r e7589e628f5d sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Tue Mar 09 16:00:14 2021 +0000
+++ b/sys/dev/pci/files.pci     Thu Mar 11 16:04:24 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.388.4.4 2018/12/07 17:11:37 martin Exp $
+#      $NetBSD: files.pci,v 1.388.4.5 2021/03/11 16:04:24 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -687,6 +687,7 @@
 file   dev/pci/ixgbe/ixgbe_vf.c        ixg | ixv
 file   dev/pci/ixgbe/if_bypass.c       ixg | ixv
 file   dev/pci/ixgbe/if_fdir.c         ixg | ixv
+defparam opt_ixgbe.h   IXGBE_JCLNUM_MULTI
 
 # This appears to be the driver for virtual instances of i82599.
 device ixv: ether, ifnet, arp, mii, mii_phy
diff -r fa586d0a6e65 -r e7589e628f5d sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Tue Mar 09 16:00:14 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Thu Mar 11 16:04:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.20 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.21 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
 
@@ -1326,6 +1326,11 @@
  *      exhaustion are unnecessary, if an mbuf cannot be obtained
  *      it just returns, keeping its placeholder, thus it can simply
  *      be recalled to try again.
+ *
+ *   XXX NetBSD TODO:
+ *    - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl),
+ *      so the ixgbe_refresh_mbufs() function can be simplified.
+ *
  ************************************************************************/
 static void
 ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
@@ -1515,7 +1520,7 @@
         * Assume all of rxr->ptag are the same.
         */
        ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr,
-           (2 * adapter->num_rx_desc), adapter->rx_mbuf_sz);
+           adapter->num_jcl, adapter->rx_mbuf_sz);
 
        IXGBE_RX_LOCK(rxr);
 
@@ -1812,7 +1817,9 @@
        struct ixgbe_rx_buf     *rbuf, *nbuf;
        int                     i, nextp, processed = 0;
        u32                     staterr = 0;
-       u32                     count = adapter->rx_process_limit;
+       u32                     count = 0;
+       u32                     limit = adapter->rx_process_limit;
+       bool                    discard_multidesc = false;
 #ifdef RSS
        u16                     pkt_info;
 #endif
@@ -1829,8 +1836,16 @@
        }
 #endif /* DEV_NETMAP */
 
-       for (i = rxr->next_to_check; count != 0;) {
+       /*
+        * The max number of loop is rx_process_limit. If discard_multidesc is
+        * true, continue processing to not to send broken packet to the upper
+        * layer.
+        */
+       for (i = rxr->next_to_check;
+            (count < limit) || (discard_multidesc == true);) {
+
                struct mbuf *sendmp, *mp;
+               struct mbuf *newmp;
                u32         rsc, ptype;
                u16         len;
                u16         vtag = 0;
@@ -1849,7 +1864,7 @@
                if ((staterr & IXGBE_RXD_STAT_DD) == 0)
                        break;
 
-               count--;
+               count++;
                sendmp = NULL;
                nbuf = NULL;
                rsc = 0;
@@ -1870,9 +1885,38 @@
 #endif
                        rxr->rx_discarded.ev_count++;
                        ixgbe_rx_discard(rxr, i);
+                       discard_multidesc = false;
                        goto next_desc;
                }
 
+               /* pre-alloc new mbuf */
+               if (!discard_multidesc)
+                       newmp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, MT_DATA,
+                           M_PKTHDR, rxr->mbuf_sz);
+               else
+                       newmp = NULL;
+               if (newmp == NULL) {
+                       rxr->no_jmbuf.ev_count++;
+                       /*
+                        * Descriptor initialization is already done by the
+                        * above code (cur->wb.upper.status_error = 0).
+                        * So, we can reuse current rbuf->buf for new packet.
+                        *
+                        * Rewrite the buffer addr, see comment in
+                        * ixgbe_rx_discard().
+                        */
+                       cur->read.pkt_addr = rbuf->addr;
+                       m_freem(rbuf->fmp);
+                       rbuf->fmp = NULL;
+                       if (!eop) {
+                               /* Discard the entire packet. */
+                               discard_multidesc = true;
+                       } else
+                               discard_multidesc = false;
+                       goto next_desc;
+               }
+               discard_multidesc = false;
+
                bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
                    rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 
@@ -1921,7 +1965,8 @@
                 */
                sendmp = rbuf->fmp;
                if (sendmp != NULL) {  /* secondary frag */
-                       rbuf->buf = rbuf->fmp = NULL;
+                       rbuf->buf = newmp;
+                       rbuf->fmp = NULL;
                        mp->m_flags &= ~M_PKTHDR;
                        sendmp->m_pkthdr.len += mp->m_len;
                } else {
@@ -1940,10 +1985,13 @@
                                        sendmp->m_len = len;
                                        rxr->rx_copies.ev_count++;
                                        rbuf->flags |= IXGBE_RX_COPY;
+
+                                       m_freem(newmp);
                                }
                        }
                        if (sendmp == NULL) {
-                               rbuf->buf = rbuf->fmp = NULL;
+                               rbuf->buf = newmp;
+                               rbuf->fmp = NULL;
                                sendmp = mp;
                        }
 
diff -r fa586d0a6e65 -r e7589e628f5d sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Mar 09 16:00:14 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Mar 11 16:04:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.42 2020/09/02 12:27:54 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.43 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
 
@@ -67,6 +67,7 @@
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_net_mpsafe.h"
+#include "opt_ixgbe.h"
 #endif
 
 #include "ixgbe.h"
@@ -938,6 +939,8 @@
        } else
                adapter->num_rx_desc = ixgbe_rxd;
 
+       adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI;
+
        /* Allocate our TX/RX Queues */
        if (ixgbe_allocate_queues(adapter)) {
                error = ENOMEM;
@@ -1862,7 +1865,7 @@
                    NULL, adapter->queues[i].evnamebuf, "TSO");
                evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC,
                    NULL, adapter->queues[i].evnamebuf,
-                   "Queue No Descriptor Available");
+                   "TX Queue No Descriptor Available");
                evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC,
                    NULL, adapter->queues[i].evnamebuf,
                    "Queue Packets Transmitted");
@@ -3260,6 +3263,13 @@
                aprint_error_dev(dev, "could not create sysctl\n");
 
        if (sysctl_createv(log, 0, &rnode, &cnode,
+           CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
+           SYSCTL_DESCR("Number of jumbo buffers per queue"),
+           NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
+           CTL_EOL) != 0)
+               aprint_error_dev(dev, "could not create sysctl\n");
+
+       if (sysctl_createv(log, 0, &rnode, &cnode,
            CTLFLAG_READONLY, CTLTYPE_INT,
            "num_queues", SYSCTL_DESCR("Number of queues"),
            NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -5341,9 +5351,9 @@



Home | Main Index | Thread Index | Old Index