Module Name: src Committed By: msaitoh Date: Wed Oct 18 10:43:32 UTC 2017
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixv.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.104 src/sys/dev/pci/ixgbe/ixgbe.c:1.105 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.104 Fri Oct 13 04:52:40 2017 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 18 10:43:32 2017 @@ -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 @@ ixgbe_set_promisc(struct adapter *adapte 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 @@ ixgbe_set_promisc(struct adapter *adapte mcnt++; ETHER_NEXT_MULTI(step, enm); } + ETHER_UNLOCK(ec); } if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) rctl &= (~IXGBE_FCTRL_MPE); @@ -3906,12 +3909,14 @@ ixgbe_set_multi(struct adapter *adapter) 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 @@ ixgbe_set_multi(struct adapter *adapter) mcnt++; ETHER_NEXT_MULTI(step, enm); } + ETHER_UNLOCK(ec); fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.71 src/sys/dev/pci/ixgbe/ixv.c:1.72 --- src/sys/dev/pci/ixgbe/ixv.c:1.71 Fri Oct 13 08:17:44 2017 +++ src/sys/dev/pci/ixgbe/ixv.c Wed Oct 18 10:43:32 2017 @@ -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 @@ ixv_set_multi(struct adapter *adapter) 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 @@ ixv_set_multi(struct adapter *adapter) break; ETHER_NEXT_MULTI(step, enm); } + ETHER_UNLOCK(ec); update_ptr = mta;