From nobody Tue May 28 05:58:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VpMJj03Cgz5Lj2b; Tue, 28 May 2024 05:58:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VpMJh6QPKz4rfM; Tue, 28 May 2024 05:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716875924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WyY1nMt/1lBam0AFEU70DKLv9uX5jWklKkFvdlJvVUU=; b=UgPLoJFrJHzeYxYXH/TevIZEFnl3XFwsDq73Bu+LPwBKoyKF0zmd+GyjqIMhtygg1+RQIG cTLMDVDrbS+x2HmayERUEZ5XAxzmBkq5jLhP+ax/Lu3mCtBcxq7M0MDvHssJBCH8zHtgH6 wSha9LD8S4y2IMDtHUiO3Ogh6VpEzh54RlbQr1KJpPIGCxxYHZV7CSugcZHEJStJgiVTPn d2i5nwMAAKrhyFhnJDhQ+GZcEc5XuEC0LsjeufdTmrhHKupqydVY9wMl/eMkOsVj85JwlO azhy5jWhGlNBMgr41+mXQdBkGqaURFlMEHHmF7DHP1HlQAGqFEjPshxgG/GQuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716875924; a=rsa-sha256; cv=none; b=t5y5rg8A8GsVFa4vMKgu5nraB7DicYOfP4AE5MLpRV45nKOdEQCZ8NuhTNAvBMtZRB7VoJ 5gW0H+RlUIUkJGtNKknF0Zky1ajr0iEyoSeLOw+o746CeSMnBj/mLXSpDWjzDlH+Tg6rJT Jj9Ifx2UxT/BkqAki09apQrPOCogqlf8pmwZKsWUWMEEsgjQlPH4/BDqDB/uHKfM2U1wxj 8RDjQSQzv+THJvAM+7lWaFesZ7GfBH/c5DgvNmUdJE8a/n9iDzt9omhFKSy9AThOApqBF9 eBExx+/r/b5wfAfvGqZszjm87A0o6Ty+aGVUMgEcc4LIyEZAF55gy+AmnD+pNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716875924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WyY1nMt/1lBam0AFEU70DKLv9uX5jWklKkFvdlJvVUU=; b=XWDj3pcd5Jx6x5w/rM0a+tRlkTYJiEpMOYsD4ZIhozrFV7AHPWwuCz5cOT9E+iXz1PyT1K 5W7BINnCR5s3lJ+T79Ap7fkzkiYsk9/jJmi4+ieG6XFlvYI4SjSl0Eeqi3zIAz1ARUnNiI 4KQd9nD4VEqw5fPycciBF9mepVsKx/44FpfVE4t+Ch4g27lNFsq59OdqvraAHgqDOMoF3M 0MzjuHTx0l41hMwTscGURVNvRnhwafhl28r+dpYLgM+iSxl22cs2gZ2WJ22WFG38TAit67 Ti+R+MUSuHzpJCEO/v5RzTTUs2l4aEV0lUXD5OHA5Ug/Q2HfFZPxUXaH5mtJHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VpMJh5vs1z1FmJ; Tue, 28 May 2024 05:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44S5wiXH069639; Tue, 28 May 2024 05:58:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44S5wi6V069635; Tue, 28 May 2024 05:58:44 GMT (envelope-from git) Date: Tue, 28 May 2024 05:58:44 GMT Message-Id: <202405280558.44S5wi6V069635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: e3ec564ecb9c - main - qlnxe: Fix promiscuous and allmulti settings List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3ec564ecb9c2daa96a8db36052e50ea554fe598 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e3ec564ecb9c2daa96a8db36052e50ea554fe598 commit e3ec564ecb9c2daa96a8db36052e50ea554fe598 Author: Keith Reynolds AuthorDate: 2024-05-28 05:57:44 +0000 Commit: Kevin Bowling CommitDate: 2024-05-28 05:57:44 +0000 qlnxe: Fix promiscuous and allmulti settings PR: 278087 MFC after: 1 week --- sys/dev/qlnx/qlnxe/qlnx_os.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 0ef3c93580b6..de64aaef1b4c 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -90,8 +90,8 @@ static void qlnx_init_ifnet(device_t dev, qlnx_host_t *ha); static void qlnx_init(void *arg); static void qlnx_init_locked(qlnx_host_t *ha); static int qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi); -static int qlnx_set_promisc(qlnx_host_t *ha); -static int qlnx_set_allmulti(qlnx_host_t *ha); +static int qlnx_set_promisc(qlnx_host_t *ha, int enabled); +static int qlnx_set_allmulti(qlnx_host_t *ha, int enabled); static int qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data); static int qlnx_media_change(if_t ifp); static void qlnx_media_status(if_t ifp, struct ifmediareq *ifmr); @@ -2595,7 +2595,7 @@ qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) } static int -qlnx_set_promisc(qlnx_host_t *ha) +qlnx_set_promisc(qlnx_host_t *ha, int enabled) { int rc = 0; uint8_t filter; @@ -2604,15 +2604,20 @@ qlnx_set_promisc(qlnx_host_t *ha) return (0); filter = ha->filter; - filter |= ECORE_ACCEPT_MCAST_UNMATCHED; - filter |= ECORE_ACCEPT_UCAST_UNMATCHED; + if (enabled) { + filter |= ECORE_ACCEPT_MCAST_UNMATCHED; + filter |= ECORE_ACCEPT_UCAST_UNMATCHED; + } else { + filter &= ~ECORE_ACCEPT_MCAST_UNMATCHED; + filter &= ~ECORE_ACCEPT_UCAST_UNMATCHED; + } rc = qlnx_set_rx_accept_filter(ha, filter); return (rc); } static int -qlnx_set_allmulti(qlnx_host_t *ha) +qlnx_set_allmulti(qlnx_host_t *ha, int enabled) { int rc = 0; uint8_t filter; @@ -2621,7 +2626,11 @@ qlnx_set_allmulti(qlnx_host_t *ha) return (0); filter = ha->filter; - filter |= ECORE_ACCEPT_MCAST_UNMATCHED; + if (enabled) { + filter |= ECORE_ACCEPT_MCAST_UNMATCHED; + } else { + filter &= ~ECORE_ACCEPT_MCAST_UNMATCHED; + } rc = qlnx_set_rx_accept_filter(ha, filter); return (rc); @@ -2689,10 +2698,10 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if ((if_getflags(ifp) ^ ha->if_flags) & IFF_PROMISC) { - ret = qlnx_set_promisc(ha); + ret = qlnx_set_promisc(ha, ifp->if_flags & IFF_PROMISC); } else if ((if_getflags(ifp) ^ ha->if_flags) & IFF_ALLMULTI) { - ret = qlnx_set_allmulti(ha); + ret = qlnx_set_allmulti(ha, ifp->if_flags & IFF_ALLMULTI); } } else { ha->max_frame_size = if_getmtu(ifp) + @@ -2702,9 +2711,9 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data) } else { if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) qlnx_stop(ha); - ha->if_flags = if_getflags(ifp); } + ha->if_flags = if_getflags(ifp); QLNX_UNLOCK(ha); break; @@ -7075,9 +7084,11 @@ qlnx_set_rx_mode(qlnx_host_t *ha) ECORE_ACCEPT_MCAST_MATCHED | ECORE_ACCEPT_BCAST; - if (qlnx_vf_device(ha) == 0) { + if (qlnx_vf_device(ha) == 0 || (ha->ifp->if_flags & IFF_PROMISC)) { filter |= ECORE_ACCEPT_UCAST_UNMATCHED; filter |= ECORE_ACCEPT_MCAST_UNMATCHED; + } else if (ha->ifp->if_flags & IFF_ALLMULTI) { + filter |= ECORE_ACCEPT_MCAST_UNMATCHED; } ha->filter = filter;