svn commit: r353852 - head/sys/dev/oce

Gleb Smirnoff glebius at FreeBSD.org
Mon Oct 21 18:12:05 UTC 2019


Author: glebius
Date: Mon Oct 21 18:12:02 2019
New Revision: 353852
URL: https://svnweb.freebsd.org/changeset/base/353852

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/oce/oce_hw.c

Modified: head/sys/dev/oce/oce_hw.c
==============================================================================
--- head/sys/dev/oce/oce_hw.c	Mon Oct 21 18:11:58 2019	(r353851)
+++ head/sys/dev/oce/oce_hw.c	Mon Oct 21 18:12:02 2019	(r353852)
@@ -544,7 +544,21 @@ oce_hw_intr_disable(POCE_SOFTC sc)
 }
 
 
+static u_int
+oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+	struct mbx_set_common_iface_multicast *req = arg;
 
+	if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE)
+		return (0);
+
+	bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++],
+	    ETH_ADDR_LEN);
+
+	return (1);
+}
+
+
 /**
  * @brief		Function for hardware update multicast filter
  * @param sc		software handle to the device
@@ -553,7 +567,6 @@ int
 oce_hw_update_multicast(POCE_SOFTC sc)
 {
 	struct ifnet    *ifp = sc->ifp;
-	struct ifmultiaddr *ifma;
 	struct mbx_set_common_iface_multicast *req = NULL;
 	OCE_DMA_MEM dma;
 	int rc = 0;
@@ -566,29 +579,15 @@ oce_hw_update_multicast(POCE_SOFTC sc)
 	req = OCE_DMAPTR(&dma, struct mbx_set_common_iface_multicast);
 	bzero(req, sizeof(struct mbx_set_common_iface_multicast));
 
-#if __FreeBSD_version > 800000
-	if_maddr_rlock(ifp);
-#endif
-	CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-
-		if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) {
-			/*More multicast addresses than our hardware table
-			  So Enable multicast promiscus in our hardware to
-			  accept all multicat packets
-			*/
-			req->params.req.promiscuous = 1;
-			break;
-		}
-		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
-			&req->params.req.mac[req->params.req.num_mac],
-			ETH_ADDR_LEN);
-		req->params.req.num_mac = req->params.req.num_mac + 1;
+	if_foreach_llmaddr(ifp, oce_copy_maddr, req);
+	if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) {
+		/*More multicast addresses than our hardware table
+		  So Enable multicast promiscus in our hardware to
+		  accept all multicat packets
+		*/
+		req->params.req.promiscuous = 1;
 	}
-#if __FreeBSD_version > 800000
-	if_maddr_runlock(ifp);
-#endif
+
 	req->params.req.if_id = sc->if_id;
 	rc = oce_update_multicast(sc, &dma);
 	oce_dma_free(sc, &dma);


More information about the svn-src-all mailing list