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 revisions, requested by msaitoh in ...



details:   https://anonhg.NetBSD.org/src/rev/b36f4662b60d
branches:  netbsd-9
changeset: 462570:b36f4662b60d
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 26 19:07:22 2019 +0000

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

        sys/dev/pci/ixgbe/ixgbe_type.h                  1.42-1.43
        sys/dev/pci/ixgbe/ixgbe.c                       1.209-1.213
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.16
        sys/dev/pci/ixgbe/ixv.c                         1.131-1.138
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.19-1.22
        sys/dev/pci/ixgbe/ixgbe_vf.h                    1.14
        sys/dev/pci/ixgbe/ixgbe.h                       1.57-1.58
        share/man/man4/ixv.4                            1.5

- Fix a bug that MBSDC (Bad SFD Count) isn't counted on X550EM_X and
  X550EM_A. The register is for X550 and newer.
- ixv(4): Make SIOCADDMULTI returns ENOSPC and print error message
  when the Ethernet multicast address list exceeds the limit(30) and
  can't be ALLMULTI.
- ixv(4): SIOCZIFDATA clear the event counters as ixgbe.c.
- Reduce ixv(4)'s multicast table array size in ixv_set_multi from
  MAX_NUM_MULTICAST_ADDRESSES(128) to IXGBE_MAX_VF_MC(30).
- ixv(4): Add support ALLMULTI and PROMISC.
- if_flags is neither int nor short. It's unsigned short.
- ixg(4): Fix a bug that the multicast filter isn't correctly
  initialized when the total number of the Ethernet multicast
  addresses is just 128.
- Make ixv_set_multi() work correctly (especially for PROMISC) when the
  function is called from if_init().
- Remove *_set_promisc() and use *_set_multi(). And then, rename
  *_set_multi() to *_set_rxfilter().
- ixv(4): If a multicast entry has range, use ALLMULTI like others.
- Fix typo in comment. Found by Wataru Ashihara.

diffstat:

 share/man/man4/ixv.4           |   21 ++-
 sys/dev/pci/ixgbe/ixgbe.c      |   86 +++---------
 sys/dev/pci/ixgbe/ixgbe.h      |    6 +-
 sys/dev/pci/ixgbe/ixgbe_type.h |    5 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c   |   38 +++++-
 sys/dev/pci/ixgbe/ixgbe_vf.h   |    4 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c |    2 +-
 sys/dev/pci/ixgbe/ixv.c        |  275 +++++++++++++++++++++++++++++++++++++---
 8 files changed, 335 insertions(+), 102 deletions(-)

diffs (truncated from 763 to 300 lines):

diff -r 57baf1ed2d61 -r b36f4662b60d share/man/man4/ixv.4
--- a/share/man/man4/ixv.4      Thu Sep 26 19:04:00 2019 +0000
+++ b/share/man/man4/ixv.4      Thu Sep 26 19:07:22 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ixv.4,v 1.4 2019/07/18 03:52:26 msaitoh Exp $
+.\"    $NetBSD: ixv.4,v 1.4.2.1 2019/09/26 19:07:23 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 July 18, 2019
+.Dd September 5, 2019
 .Dt IXV 4
 .Os
 .Sh NAME
@@ -61,3 +61,20 @@
 .Nm
 driver was written by
 .An Intel Corporation Aq Mt freebsdnic%mailbox.intel.com@localhost .
+.Sh BUGS
+The following event counters are not cleared by
+.Dv SIOCZIFDATA
+because the corresponding registers are read only and not cleared on read:
+.Pp
+.Bl -item -offset indent -compact
+.It
+Good Packets Received
+.It
+Good Octets Received
+.It
+Multicast Packets Received
+.It
+Good Packets Transmitted
+.It
+Good Octets Transmitted
+.El
diff -r 57baf1ed2d61 -r b36f4662b60d sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 26 19:04:00 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 26 19:07:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.4 2019/09/05 09:11:03 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.5 2019/09/26 19:07:22 martin Exp $ */
 
 /******************************************************************************
 
@@ -211,8 +211,7 @@
 static void    ixgbe_enable_intr(struct adapter *);
 static void    ixgbe_disable_intr(struct adapter *);
 static void    ixgbe_update_stats_counters(struct adapter *);
-static void    ixgbe_set_promisc(struct adapter *);
-static void    ixgbe_set_multi(struct adapter *);
+static void    ixgbe_set_rxfilter(struct adapter *);
 static void    ixgbe_update_link_status(struct adapter *);
 static void    ixgbe_set_ivar(struct adapter *, u8, u8, s8);
 static void    ixgbe_configure_ivars(struct adapter *);
@@ -1571,7 +1570,7 @@
        stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
        stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
        stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
-       if (hw->mac.type == ixgbe_mac_X550)
+       if (hw->mac.type >= ixgbe_mac_X550)
                stats->mbsdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MBSDC);
 
        /* 16 registers exist */
