Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up the following (via patch), requested by msaitoh i...



details:   https://anonhg.NetBSD.org/src/rev/efb6f95d6e67
branches:  netbsd-9
changeset: 986249:efb6f95d6e67
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 15 16:30:50 2021 +0000

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

        sys/dev/pci/ixgbe/ixgbe.c                       1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
        sys/dev/pci/ixgbe/ixgbe.h                       1.73, 1.76-1.80 via patch
        sys/dev/pci/ixgbe/ix_txrx.c                     1.68-1.93
        sys/dev/pci/ixgbe/ixv.c                         1.153, 1.157-1.161, 1.163-1.166 via patch
        sys/dev/pci/ixgbe/if_bypass.c                   1.7-1.9
        sys/dev/pci/ixgbe/if_fdir.c                     1.4-1.5
        sys/dev/pci/ixgbe/if_sriov.c                    1.10-1.11
        sys/dev/pci/ixgbe/ixgbe_82598.c                 1.16
        sys/dev/pci/ixgbe/ixgbe_82599.c                 1.23
        sys/dev/pci/ixgbe/ixgbe_api.c                   1.25
        sys/dev/pci/ixgbe/ixgbe_bypass.h                1.2
        sys/dev/pci/ixgbe/ixgbe_common.c                1.30-1.33
        sys/dev/pci/ixgbe/ixgbe_dcb.c                   1.10-1.11
        sys/dev/pci/ixgbe/ixgbe_dcb.h                   1.7
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.c             1.8-1.9
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.h             1.7
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.c             1.8-1.9
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.h             1.7
        sys/dev/pci/ixgbe/ixgbe_fdir.h                  1.3
        sys/dev/pci/ixgbe/ixgbe_features.h              1.3
        sys/dev/pci/ixgbe/ixgbe_mbx.c                   1.12
        sys/dev/pci/ixgbe/ixgbe_netbsd.c                1.13, 1.16-1.17
        sys/dev/pci/ixgbe/ixgbe_netbsd.h                1.13-1.14
        sys/dev/pci/ixgbe/ixgbe_netmap.c                1.3-1.4
        sys/dev/pci/ixgbe/ixgbe_netmap.h                1.2
        sys/dev/pci/ixgbe/ixgbe_osdep.c                 1.7
        sys/dev/pci/ixgbe/ixgbe_osdep.h                 1.29-1.30
        sys/dev/pci/ixgbe/ixgbe_phy.c                   1.24
        sys/dev/pci/ixgbe/ixgbe_rss.h                   1.5
        sys/dev/pci/ixgbe/ixgbe_sriov.h                 1.4
        sys/dev/pci/ixgbe/ixgbe_type.h                  1.49
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.27
        sys/dev/pci/ixgbe/ixgbe_x540.c                  1.18-1.19
        sys/dev/pci/ixgbe/ixgbe_x540.h                  1.9
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.19-1.20
        sys/dev/pci/ixgbe/ixgbe_x550.h                  1.6
        sys/dev/pci/files.pci                           1.438
        share/man/man4/ixg.4                            1.15
        share/man/man4/ixv.4                            1.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
    packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of ixgbe_reset_hw() for debugging.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxr->next_to_check updating.
- Add new sysctl "rx_copy_len".
- Add a new sysctl to read rxr->next_to_refresh.
- Print error number when error occurred.
- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
  change.
- Don't use fixed value.
- Comment out flow director processing in fast path.
- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
- KNF.
- Fix typos.

diffstat:

 share/man/man4/ixg.4                |   24 +---
 share/man/man4/ixv.4                |   24 +---
 sys/dev/pci/files.pci               |    3 +-
 sys/dev/pci/ixgbe/if_bypass.c       |    5 +-
 sys/dev/pci/ixgbe/if_fdir.c         |    4 +
 sys/dev/pci/ixgbe/if_sriov.c        |    4 +
 sys/dev/pci/ixgbe/ix_txrx.c         |  218 +++++++++++++++++++---------------
 sys/dev/pci/ixgbe/ixgbe.c           |  225 +++++++++++++++++++++++------------
 sys/dev/pci/ixgbe/ixgbe.h           |   25 +--
 sys/dev/pci/ixgbe/ixgbe_82598.c     |    5 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |    5 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |    5 +-
 sys/dev/pci/ixgbe/ixgbe_bypass.h    |    1 +
 sys/dev/pci/ixgbe/ixgbe_common.c    |   15 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |    3 +
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |    1 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |    3 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |    2 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |    3 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |    1 +
 sys/dev/pci/ixgbe/ixgbe_fdir.h      |    1 +
 sys/dev/pci/ixgbe/ixgbe_features.h  |    1 +
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |    5 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.c    |  199 +------------------------------
 sys/dev/pci/ixgbe/ixgbe_netbsd.h    |   42 +------
 sys/dev/pci/ixgbe/ixgbe_netmap.c    |    4 +
 sys/dev/pci/ixgbe/ixgbe_netmap.h    |    1 +
 sys/dev/pci/ixgbe/ixgbe_osdep.c     |    5 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h     |   22 +---
 sys/dev/pci/ixgbe/ixgbe_phy.c       |    5 +-
 sys/dev/pci/ixgbe/ixgbe_rss.h       |    1 +
 sys/dev/pci/ixgbe/ixgbe_sriov.h     |    1 +
 sys/dev/pci/ixgbe/ixgbe_type.h      |    4 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |    4 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |    5 +
 sys/dev/pci/ixgbe/ixgbe_x540.h      |    1 +
 sys/dev/pci/ixgbe/ixgbe_x550.c      |    5 +
 sys/dev/pci/ixgbe/ixgbe_x550.h      |    1 +
 sys/dev/pci/ixgbe/ixv.c             |  121 ++++++++++++++----
 39 files changed, 474 insertions(+), 530 deletions(-)

