From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:13 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 472D315E2A4; Mon, 21 Oct 2019 18:12:13 +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 46xl8r5YFpz4f6b; Mon, 21 Oct 2019 18:12:12 +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 7F56B27D10; Mon, 21 Oct 2019 18:12:12 +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 x9LICCRT072516; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICC5d072515; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICC5d072515@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:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353854 - head/sys/dev/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlnx/qlnxe X-SVN-Commit-Revision: 353854 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:13 -0000 Author: glebius Date: Mon Oct 21 18:12:12 2019 New Revision: 353854 URL: https://svnweb.freebsd.org/changeset/base/353854 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:07 2019 (r353853) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:12 2019 (r353854) @@ -2644,42 +2644,36 @@ qlnx_hw_set_multi(qlnx_host_t *ha, uint8_t *mta, uint3 } -#define QLNX_MCAST_ADDRS_SIZE (QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN) -static int -qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +static u_int +qlnx_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) { - uint8_t mta[QLNX_MCAST_ADDRS_SIZE]; - struct ifmultiaddr *ifma; - int mcnt = 0; - struct ifnet *ifp = ha->ifp; - int ret = 0; + uint8_t *mta = arg; - if (qlnx_vf_device(ha) == 0) + if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) return (0); - if_maddr_rlock(ifp); + bcopy(LLADDR(sdl), &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + return (1); +} - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; +static int +qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +{ + uint8_t mta[QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN]; + struct ifnet *ifp = ha->ifp; + u_int mcnt; - if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) - break; + if (qlnx_vf_device(ha) == 0) + return (0); - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); + mcnt = if_foreach_llmaddr(ifp, qlnx_copy_maddr, mta); - mcnt++; - } - - if_maddr_runlock(ifp); - QLNX_LOCK(ha); qlnx_hw_set_multi(ha, mta, mcnt, add_multi); QLNX_UNLOCK(ha); - return (ret); + return (0); } static int