Author: glebius
Date: Mon Oct 14 20:31:43 2019
New Revision: 353515
URL: https://svnweb.freebsd.org/changeset/base/353515

Log:
  Convert to if_foreach_llmaddr() KPI.
  
  Reviewed by:  hselasky

Modified:
  head/sys/dev/usb/net/if_cue.c

Modified: head/sys/dev/usb/net/if_cue.c
==============================================================================
--- head/sys/dev/usb/net/if_cue.c       Mon Oct 14 20:31:28 2019        
(r353514)
+++ head/sys/dev/usb/net/if_cue.c       Mon Oct 14 20:31:43 2019        
(r353515)
@@ -307,13 +307,24 @@ cue_setpromisc(struct usb_ether *ue)
        cue_setmulti(ue);
 }
 
+static u_int
+cue_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+       uint8_t *hashtbl = arg;
+       uint32_t h;
+
+       h = cue_mchash(LLADDR(sdl));
+       hashtbl[h >> 3] |= 1 << (h & 0x7);
+
+       return (1);
+}
+
 static void
 cue_setmulti(struct usb_ether *ue)
 {
        struct cue_softc *sc = uether_getsc(ue);
        struct ifnet *ifp = uether_getifp(ue);
-       struct ifmultiaddr *ifma;
-       uint32_t h = 0, i;
+       uint32_t h, i;
        uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
        CUE_LOCK_ASSERT(sc, MA_OWNED);
@@ -327,15 +338,7 @@ cue_setmulti(struct usb_ether *ue)
        }
 
        /* now program new ones */
-       if_maddr_rlock(ifp);
-       CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
-       {
-               if (ifma->ifma_addr->sa_family != AF_LINK)
-                       continue;
-               h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
-               hashtbl[h >> 3] |= 1 << (h & 0x7);
-       }
-       if_maddr_runlock(ifp);
+       if_foreach_llmaddr(ifp, cue_hash_maddr, hashtbl);
 
        /*
         * Also include the broadcast address in the filter
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to