Author: glebius
Date: Mon Oct 21 17:59:53 2019
New Revision: 353804
URL: https://svnweb.freebsd.org/changeset/base/353804

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==============================================================================
--- head/sys/dev/ae/if_ae.c     Mon Oct 21 17:59:16 2019        (r353803)
+++ head/sys/dev/ae/if_ae.c     Mon Oct 21 17:59:53 2019        (r353804)
@@ -2031,12 +2031,21 @@ ae_rxvlan(ae_softc_t *sc)
        AE_WRITE_4(sc, AE_MAC_REG, val);
 }
 
+static u_int
+ae_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+       uint32_t crc, *mchash = arg;
+
+       crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN);
+       mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+
+       return (1);
+}
+
 static void
 ae_rxfilter(ae_softc_t *sc)
 {
        struct ifnet *ifp;
-       struct ifmultiaddr *ifma;
-       uint32_t crc;
        uint32_t mchash[2];
        uint32_t rxcfg;
 
@@ -2072,15 +2081,7 @@ ae_rxfilter(ae_softc_t *sc)
         * Load multicast tables.
         */
        bzero(mchash, sizeof(mchash));
-       if_maddr_rlock(ifp);
-       CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-               if (ifma->ifma_addr->sa_family != AF_LINK)
-                       continue;
-               crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-                       ifma->ifma_addr), ETHER_ADDR_LEN);
-               mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-       }
-       if_maddr_runlock(ifp);
+       if_foreach_llmaddr(ifp, ae_hash_maddr, &mchash);
        AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]);
        AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]);
        AE_WRITE_4(sc, AE_MAC_REG, rxcfg);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to