From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:49 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 A43DE15E1C7; Mon, 21 Oct 2019 18:11:49 +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 46xl8P3C6lz4dY0; Mon, 21 Oct 2019 18:11:49 +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 404B527BEA; Mon, 21 Oct 2019 18:11:49 +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 x9LIBnJ4070756; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBn28070755; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBn28070755@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:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353849 - head/sys/dev/liquidio X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/liquidio X-SVN-Commit-Revision: 353849 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:49 -0000 Author: glebius Date: Mon Oct 21 18:11:48 2019 New Revision: 353849 URL: https://svnweb.freebsd.org/changeset/base/353849 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/liquidio/lio_ioctl.c Modified: head/sys/dev/liquidio/lio_ioctl.c ============================================================================== --- head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:43 2019 (r353848) +++ head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:48 2019 (r353849) @@ -491,6 +491,22 @@ lio_get_new_flags(struct ifnet *ifp) return (f); } +static u_int +lio_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *mc = arg; + + if (cnt == LIO_MAX_MULTICAST_ADDR) + return (0); + + mc += cnt; + *mc = 0; + memcpy(((uint8_t *)mc) + 2, LLADDR(sdl), ETHER_ADDR_LEN); + /* no need to swap bytes */ + + return (1); +} + /* @param ifp network device */ static int lio_set_mcast_list(struct ifnet *ifp) @@ -498,9 +514,7 @@ lio_set_mcast_list(struct ifnet *ifp) struct lio *lio = if_getsoftc(ifp); struct octeon_device *oct = lio->oct_dev; struct lio_ctrl_pkt nctrl; - struct ifmultiaddr *ifma; - uint64_t *mc; - int mc_count = 0; + int mc_count; int ret; bzero(&nctrl, sizeof(struct lio_ctrl_pkt)); @@ -514,26 +528,7 @@ lio_set_mcast_list(struct ifnet *ifp) nctrl.cb_fn = lio_ctrl_cmd_completion; /* copy all the addresses into the udd */ - mc = &nctrl.udd[0]; - - /* to protect access to if_multiaddrs */ - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - *mc = 0; - memcpy(((uint8_t *)mc) + 2, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - ETHER_ADDR_LEN); - /* no need to swap bytes */ - - mc_count++; - if (++mc > &nctrl.udd[LIO_MAX_MULTICAST_ADDR]) - break; - } - - if_maddr_runlock(ifp); + mc_count = if_foreach_llmaddr(ifp, lio_copy_maddr, &nctrl.udd[0]); /* * Apparently, any activity in this call from the kernel has to