Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Use adapter->mta for the multicast array m...



details:   https://anonhg.NetBSD.org/src/rev/d29a9af98608
branches:  trunk
changeset: 1027641:d29a9af98608
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Dec 14 05:37:44 2021 +0000

description:
Use adapter->mta for the multicast array memory instead of the on-stack array.

  - Same as ixv-1.5.22.
  - Same as ixg(4).

diffstat:

 sys/dev/pci/ixgbe/ixv.c |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (90 lines):

diff -r b913cc142436 -r d29a9af98608 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Tue Dec 14 05:35:46 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Tue Dec 14 05:37:44 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.169 2021/09/30 04:02:27 yamaguchi Exp $ */
+/* $NetBSD: ixv.c,v 1.170 2021/12/14 05:37:44 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.169 2021/09/30 04:02:27 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.170 2021/12/14 05:37:44 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -550,6 +550,10 @@
                goto err_late;
        }
 
+       /* Allocate multicast array memory */
+       adapter->mta = malloc(sizeof(*adapter->mta) *
+           IXGBE_MAX_VF_MC, M_DEVBUF, M_WAITOK);
+
        /* Do the stats setup */
        ixv_save_stats(adapter);
        ixv_init_stats(adapter);
@@ -1102,7 +1106,7 @@
 static int
 ixv_set_rxfilter(struct adapter *adapter)
 {
-       u8      mta[IXGBE_MAX_VF_MC * IXGBE_ETH_LENGTH_OF_ADDRESS];
+       struct ixgbe_mc_addr    *mta;
        struct ifnet            *ifp = adapter->ifp;
        struct ixgbe_hw         *hw = &adapter->hw;
        u8                      *update_ptr;
@@ -1116,6 +1120,9 @@
        KASSERT(mutex_owned(&adapter->core_mtx));
        IOCTL_DEBUGOUT("ixv_set_rxfilter: begin");
 
+       mta = adapter->mta;
+       bzero(mta, sizeof(*mta) * IXGBE_MAX_VF_MC);
+
        /* 1: For PROMISC */
        if (ifp->if_flags & IFF_PROMISC) {
                error = hw->mac.ops.update_xcast_mode(hw,
@@ -1153,8 +1160,7 @@
                        break;
                }
                bcopy(enm->enm_addrlo,
-                   &mta[mcnt * IXGBE_ETH_LENGTH_OF_ADDRESS],
-                   IXGBE_ETH_LENGTH_OF_ADDRESS);
+                   mta[mcnt].addr, IXGBE_ETH_LENGTH_OF_ADDRESS);
                mcnt++;
                ETHER_NEXT_MULTI(step, enm);
        }
@@ -1205,8 +1211,7 @@
                    "operation to normal. error = %d\n", error);
        }
 
-       update_ptr = mta;
-
+       update_ptr = (u8 *)mta;
        error = adapter->hw.mac.ops.update_mc_addr_list(&adapter->hw,
            update_ptr, mcnt, ixv_mc_array_itr, TRUE);
        if (rc == 0)
@@ -1225,15 +1230,14 @@
 static u8 *
 ixv_mc_array_itr(struct ixgbe_hw *hw, u8 **update_ptr, u32 *vmdq)
 {
-       u8 *addr = *update_ptr;
-       u8 *newptr;
+       struct ixgbe_mc_addr *mta;
+
+       mta = (struct ixgbe_mc_addr *)*update_ptr;
 
        *vmdq = 0;
-
-       newptr = addr + IXGBE_ETH_LENGTH_OF_ADDRESS;
-       *update_ptr = newptr;
-
-       return addr;
+       *update_ptr = (u8*)(mta + 1);
+
+       return (mta->addr);
 } /* ixv_mc_array_itr */
 
 /************************************************************************



Home | Main Index | Thread Index | Old Index