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 Protect ec_multi* with mutex like other MP...



details:   https://anonhg.NetBSD.org/src/rev/5a9c6afb7258
branches:  trunk
changeset: 827172:5a9c6afb7258
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 18 10:43:32 2017 +0000

description:
Protect ec_multi* with mutex like other MP safe Ethernet drivers.
See if_ether.h rev. 1.66 and related stuff:
http://mail-index.netbsd.org/source-changes/2016/12/28/msg080289.html

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  8 +++++++-
 sys/dev/pci/ixgbe/ixv.c   |  5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (82 lines):

diff -r 55490a39c52d -r 5a9c6afb7258 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 18 08:54:59 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 18 10:43:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.104 2017/10/13 04:52:40 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.105 2017/10/18 10:43:32 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -2726,11 +2726,13 @@
        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)
@@ -2738,6 +2740,7 @@
                        mcnt++;
                        ETHER_NEXT_MULTI(step, enm);
                }
+               ETHER_UNLOCK(ec);
        }
        if (mcnt < MAX_NUM_MULTICAST_ADDRESSES)
                rctl &= (~IXGBE_FCTRL_MPE);
@@ -3906,12 +3909,14 @@
        struct ether_multi      *enm;
        struct ether_multistep  step;
 
+       KASSERT(mutex_owned(&adapter->core_mtx));
        IOCTL_DEBUGOUT("ixgbe_set_multi: begin");
 
        mta = adapter->mta;
        bzero(mta, sizeof(*mta) * MAX_NUM_MULTICAST_ADDRESSES);
 
        ifp->if_flags &= ~IFF_ALLMULTI;
+       ETHER_LOCK(ec);
        ETHER_FIRST_MULTI(step, ec, enm);
        while (enm != NULL) {
                if ((mcnt == MAX_NUM_MULTICAST_ADDRESSES) ||
@@ -3926,6 +3931,7 @@
                mcnt++;
                ETHER_NEXT_MULTI(step, enm);
        }
+       ETHER_UNLOCK(ec);
 
        fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
        fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
diff -r 55490a39c52d -r 5a9c6afb7258 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Wed Oct 18 08:54:59 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Wed Oct 18 10:43:32 2017 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.71 2017/10/13 08:17:44 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.72 2017/10/18 10:43:32 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -1048,8 +1048,10 @@
        u8                 *update_ptr;
        int                mcnt = 0;
 
+       KASSERT(mutex_owned(&adapter->core_mtx));
        IOCTL_DEBUGOUT("ixv_set_multi: begin");
 
+       ETHER_LOCK(ec);
        ETHER_FIRST_MULTI(step, ec, enm);
        while (enm != NULL) {
                bcopy(enm->enm_addrlo,
@@ -1061,6 +1063,7 @@
                        break;
                ETHER_NEXT_MULTI(step, enm);
        }
+       ETHER_UNLOCK(ec);
 
        update_ptr = mta;
 



Home | Main Index | Thread Index | Old Index