Author: glebius
Date: Mon Oct 21 18:10:46 2019
New Revision: 353836
URL: https://svnweb.freebsd.org/changeset/base/353836

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/altera/atse/if_atse.c

Modified: head/sys/dev/altera/atse/if_atse.c
==============================================================================
--- head/sys/dev/altera/atse/if_atse.c  Mon Oct 21 18:08:57 2019        
(r353835)
+++ head/sys/dev/altera/atse/if_atse.c  Mon Oct 21 18:10:46 2019        
(r353836)
@@ -427,12 +427,14 @@ atse_stop_locked(struct atse_softc *sc)
        return (0);
 }
 
-static uint8_t
-atse_mchash(struct atse_softc *sc __unused, const uint8_t *addr)
+static u_int
+atse_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
 {
-       uint8_t x, y;
+       uint64_t *h = arg;
+       uint8_t *addr, x, y;
        int i, j;
 
+       addr = LLADDR(sdl);
        x = 0;
        for (i = 0; i < ETHER_ADDR_LEN; i++) {
                y = addr[i] & 0x01;
@@ -440,14 +442,14 @@ atse_mchash(struct atse_softc *sc __unused, const uint
                        y ^= (addr[i] >> j) & 0x01;
                x |= (y << i);
        }
+       *h |= (1 << x);
 
-       return (x);
+       return (1);
 }
 
 static int
 atse_rxfilter_locked(struct atse_softc *sc)
 {
-       struct ifmultiaddr *ifma;
        struct ifnet *ifp;
        uint32_t val4;
        int i;
@@ -478,22 +480,13 @@ atse_rxfilter_locked(struct atse_softc *sc)
                 */
                uint64_t h;
 
-               h = 0;
                /*
                 * Re-build and re-program hash table.  First build the
                 * bit-field "yes" or "no" for each slot per address, then
                 * do all the programming afterwards.
                 */
-               if_maddr_rlock(ifp);
-               CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-                       if (ifma->ifma_addr->sa_family != AF_LINK) {
-                               continue;
-                       }
-
-                       h |= (1 << atse_mchash(sc,
-                           LLADDR((struct sockaddr_dl *)ifma->ifma_addr)));
-               }
-               if_maddr_runlock(ifp);
+               h = 0;
+               (void)if_foreach_llmaddr(ifp, atse_hash_maddr, &h);
                for (i = 0; i <= MHASH_LEN; i++) {
                        CSR_WRITE_4(sc, MHASH_START + i,
                            (h & (1 << i)) ? 0x01 : 0x00);
_______________________________________________
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