diffs (truncated from 2252 to 300 lines):

diff -r d7ac58ed3c3f -r efb6f95d6e67 share/man/man4/ixg.4
--- a/share/man/man4/ixg.4      Tue Sep 14 02:23:35 2021 +0000
+++ b/share/man/man4/ixg.4      Wed Sep 15 16:30:50 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixg.4,v 1.12.4.1 2021/03/11 16:00:24 martin Exp $
+.\" $NetBSD: ixg.4,v 1.12.4.2 2021/09/15 16:30:51 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 March 9, 2021
+.Dd August 25, 2021
 .Dt IXG 4
 .Os
 .Sh NAME
@@ -83,26 +83,6 @@
 .\" 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 d7ac58ed3c3f -r efb6f95d6e67 share/man/man4/ixv.4
--- a/share/man/man4/ixv.4      Tue Sep 14 02:23:35 2021 +0000
+++ b/share/man/man4/ixv.4      Wed Sep 15 16:30:50 2021 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ixv.4,v 1.4.2.2 2021/03/11 16:00:24 martin Exp $
+.\"    $NetBSD: ixv.4,v 1.4.2.3 2021/09/15 16:30:51 martin Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 9, 2021
+.Dd August 25, 2021
 .Dt IXV 4
 .Os
 .Sh NAME
@@ -43,26 +43,6 @@
 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 d7ac58ed3c3f -r efb6f95d6e67 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Tue Sep 14 02:23:35 2021 +0000
+++ b/sys/dev/pci/files.pci     Wed Sep 15 16:30:50 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.413.2.3 2021/03/11 16:00:24 martin Exp $
+#      $NetBSD: files.pci,v 1.413.2.4 2021/09/15 16:30:50 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -691,7 +691,6 @@
 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 d7ac58ed3c3f -r efb6f95d6e67 sys/dev/pci/ixgbe/if_bypass.c
--- a/sys/dev/pci/ixgbe/if_bypass.c     Tue Sep 14 02:23:35 2021 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c     Wed Sep 15 16:30:50 2021 +0000
@@ -1,3 +1,4 @@
+/* $NetBSD: if_bypass.c,v 1.4.8.3 2021/09/15 16:30:50 martin Exp $ */
 /******************************************************************************
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -32,6 +33,8 @@
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_bypass.c,v 1.4.8.3 2021/09/15 16:30:50 martin Exp $");
 
 #include "ixgbe.h"
 
@@ -669,7 +672,7 @@
                const char *action_str[] = {"ignore", "normal", "bypass",
                                            "isolate",};
 
-               /* verify vaild data  1 - 6 */
+               /* verify valid data  1 - 6 */
                if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR)
                        event = 0;
 
diff -r d7ac58ed3c3f -r efb6f95d6e67 sys/dev/pci/ixgbe/if_fdir.c
--- a/sys/dev/pci/ixgbe/if_fdir.c       Tue Sep 14 02:23:35 2021 +0000
+++ b/sys/dev/pci/ixgbe/if_fdir.c       Wed Sep 15 16:30:50 2021 +0000
@@ -1,3 +1,4 @@
+/* $NetBSD: if_fdir.c,v 1.2.8.1 2021/09/15 16:30:50 martin Exp $ */
 /******************************************************************************
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -32,6 +33,9 @@
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_fdir.c,v 1.2.8.1 2021/09/15 16:30:50 martin Exp $");
+
 #include "ixgbe.h"
 
 #ifdef IXGBE_FDIR
diff -r d7ac58ed3c3f -r efb6f95d6e67 sys/dev/pci/ixgbe/if_sriov.c
--- a/sys/dev/pci/ixgbe/if_sriov.c      Tue Sep 14 02:23:35 2021 +0000
+++ b/sys/dev/pci/ixgbe/if_sriov.c      Wed Sep 15 16:30:50 2021 +0000
@@ -1,3 +1,4 @@
+/* $NetBSD: if_sriov.c,v 1.6.2.1 2021/09/15 16:30:50 martin Exp $ */
 /******************************************************************************
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -32,6 +33,9 @@
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.6.2.1 2021/09/15 16:30:50 martin Exp $");
+
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
 
diff -r d7ac58ed3c3f -r efb6f95d6e67 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Tue Sep 14 02:23:35 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Wed Sep 15 16:30:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.5 2021/03/11 16:00:24 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.6 2021/09/15 16:30:50 martin Exp $ */
 
 /******************************************************************************
 
@@ -63,6 +63,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.6 2021/09/15 16:30:50 martin Exp $");
+
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -93,6 +96,10 @@
  */
 static int atr_sample_rate = 20;
 
