aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/liquidio
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-10-21 18:11:48 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-10-21 18:11:48 +0000
commit660d39418feaadcbb0d7af4e88f6a7beb1f52e9c (patch)
treeacbd10e2597beb6a18702dcdbf7d8882000db02e /sys/dev/liquidio
parent119a6396cabb359a027ca208b08471cdf153fcf0 (diff)
Notes
Diffstat (limited to 'sys/dev/liquidio')
-rw-r--r--sys/dev/liquidio/lio_ioctl.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/sys/dev/liquidio/lio_ioctl.c b/sys/dev/liquidio/lio_ioctl.c
index b983ae01c053e..f2cf0eae6f81b 100644
--- a/sys/dev/liquidio/lio_ioctl.c
+++ b/sys/dev/liquidio/lio_ioctl.c
@@ -491,6 +491,22 @@ lio_get_new_flags(struct ifnet *ifp)
return (f);
}
+static u_int
+lio_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+ uint64_t *mc = arg;
+
+ if (cnt == LIO_MAX_MULTICAST_ADDR)
+ return (0);
+
+ mc += cnt;
+ *mc = 0;
+ memcpy(((uint8_t *)mc) + 2, LLADDR(sdl), ETHER_ADDR_LEN);
+ /* no need to swap bytes */
+
+ return (1);
+}
+
/* @param ifp network device */
static int
lio_set_mcast_list(struct ifnet *ifp)
@@ -498,9 +514,7 @@ lio_set_mcast_list(struct ifnet *ifp)
struct lio *lio = if_getsoftc(ifp);
struct octeon_device *oct = lio->oct_dev;
struct lio_ctrl_pkt nctrl;
- struct ifmultiaddr *ifma;
- uint64_t *mc;
- int mc_count = 0;
+ int mc_count;
int ret;
bzero(&nctrl, sizeof(struct lio_ctrl_pkt));
@@ -514,26 +528,7 @@ lio_set_mcast_list(struct ifnet *ifp)
nctrl.cb_fn = lio_ctrl_cmd_completion;
/* copy all the addresses into the udd */
- mc = &nctrl.udd[0];
-
- /* to protect access to if_multiaddrs */
- if_maddr_rlock(ifp);
-
- CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- *mc = 0;
- memcpy(((uint8_t *)mc) + 2,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- ETHER_ADDR_LEN);
- /* no need to swap bytes */
-
- mc_count++;
- if (++mc > &nctrl.udd[LIO_MAX_MULTICAST_ADDR])
- break;
- }
-
- if_maddr_runlock(ifp);
+ mc_count = if_foreach_llmaddr(ifp, lio_copy_maddr, &nctrl.udd[0]);
/*
* Apparently, any activity in this call from the kernel has to