Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up the following, requested by msa...



details:   https://anonhg.NetBSD.org/src/rev/d71901ffee5b
branches:  netbsd-8
changeset: 359909:d71901ffee5b
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 30 16:06:35 2022 +0000

description:
Pull up the following, requested by msaitoh in ticket #1729:

        sys/dev/pci/ixgbe/if_sriov.c                    1.12-1.16
        sys/dev/pci/ixgbe/ixgbe.c                       1.295-1.297,1.300,1.304 via patch
        sys/dev/pci/ixgbe/ixgbe.h                       1.84
        sys/dev/pci/ixgbe/ixgbe_82598.c                 1.17-1.18
        sys/dev/pci/ixgbe/ixgbe_82598.h                 1.9
        sys/dev/pci/ixgbe/ixgbe_82599.c                 1.24-1.28
        sys/dev/pci/ixgbe/ixgbe_82599.h                 1.8
        sys/dev/pci/ixgbe/ixgbe_api.c                   1.26-1.27
        sys/dev/pci/ixgbe/ixgbe_api.h                   1.16
        sys/dev/pci/ixgbe/ixgbe_bypass.h                1.3
        sys/dev/pci/ixgbe/ixgbe_common.c                1.34-1.42
        sys/dev/pci/ixgbe/ixgbe_common.h                1.15-1.16
        sys/dev/pci/ixgbe/ixgbe_dcb.c                   1.12-1.13
        sys/dev/pci/ixgbe/ixgbe_dcb.h                   1.8-1.9
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.c             1.10-1.12
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.h             1.8
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.c             1.10-1.11
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.h             1.8
        sys/dev/pci/ixgbe/ixgbe_fdir.h                  1.4
        sys/dev/pci/ixgbe/ixgbe_features.h              1.4
        sys/dev/pci/ixgbe/ixgbe_mbx.c                   1.13-1.15
        sys/dev/pci/ixgbe/ixgbe_mbx.h                   1.15-1.18
        sys/dev/pci/ixgbe/ixgbe_netmap.c                1.5
        sys/dev/pci/ixgbe/ixgbe_osdep.c                 1.8
        sys/dev/pci/ixgbe/ixgbe_osdep.h                 1.31
        sys/dev/pci/ixgbe/ixgbe_phy.c                   1.25-1.29
        sys/dev/pci/ixgbe/ixgbe_phy.h                   1.13
        sys/dev/pci/ixgbe/ixgbe_rss.h                   1.6
        sys/dev/pci/ixgbe/ixgbe_sriov.h                 1.5
        sys/dev/pci/ixgbe/ixgbe_type.h                  1.51-1.54
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.28-1.29
        sys/dev/pci/ixgbe/ixgbe_vf.h                    1.15
        sys/dev/pci/ixgbe/ixgbe_x540.c                  1.20-1.22
        sys/dev/pci/ixgbe/ixgbe_x540.h                  1.10
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.21-1.25
        sys/dev/pci/ixgbe/ixgbe_x550.h                  1.7
        sys/dev/pci/ixgbe/ixv.c                         1.170, 1.174-1.175 via patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
  the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
  - Fix infinite recursion on PCIe link down if VMDQ is used.
  - Move PF mailbox initialization from ixgbe_attach() to
    ixgbe_init_iov().
  - Add IPv6 mask for flow director.
  - Change error level in ixgbe_fc_autoneg().
  - Check host interface return status when writing NVM.
  - Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
  rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
  IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.