@@ -2126,7 +2125,8 @@
        stats->illerrc.ev_count = 0;
        stats->errbc.ev_count = 0;
        stats->mspdc.ev_count = 0;
-       stats->mbsdc.ev_count = 0;
+       if (hw->mac.type >= ixgbe_mac_X550)
+               stats->mbsdc.ev_count = 0;
        stats->mpctotal.ev_count = 0;
        stats->mlfc.ev_count = 0;
        stats->mrfc.ev_count = 0;
@@ -3041,49 +3041,6 @@
 } /* ixgbe_media_change */
 
 /************************************************************************
- * ixgbe_set_promisc
- ************************************************************************/
-static void
-ixgbe_set_promisc(struct adapter *adapter)
-{
-       struct ifnet *ifp = adapter->ifp;
-       int          mcnt = 0;
-       u32          rctl;
-       struct ether_multi *enm;
-       struct ether_multistep step;
-       struct ethercom *ec = &adapter->osdep.ec;
-
-       KASSERT(mutex_owned(&adapter->core_mtx));
-       rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
-       rctl &= (~IXGBE_FCTRL_UPE);
-       ETHER_LOCK(ec);
-       if (ec->ec_flags & ETHER_F_ALLMULTI)
-               mcnt = MAX_NUM_MULTICAST_ADDRESSES;
-       else {
-               ETHER_FIRST_MULTI(step, ec, enm);
-               while (enm != NULL) {
-                       if (mcnt == MAX_NUM_MULTICAST_ADDRESSES)
-                               break;
-                       mcnt++;
-                       ETHER_NEXT_MULTI(step, enm);
-               }
-       }
-       if (mcnt < MAX_NUM_MULTICAST_ADDRESSES)
-               rctl &= (~IXGBE_FCTRL_MPE);
-       IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
-
-       if (ifp->if_flags & IFF_PROMISC) {
-               rctl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
-               IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
-       } else if (ec->ec_flags & ETHER_F_ALLMULTI) {
-               rctl |= IXGBE_FCTRL_MPE;
-               rctl &= ~IXGBE_FCTRL_UPE;
-               IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
-       }
-       ETHER_UNLOCK(ec);
-} /* ixgbe_set_promisc */
-
-/************************************************************************
  * ixgbe_msix_link - Link status change ISR (MSI/MSI-X)
  ************************************************************************/
 static int
@@ -3993,7 +3950,7 @@
        ixgbe_initialize_transmit_units(adapter);
 
        /* Setup Multicast table */
-       ixgbe_set_multi(adapter);
+       ixgbe_set_rxfilter(adapter);
 
        /* Determine the correct mbuf pool, based on frame size */
        if (adapter->max_frame_size <= MCLBYTES)
@@ -4382,12 +4339,12 @@
 } /* ixgbe_config_delay_values */
 
 /************************************************************************
- * ixgbe_set_multi - Multicast Update
+ * ixgbe_set_rxfilter - Multicast Update
  *
  *   Called whenever multicast address list is updated.
  ************************************************************************/
 static void
-ixgbe_set_multi(struct adapter *adapter)
+ixgbe_set_rxfilter(struct adapter *adapter)
 {
        struct ixgbe_mc_addr    *mta;
        struct ifnet            *ifp = adapter->ifp;
@@ -4399,7 +4356,7 @@
        struct ether_multistep  step;
 
        KASSERT(mutex_owned(&adapter->core_mtx));
-       IOCTL_DEBUGOUT("ixgbe_set_multi: begin");
+       IOCTL_DEBUGOUT("ixgbe_set_rxfilter: begin");
 
        mta = adapter->mta;
        bzero(mta, sizeof(*mta) * MAX_NUM_MULTICAST_ADDRESSES);
@@ -4422,30 +4379,32 @@
        }
 
        fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
-       fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
        if (ifp->if_flags & IFF_PROMISC)
                fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
        else if (ec->ec_flags & ETHER_F_ALLMULTI) {
                fctrl |= IXGBE_FCTRL_MPE;
-       }
-       ETHER_UNLOCK(ec);
+               fctrl &= ~IXGBE_FCTRL_UPE;
+       } else
+               fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
 
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl);
 
