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



details:   https://anonhg.NetBSD.org/src/rev/57a12e30d695
branches:  netbsd-8
changeset: 454743:57a12e30d695
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 26 18:19:26 2019 +0000

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

        sys/dev/pci/ixgbe/ixgbe_type.h                  1.42-1.43
        sys/dev/pci/ixgbe/ixgbe.c                       1.209-1.213 via patch
        sys/dev/pci/ixgbe/ixv.c                         1.131-1.138 via patch
        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 via patch
        share/man/man4/ixv.4                            1.5 via patch

- 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.
- 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.

diffstat:

 share/man/man4/ixv.4           |   21 ++-
 sys/dev/pci/ixgbe/ixgbe.c      |   80 ++---------
 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/ixv.c        |  275 ++++++++++++++++++++++++++++++++++++----
 7 files changed, 328 insertions(+), 101 deletions(-)

diffs (truncated from 751 to 300 lines):

diff -r 023b637d276a -r 57a12e30d695 share/man/man4/ixv.4
--- a/share/man/man4/ixv.4      Thu Sep 26 18:14:54 2019 +0000
+++ b/share/man/man4/ixv.4      Thu Sep 26 18:19:26 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ixv.4,v 1.3.2.2 2018/05/12 10:35:45 martin Exp $
+.\"    $NetBSD: ixv.4,v 1.3.2.3 2019/09/26 18:19:27 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 May 9, 2018
+.Dd September 5, 2019
 .Dt IXV 4
 .Os
 .Sh NAME
@@ -60,6 +60,23 @@
 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
+.Sh BUGS
 VLAN over
 .Nm
 won't work because VLAN hardware filter function is not currently implemented
diff -r 023b637d276a -r 57a12e30d695 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 26 18:14:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 26 18:19:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.34 2019/09/06 13:44:36 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.35 2019/09/26 18:19:26 martin Exp $ */
 
 /******************************************************************************
 
@@ -209,8 +209,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 *);
@@ -1579,7 +1578,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 */
@@ -2134,7 +2133,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;
@@ -3003,49 +3003,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);
-       if (ifp->if_flags & IFF_ALLMULTI)
-               mcnt = MAX_NUM_MULTICAST_ADDRESSES;
-       else {
-               ETHER_LOCK(ec);
-               ETHER_FIRST_MULTI(step, ec, enm);
-               while (enm != NULL) {
-                       if (mcnt == MAX_NUM_MULTICAST_ADDRESSES)
-                               break;
-                       mcnt++;
-                       ETHER_NEXT_MULTI(step, enm);
-               }
-               ETHER_UNLOCK(ec);
-       }
-       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 (ifp->if_flags & IFF_ALLMULTI) {
-               rctl |= IXGBE_FCTRL_MPE;
-               rctl &= ~IXGBE_FCTRL_UPE;
-               IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
-       }
-} /* ixgbe_set_promisc */
-
-/************************************************************************
  * ixgbe_msix_link - Link status change ISR (MSI/MSI-X)
  ************************************************************************/
 static int
@@ -3955,7 +3912,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)
@@ -4343,12 +4300,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;
@@ -4360,7 +4317,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);
@@ -4384,29 +4341,29 @@
        ETHER_UNLOCK(ec);
 
        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 (ifp->if_flags & IFF_ALLMULTI) {
                fctrl |= IXGBE_FCTRL_MPE;
-       }
+               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) {
+       if (mcnt <= MAX_NUM_MULTICAST_ADDRESSES) {
                update_ptr = (u8 *)mta;
                ixgbe_update_mc_addr_list(&adapter->hw, update_ptr, mcnt,
                    ixgbe_mc_array_itr, TRUE);
        }
-
-} /* ixgbe_set_multi */
+} /* ixgbe_set_filter */
 
 /************************************************************************
  * 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)
@@ -6164,7 +6121,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);
 
@@ -6176,7 +6134,7 @@
                rv = ENETRESET;
                goto out;
        } else if ((change & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
-               ixgbe_set_promisc(adapter);
+               ixgbe_set_rxfilter(adapter);
 
        /* Set up VLAN support and filter */
        ixgbe_setup_vlan_hw_support(adapter);
@@ -6322,7 +6280,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 023b637d276a -r 57a12e30d695 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Sep 26 18:14:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Thu Sep 26 18:19:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.17 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.18 2019/09/26 18:19:26 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;
+       u_short                 if_flags;       /* saved ifp->if_flags */
 
        kmutex_t                core_mtx;
 
diff -r 023b637d276a -r 57a12e30d695 sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h    Thu Sep 26 18:14:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h    Thu Sep 26 18:19:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.22.2.10 2019/08/01 14:14:30 martin Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.22.2.11 2019/09/26 18:19:26 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 023b637d276a -r 57a12e30d695 sys/dev/pci/ixgbe/ixgbe_vf.c
--- a/sys/dev/pci/ixgbe/ixgbe_vf.c      Thu Sep 26 18:14:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.c      Thu Sep 26 18:19:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.12.8.3 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.12.8.4 2019/09/26 18:19:26 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 @@
                return err;
 



Home | Main Index | Thread Index | Old Index