diffstat:

 sys/dev/pci/ixgbe/if_sriov.c        |    34 +-
 sys/dev/pci/ixgbe/ixgbe.c           |    66 +-
 sys/dev/pci/ixgbe/ixgbe.h           |    10 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c     |   244 +++---
 sys/dev/pci/ixgbe/ixgbe_82598.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |   403 ++++++------
 sys/dev/pci/ixgbe/ixgbe_82599.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |   910 ++++++++++++++--------------
 sys/dev/pci/ixgbe/ixgbe_api.h       |     4 +-
 sys/dev/pci/ixgbe/ixgbe_bypass.h    |     4 +-
 sys/dev/pci/ixgbe/ixgbe_common.c    |  1081 +++++++++++++++++-----------------
 sys/dev/pci/ixgbe/ixgbe_common.h    |     6 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |    12 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |     8 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |    16 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |     8 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_fdir.h      |     4 +-
 sys/dev/pci/ixgbe/ixgbe_features.h  |     4 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |   335 +++++++---
 sys/dev/pci/ixgbe/ixgbe_mbx.h       |    59 +-
 sys/dev/pci/ixgbe/ixgbe_netmap.c    |    10 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.c     |     6 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c       |   446 +++++++-------
 sys/dev/pci/ixgbe/ixgbe_phy.h       |     4 +-
 sys/dev/pci/ixgbe/ixgbe_rss.h       |     4 +-
 sys/dev/pci/ixgbe/ixgbe_sriov.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_type.h      |    49 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |   196 +++---
 sys/dev/pci/ixgbe/ixgbe_vf.h        |     4 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |   196 +++---
 sys/dev/pci/ixgbe/ixgbe_x540.h      |     4 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c      |   502 ++++++++-------
 sys/dev/pci/ixgbe/ixgbe_x550.h      |     4 +-
 sys/dev/pci/ixgbe/ixv.c             |   100 +-
 37 files changed, 2451 insertions(+), 2306 deletions(-)

diffs (truncated from 9328 to 300 lines):

diff -r b985ad85ec51 -r d71901ffee5b sys/dev/pci/ixgbe/if_sriov.c
--- a/sys/dev/pci/ixgbe/if_sriov.c      Sat Jan 29 17:13:08 2022 +0000
+++ b/sys/dev/pci/ixgbe/if_sriov.c      Sun Jan 30 16:06:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.1.4.6 2021/09/15 16:38:00 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $ */
 /******************************************************************************
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -34,7 +34,7 @@
 /*$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.1.4.6 2021/09/15 16:38:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $");
 
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
@@ -94,26 +94,26 @@
 
 /* Support functions for SR-IOV/VF management */
 static inline void
-ixgbe_send_vf_msg(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
+ixgbe_send_vf_msg(struct ixgbe_hw *hw, struct ixgbe_vf *vf, u32 msg)
 {
        if (vf->flags & IXGBE_VF_CTS)
                msg |= IXGBE_VT_MSGTYPE_CTS;
 
-       adapter->hw.mbx.ops.write(&adapter->hw, &msg, 1, vf->pool);
+       hw->mbx.ops.write(hw, &msg, 1, vf->pool);
 }
 
 static inline void
 ixgbe_send_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
 {
        msg &= IXGBE_VT_MSG_MASK;
-       ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_ACK);
+       ixgbe_send_vf_msg(&adapter->hw, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS);
 }
 
 static inline void
 ixgbe_send_vf_nack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
 {
        msg &= IXGBE_VT_MSG_MASK;
-       ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_NACK);
+       ixgbe_send_vf_msg(&adapter->hw, vf, msg | IXGBE_VT_MSGTYPE_FAILURE);
 }
 
 static inline void
@@ -209,7 +209,7 @@
        for (int i = 0; i < adapter->num_vfs; i++) {
                vf = &adapter->vfs[i];
                if (vf->flags & IXGBE_VF_ACTIVE)
-                       ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
+                       ixgbe_send_vf_msg(&adapter->hw, vf, IXGBE_PF_CONTROL_MSG);
        }
 } /* ixgbe_ping_all_vfs */
 
@@ -255,8 +255,9 @@
 
 
 static void
-ixgbe_clear_vfmbmem(struct ixgbe_hw *hw, struct ixgbe_vf *vf)
+ixgbe_clear_vfmbmem(struct adapter *adapter, struct ixgbe_vf *vf)
 {
+       struct ixgbe_hw *hw = &adapter->hw;
        uint32_t vf_index = IXGBE_VF_INDEX(vf->pool);
        uint16_t mbx_size = hw->mbx.size;
        uint16_t i;
@@ -323,7 +324,7 @@
        // XXX clear multicast addresses
 
        ixgbe_clear_rar(&adapter->hw, vf->rar_index);
-       ixgbe_clear_vfmbmem(&adapter->hw, vf);
+       ixgbe_clear_vfmbmem(adapter, vf);
        ixgbe_toggle_txdctl(&adapter->hw, IXGBE_VF_INDEX(vf->pool));
 
        vf->api_ver = IXGBE_API_VER_UNKNOWN;
@@ -377,9 +378,9 @@
        if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) {
                ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr,
                    vf->pool, TRUE);