-       if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) {
+       /* Update multicast filter entries only when it's not ALLMULTI */
+       if ((ec->ec_flags & ETHER_F_ALLMULTI) == 0) {
+               ETHER_UNLOCK(ec);
                update_ptr = (u8 *)mta;
                ixgbe_update_mc_addr_list(&adapter->hw, update_ptr, mcnt,
                    ixgbe_mc_array_itr, TRUE);
-       }
-
-} /* ixgbe_set_multi */
+       } else
+               ETHER_UNLOCK(ec);
+} /* ixgbe_set_rxfilter */
 
 /************************************************************************
  * ixgbe_mc_array_itr
  *
  *   An iterator function needed by the multicast shared code.
  *   It feeds the shared code routine the addresses in the
- *   array of ixgbe_set_multi() one by one.
+ *   array of ixgbe_set_rxfilter() one by one.
  ************************************************************************/
 static u8 *
 ixgbe_mc_array_itr(struct ixgbe_hw *hw, u8 **update_ptr, u32 *vmdq)
@@ -6203,7 +6162,8 @@
 {
        struct ifnet *ifp = &ec->ec_if;
        struct adapter *adapter = ifp->if_softc;
-       int change, rv = 0;
+       u_short change;
+       int rv = 0;
 
        IXGBE_CORE_LOCK(adapter);
 
@@ -6215,7 +6175,7 @@
                rv = ENETRESET;
                goto out;
        } else if ((change & IFF_PROMISC) != 0)
-               ixgbe_set_promisc(adapter);
+               ixgbe_set_rxfilter(adapter);
 
        /* Check for ec_capenable. */
        change = ec->ec_capenable ^ adapter->ec_capenable;
@@ -6373,7 +6333,7 @@
                         */
                        IXGBE_CORE_LOCK(adapter);
                        ixgbe_disable_intr(adapter);
-                       ixgbe_set_multi(adapter);
+                       ixgbe_set_rxfilter(adapter);
                        ixgbe_enable_intr(adapter);
                        IXGBE_CORE_UNLOCK(adapter);
                }
diff -r 57baf1ed2d61 -r b36f4662b60d sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Sep 26 19:04:00 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Thu Sep 26 19:07:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.56 2019/07/17 03:26:24 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.56.2.1 2019/09/26 19:07:22 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -436,8 +436,6 @@
        u64                     flm;
 };
 
-#define IXGBE_MAX_VF_MC 30  /* Max number of multicast entries */
-
 struct ixgbe_vf {
        u_int    pool;
        u_int    rar_index;
@@ -475,7 +473,7 @@
 
        struct ifmedia          media;
        callout_t               timer;
-       int                     if_flags;       /* saved ifp->if_flags */
+       u_short                 if_flags;       /* saved ifp->if_flags */
        int                     ec_capenable;   /* saved ec->ec_capenable */
 
        kmutex_t                core_mtx;
diff -r 57baf1ed2d61 -r b36f4662b60d sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h    Thu Sep 26 19:04:00 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h    Thu Sep 26 19:07:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.41 2019/07/24 06:07:58 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.41.2.1 2019/09/26 19:07:22 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -4311,6 +4311,9 @@
 #define IXGBE_ERR_FW_RESP_INVALID              -39
 #define IXGBE_ERR_TOKEN_RETRY                  -40
 
+#define IXGBE_ERR_NOT_TRUSTED                  -50 /* XXX NetBSD */
+#define IXGBE_ERR_NOT_IN_PROMISC               -51 /* XXX NetBSD */
+
 #define IXGBE_NOT_IMPLEMENTED                  0x7FFFFFFF
 
 
diff -r 57baf1ed2d61 -r b36f4662b60d sys/dev/pci/ixgbe/ixgbe_vf.c
--- a/sys/dev/pci/ixgbe/ixgbe_vf.c      Thu Sep 26 19:04:00 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.c      Thu Sep 26 19:07:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.18 2019/07/02 04:09:03 msaitoh Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.18.2.1 2019/09/26 19:07:22 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -409,7 +409,13 @@
 
        DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count);
 
-       cnt = (mc_addr_count > 30) ? 30 : mc_addr_count;
+       if (mc_addr_count > IXGBE_MAX_VF_MC) {
+               device_printf(ixgbe_dev_from_hw(hw),
+                   "number of Ethernet multicast addresses exceeded "
+                   "the limit (%u > %d)\n", mc_addr_count, IXGBE_MAX_VF_MC);
+               cnt = IXGBE_MAX_VF_MC;
+       } else
+               cnt = mc_addr_count;
        msgbuf[0] = IXGBE_VF_SET_MULTICAST;
        msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT;
 
@@ -454,8 +460,32 @@



Home | Main Index | Thread Index | Old Index