+#define IXGBE_M_ADJ(adapter, rxr, mp)                                  \
+       if (adapter->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN))    \
+               m_adj(mp, ETHER_ALIGN)
+
 /************************************************************************
  *  Local Function prototypes
  ************************************************************************/
@@ -202,7 +209,7 @@
 {
        struct adapter  *adapter = ifp->if_softc;
        struct tx_ring  *txr;
-       int             i;
+       int             i;
 #ifdef RSS
        uint32_t bucket_id;
 #endif
@@ -482,6 +489,7 @@
                return (error);
        }
 
+#ifdef IXGBE_FDIR
        /* Do the flow director magic */
        if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
            (txr->atr_sample) && (!adapter->fdir_reinit)) {
@@ -491,12 +499,13 @@
                        txr->atr_count = 0;
                }
        }
+#endif
 
        olinfo_status |= IXGBE_ADVTXD_CC;
        i = txr->next_avail_desc;
        for (j = 0; j < map->dm_nsegs; j++) {
                bus_size_t seglen;
-               bus_addr_t segaddr;
+               uint64_t segaddr;
 
                txbuf = &txr->tx_buffers[i];
                txd = &txr->tx_base[i];
@@ -1127,7 +1136,7 @@
                 *   or the slot has the DD bit set.
                 */
                if (kring->nr_kflags < kring->nkr_num_slots &&
-                   txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD) {
+                   le32toh(txd[kring->nr_kflags].wb.status) & IXGBE_TXD_STAT_DD) {
                        netmap_tx_irq(ifp, txr->me);
                }
                return false;
@@ -1152,7 +1161,7 @@
                if (eop == NULL) /* No work */
                        break;
 
-               if ((eop->wb.status & IXGBE_TXD_STAT_DD) == 0)
+               if ((le32toh(eop->wb.status) & IXGBE_TXD_STAT_DD) == 0)
                        break;  /* I/O not complete */
 
                if (buf->m_head) {
@@ -1328,7 +1337,7 @@
  *      be recalled to try again.
  *
  *   XXX NetBSD TODO:
- *    - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl),
+ *    - The ixgbe_rxeof() function always preallocates mbuf cluster,
  *      so the ixgbe_refresh_mbufs() function can be simplified.
  *
  ************************************************************************/
@@ -1338,30 +1347,27 @@
        struct adapter      *adapter = rxr->adapter;
        struct ixgbe_rx_buf *rxbuf;
        struct mbuf         *mp;
-       int                 i, j, error;
+       int                 i, error;
        bool                refreshed = false;
 
-       i = j = rxr->next_to_refresh;
-       /* Control the loop with one beyond */
-       if (++j == rxr->num_desc)
-               j = 0;
+       i = rxr->next_to_refresh;
+       /* next_to_refresh points to the previous one */
+       if (++i == rxr->num_desc)
+               i = 0;
 
-       while (j != limit) {
+       while (i != limit) {
                rxbuf = &rxr->rx_buffers[i];
-               if (rxbuf->buf == NULL) {
-                       mp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT,
-                           MT_DATA, M_PKTHDR, rxr->mbuf_sz);
+               if (__predict_false(rxbuf->buf == NULL)) {
+                       mp = ixgbe_getcl();
                        if (mp == NULL) {
-                               rxr->no_jmbuf.ev_count++;
+                               rxr->no_mbuf.ev_count++;
                                goto update;
                        }
-                       if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN))
-                               m_adj(mp, ETHER_ALIGN);
+                       mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
+                       IXGBE_M_ADJ(adapter, rxr, mp);
                } else
                        mp = rxbuf->buf;
 
-               mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
-
                /* If we're dealing with an mbuf that was copied rather
                 * than replaced, there's no need to go through busdma.
                 */



Home | Main Index | Thread Index | Old Index