-               ack = IXGBE_VT_MSGTYPE_ACK;
+               ack = IXGBE_VT_MSGTYPE_SUCCESS;
        } else
-               ack = IXGBE_VT_MSGTYPE_NACK;
+               ack = IXGBE_VT_MSGTYPE_FAILURE;
 
        ixgbe_vf_enable_transmit(adapter, vf);
        ixgbe_vf_enable_receive(adapter, vf);
@@ -571,7 +572,7 @@
                return;
        }
 
-       resp[0] = IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK |
+       resp[0] = IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_SUCCESS |
            IXGBE_VT_MSGTYPE_CTS;
 
        num_queues = ixgbe_vf_queues(adapter->iov_mode);
@@ -640,7 +641,7 @@
 
 /* Tasklet for handling VF -> PF mailbox messages */
 void
-ixgbe_handle_mbx(void *context, int pending)
+ixgbe_handle_mbx(void *context)
 {
        struct adapter *adapter = context;
        struct ixgbe_hw *hw;
@@ -713,6 +714,7 @@
        }
 
        adapter->num_vfs = num_vfs;
+       ixgbe_init_mbx_params_pf(&adapter->hw);
 
        /* set the SRIOV flag now as it's needed
         * by ixgbe_init_locked() */
@@ -795,7 +797,7 @@
        ixgbe_vf_enable_transmit(adapter, vf);
        ixgbe_vf_enable_receive(adapter, vf);
 
-       ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
+       ixgbe_send_vf_msg(&adapter->hw, vf, IXGBE_PF_CONTROL_MSG);
 } /* ixgbe_init_vf */
 
 void
@@ -920,9 +922,9 @@
 #else
 
 void
-ixgbe_handle_mbx(void *context, int pending)
+ixgbe_handle_mbx(void *context)
 {
-       UNREFERENCED_2PARAMETER(context, pending);
+       UNREFERENCED_1PARAMETER(context);
 } /* ixgbe_handle_mbx */
 
 inline int
diff -r b985ad85ec51 -r d71901ffee5b sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Sat Jan 29 17:13:08 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Sun Jan 30 16:06:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.47 2022/01/30 16:06:35 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.47 2022/01/30 16:06:35 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -230,7 +230,7 @@
 static void    ixgbe_clear_evcnt(struct adapter *);
 static int     ixgbe_set_flowcntl(struct adapter *, int);
 static int     ixgbe_set_advertise(struct adapter *, int);
