From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB35515E4A2; Mon, 21 Oct 2019 18:13:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlB84MgFz4gLL; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F44B27D3B; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDJtU072989; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDJ0F072988; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDJ0F072988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353863 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:21 -0000 Author: glebius Date: Mon Oct 21 18:13:19 2019 New Revision: 353863 URL: https://svnweb.freebsd.org/changeset/base/353863 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/allwinner/if_emac.c Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:14 2019 (r353862) +++ head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:19 2019 (r353863) @@ -218,12 +218,22 @@ emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr printf("MAC address: %s\n", ether_sprintf(hwaddr)); } +static u_int +emac_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; + hashes[h >> 5] |= 1 << (h & 0x1f); + + return (1); +} + static void emac_set_rx_mode(struct emac_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, hashes[2]; + uint32_t hashes[2]; uint32_t rcr = 0; EMAC_ASSERT_LOCKED(sc); @@ -241,17 +251,8 @@ emac_set_rx_mode(struct emac_softc *sc) if (ifp->if_flags & IFF_ALLMULTI) { hashes[0] = 0xffffffff; hashes[1] = 0xffffffff; - } else { - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->emac_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; - hashes[h >> 5] |= 1 << (h & 0x1f); - } - if_maddr_runlock(ifp); - } + } else + if_foreach_llmaddr(ifp, emac_hash_maddr, hashes); rcr |= EMAC_RX_MCO; rcr |= EMAC_RX_MHF; EMAC_WRITE_REG(sc, EMAC_RX_HASH0, hashes[0]);