From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:04 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 32A2615D3BA; Mon, 21 Oct 2019 18:07:04 +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 46xl2v3Zk7z4YKk; Mon, 21 Oct 2019 18:07:03 +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 C4D2927B57; Mon, 21 Oct 2019 18:07:02 +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 x9LI727n065311; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI72dA065310; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI72dA065310@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:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353816 - head/sys/dev/hme X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/hme X-SVN-Commit-Revision: 353816 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:07:04 -0000 Author: glebius Date: Mon Oct 21 18:07:02 2019 New Revision: 353816 URL: https://svnweb.freebsd.org/changeset/base/353816 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/hme/if_hme.c Modified: head/sys/dev/hme/if_hme.c ============================================================================== --- head/sys/dev/hme/if_hme.c Mon Oct 21 18:06:57 2019 (r353815) +++ head/sys/dev/hme/if_hme.c Mon Oct 21 18:07:02 2019 (r353816) @@ -1656,6 +1656,20 @@ hme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +hme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ + crc >>= 26; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (crc & 0xf); + + return (1); +} + /* * Set up the logical address filter. */ @@ -1663,8 +1677,6 @@ static void hme_setladrf(struct hme_softc *sc, int reenable) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; - u_int32_t crc; u_int32_t hash[4]; u_int32_t macc; @@ -1721,21 +1733,7 @@ hme_setladrf(struct hme_softc *sc, int reenable) * selects the word, while the rest of the bits select the bit within * the word. */ - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 most significant bits. */ - crc >>= 26; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (crc & 0xf); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, hme_hash_maddr, &hash); chipit: /* Now load the hash table into the chip */