-static int     ixgbe_get_advertise(struct adapter *);
+static int     ixgbe_get_default_advertise(struct adapter *);
 
 /* Sysctl handlers */
 static void    ixgbe_set_sysctl_value(struct adapter *, const char *,
@@ -719,7 +719,7 @@
                /* Disable Head Writeback */
                /*
                 * Note: for X550 series devices, these registers are actually
-                * prefixed with TPH_ isntead of DCA_, but the addresses and
+                * prefixed with TPH_ instead of DCA_, but the addresses and
                 * fields remain the same.
                 */
                switch (hw->mac.type) {
@@ -875,9 +875,6 @@
        }
        aprint_normal_dev(dev, "device %s\n", str);
 
-       if (hw->mbx.ops.init_params)
-               hw->mbx.ops.init_params(hw);
-
        hw->allow_unsupported_sfp = allow_unsupported_sfp;
 
        /* Pick up the 82599 settings */
@@ -986,6 +983,23 @@
        /* NVM Image Version */
        high = low = 0;
        switch (hw->mac.type) {
+       case ixgbe_mac_82598EB:
+               /*
+                * Print version from the dev starter version (0x29). The
+                * location is the same as newer device's IXGBE_NVM_MAP_VER.
+                */
+               hw->eeprom.ops.read(hw, IXGBE_NVM_MAP_VER, &nvmreg);
+               if (nvmreg == 0xffff)
+                       break;
+               high = (nvmreg >> 12) & 0x0f;
+               low = (nvmreg >> 4) & 0xff;
+               id = nvmreg & 0x0f;
+               /*
+                * The following output might not be correct. Some 82598 cards
+                * have 0x1070 or 0x2090. 82598 spec update notes about 2.9.0.
+                */
+               aprint_normal(" NVM Image Version %u.%u.%u,", high, low, id);
+               break;
        case ixgbe_mac_X540:
        case ixgbe_mac_X550EM_a:
                hw->eeprom.ops.read(hw, IXGBE_NVM_IMAGE_VER, &nvmreg);
@@ -1201,7 +1215,7 @@
        /* Set an initial dmac value */
        adapter->dmac = 0;
        /* Set initial advertised speeds (if applicable) */
-       adapter->advertise = ixgbe_get_advertise(adapter);
+       adapter->advertise = ixgbe_get_default_advertise(adapter);
 
        if (adapter->feat_cap & IXGBE_FEATURE_SRIOV)
                ixgbe_define_iov_schemas(dev, &error);
@@ -1577,8 +1591,8 @@
        struct ifnet          *ifp = adapter->ifp;
        struct ixgbe_hw       *hw = &adapter->hw;
        struct ixgbe_hw_stats *stats = &adapter->stats.pf;
-       u32                   missed_rx = 0, bprc, lxon, lxoff, total;
-       u64                   total_missed_rx = 0;
+       u32                   missed_rx = 0, bprc, lxon, lxoff;
+       u64                   total, total_missed_rx = 0;
        uint64_t              crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
        unsigned int          queue_counters;
        int                   i;
@@ -5380,10 +5394,10 @@
  *
  *   Flags:
  *     0x00 - Default (all capable link speed)
- *     0x01 - advertise 100 Mb
- *     0x02 - advertise 1G
- *     0x04 - advertise 10G
- *     0x08 - advertise 10 Mb
+ *     0x1  - advertise 100 Mb
+ *     0x2  - advertise 1G
+ *     0x4  - advertise 10G
+ *     0x8  - advertise 10 Mb (yes, Mb)
  *     0x10 - advertise 2.5G
  *     0x20 - advertise 5G
  ************************************************************************/
@@ -5484,19 +5498,19 @@
 } /* ixgbe_set_advertise */
 
 /************************************************************************
- * ixgbe_get_advertise - Get current advertised speed settings
+ * ixgbe_get_default_advertise - Get default advertised speed settings
  *
  *   Formatted for sysctl usage.
  *   Flags:
- *     0x01 - advertise 100 Mb
- *     0x02 - advertise 1G
- *     0x04 - advertise 10G
- *     0x08 - advertise 10 Mb (yes, Mb)
+ *     0x1  - advertise 100 Mb
+ *     0x2  - advertise 1G
+ *     0x4  - advertise 10G
+ *     0x8  - advertise 10 Mb (yes, Mb)
  *     0x10 - advertise 2.5G
  *     0x20 - advertise 5G
  ************************************************************************/
 static int
-ixgbe_get_advertise(struct adapter *adapter)
+ixgbe_get_default_advertise(struct adapter *adapter)
 {
        struct ixgbe_hw  *hw = &adapter->hw;
        int              speed;
@@ -5517,15 +5531,15 @@
                return (0);
 
        speed =
-           ((link_caps & IXGBE_LINK_SPEED_10GB_FULL)  ? 0x04 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_1GB_FULL)   ? 0x02 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_100_FULL)   ? 0x01 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_10_FULL)    ? 0x08 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_10GB_FULL)  ? 0x4  : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_5GB_FULL)   ? 0x20 : 0) |
            ((link_caps & IXGBE_LINK_SPEED_2_5GB_FULL) ? 0x10 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_5GB_FULL)   ? 0x20 : 0);
+           ((link_caps & IXGBE_LINK_SPEED_1GB_FULL)   ? 0x2  : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_100_FULL)   ? 0x1  : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_10_FULL)    ? 0x8  : 0);
 
        return speed;
-} /* ixgbe_get_advertise */
+} /* ixgbe_get_default_advertise */
 
 /************************************************************************
  * ixgbe_sysctl_dmac - Manage DMA Coalescing
diff -r b985ad85ec51 -r d71901ffee5b sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Sat Jan 29 17:13:08 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Sun Jan 30 16:06:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.23 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.24 2022/01/30 16:06:35 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -664,10 +664,10 @@



Home | Main Index | Thread Index | Old Index