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

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

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

Modified: head/sys/dev/usb/net/if_axge.c
==============================================================================
--- head/sys/dev/usb/net/if_axge.c      Mon Oct 14 20:31:43 2019        
(r353515)
+++ head/sys/dev/usb/net/if_axge.c      Mon Oct 14 20:31:57 2019        
(r353516)
@@ -756,19 +756,28 @@ axge_tick(struct usb_ether *ue)
        mii_tick(mii);
 }
 
+static u_int
+axge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+       uint8_t *hashtbl = arg;
+       uint32_t h;
+
+       h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26;
+       hashtbl[h / 8] |= 1 << (h % 8);
+
+       return (1);
+}
+
 static void
 axge_rxfilter(struct usb_ether *ue)
 {
        struct axge_softc *sc;
        struct ifnet *ifp;
-       struct ifmultiaddr *ifma;
-       uint32_t h;
        uint16_t rxmode;
        uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
        sc = uether_getsc(ue);
        ifp = uether_getifp(ue);
-       h = 0;
        AXGE_LOCK_ASSERT(sc, MA_OWNED);
 
        /*
@@ -791,15 +800,7 @@ axge_rxfilter(struct usb_ether *ue)
        }
 
        rxmode |= RCR_ACPT_MCAST;
-       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;
-               hashtbl[h / 8] |= 1 << (h % 8);
-       }
-       if_maddr_runlock(ifp);
+       if_foreach_llmaddr(ifp, axge_hash_maddr, &hashtbl);
 
        axge_write_mem(sc, AXGE_ACCESS_MAC, 8, AXGE_MFA, (void *)&hashtbl, 8);
        axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_RCR, rxmode);
_______________________________________________
[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