Author: glebius
Date: Mon Oct 21 18:07:32 2019
New Revision: 353823
URL: https://svnweb.freebsd.org/changeset/base/353823

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c     Mon Oct 21 18:07:28 2019        (r353822)
+++ head/sys/dev/re/if_re.c     Mon Oct 21 18:07:32 2019        (r353823)
@@ -649,6 +649,20 @@ re_miibus_statchg(device_t dev)
         */
 }
 
+static u_int
+re_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+       uint32_t h, *hashes = arg;
+
+       h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26;
+       if (h < 32)
+               hashes[0] |= (1 << h);
+       else
+               hashes[1] |= (1 << (h - 32));
+
+       return (1);
+}
+
 /*
  * Set the RX configuration and 64-bit multicast hash filter.
  */
@@ -656,9 +670,8 @@ static void
 re_set_rxmode(struct rl_softc *sc)
 {
        struct ifnet            *ifp;
-       struct ifmultiaddr      *ifma;
-       uint32_t                hashes[2] = { 0, 0 };
-       uint32_t                h, rxfilt;
+       uint32_t                h, hashes[2] = { 0, 0 };
+       uint32_t                rxfilt;
 
        RL_LOCK_ASSERT(sc);
 
@@ -683,18 +696,7 @@ re_set_rxmode(struct rl_softc *sc)
                goto done;
        }
 
-       if_maddr_rlock(ifp);
-       CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-               if (ifma->ifma_addr->sa_family != AF_LINK)
-                       continue;
-               h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-                   ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
-               if (h < 32)
-                       hashes[0] |= (1 << h);
-               else
-                       hashes[1] |= (1 << (h - 32));
-       }
-       if_maddr_runlock(ifp);
+       if_foreach_llmaddr(ifp, re_hash_maddr, hashes);
 
        if (hashes[0] != 0 || hashes[1] != 0) {
                /*
_______________________________________________
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