From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:34 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 2A26715E12E; Mon, 21 Oct 2019 18:11:34 +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 46xl856Gk0z4d9L; Mon, 21 Oct 2019 18:11:33 +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 5B0E127BD6; Mon, 21 Oct 2019 18:11:33 +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 x9LIBXAl068361; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBXrV068360; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBXrV068360@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:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353846 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 353846 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:11:34 -0000 Author: glebius Date: Mon Oct 21 18:11:32 2019 New Revision: 353846 URL: https://svnweb.freebsd.org/changeset/base/353846 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:28 2019 (r353845) +++ head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:32 2019 (r353846) @@ -974,13 +974,24 @@ ffec_get_hwaddr(struct ffec_softc *sc, uint8_t *hwaddr } } +static u_int +ffec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *ghash = arg; + uint32_t crc; + + /* 6 bits from MSB in LE CRC32 are used for hash. */ + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + *ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); + + return (1); +} + static void ffec_setup_rxfilter(struct ffec_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; uint8_t *eaddr; - uint32_t crc; uint64_t ghash, ihash; FFEC_ASSERT_LOCKED(sc); @@ -994,16 +1005,7 @@ ffec_setup_rxfilter(struct ffec_softc *sc) ghash = 0xffffffffffffffffLLU; else { ghash = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* 6 bits from MSB in LE CRC32 are used for hash. */ - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ffec_hash_maddr, &ghash); } WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32)); WR4(sc, FEC_GALR_REG, (uint32_t)ghash);