From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:05 2019 Return-Path: Delivered-To: svn-src-all@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 025C215E256; Mon, 21 Oct 2019 18:12:05 +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 46xl8h4FHFz4dvK; Mon, 21 Oct 2019 18:12:04 +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 6DDFE27D03; Mon, 21 Oct 2019 18:12:03 +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 x9LIC37o072419; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIC3XM072418; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LIC3XM072418@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:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353852 - head/sys/dev/oce X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/oce X-SVN-Commit-Revision: 353852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:05 -0000 Author: glebius Date: Mon Oct 21 18:12:02 2019 New Revision: 353852 URL: https://svnweb.freebsd.org/changeset/base/353852 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/oce/oce_hw.c Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Mon Oct 21 18:11:58 2019 (r353851) +++ head/sys/dev/oce/oce_hw.c Mon Oct 21 18:12:02 2019 (r353852) @@ -544,7 +544,21 @@ oce_hw_intr_disable(POCE_SOFTC sc) } +static u_int +oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mbx_set_common_iface_multicast *req = arg; + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) + return (0); + + bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++], + ETH_ADDR_LEN); + + return (1); +} + + /** * @brief Function for hardware update multicast filter * @param sc software handle to the device @@ -553,7 +567,6 @@ int oce_hw_update_multicast(POCE_SOFTC sc) { struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *ifma; struct mbx_set_common_iface_multicast *req = NULL; OCE_DMA_MEM dma; int rc = 0; @@ -566,29 +579,15 @@ oce_hw_update_multicast(POCE_SOFTC sc) req = OCE_DMAPTR(&dma, struct mbx_set_common_iface_multicast); bzero(req, sizeof(struct mbx_set_common_iface_multicast)); -#if __FreeBSD_version > 800000 - if_maddr_rlock(ifp); -#endif - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { - /*More multicast addresses than our hardware table - So Enable multicast promiscus in our hardware to - accept all multicat packets - */ - req->params.req.promiscuous = 1; - break; - } - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &req->params.req.mac[req->params.req.num_mac], - ETH_ADDR_LEN); - req->params.req.num_mac = req->params.req.num_mac + 1; + if_foreach_llmaddr(ifp, oce_copy_maddr, req); + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { + /*More multicast addresses than our hardware table + So Enable multicast promiscus in our hardware to + accept all multicat packets + */ + req->params.req.promiscuous = 1; } -#if __FreeBSD_version > 800000 - if_maddr_runlock(ifp); -#endif + req->params.req.if_id = sc->if_id; rc = oce_update_multicast(sc, &dma); oce_dma_free(sc, &dma);