From nobody Sat Oct 12 13:58:38 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 4XQlTC17XPz5YQwG; Sat, 12 Oct 2024 13:58:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQlTC0bKzz4m6Q; Sat, 12 Oct 2024 13:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728741519; 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=UyQkZqmuPwWYWzMloVq6NwmrKJo6mbnccfhmrSKHXc4=; b=ikYrAzknA4SJGt6x1OE7a3fIW0waDtS0Wxz/zp2itUgNq+Qjwvp7nPZMI3+ouB21srRe2q xpqz0S7BlhRo7cDh/8WFd7SJ3tYtzFvuh6rbOKnVXF3KDJmR8P64LAc49enw7uHB4WUEjD PGUKKYFZhXwJ09K/+8CND3I6oS9R+N31E4SyeOfl1dWrxsJHO+iTyWI0sk5/mfcMQbC6Pi nNbvYE1S0qpRzgkKq6tPotiWEYLWf5+rMGOL01lqKf+k6q9ofY2Sz9fkZxX+vFHe8FjaRe v+jtCrKYKr0MdCV3NsTyMHgGgf7Xa+dbH+kWZRprewpvPa0i6w42QG4r9tIvGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728741519; 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=UyQkZqmuPwWYWzMloVq6NwmrKJo6mbnccfhmrSKHXc4=; b=UH/OoKlTl4KzqBrQqIYs4Mpc9SNcYADVa2XpTr4aapbI+1HeSwl2BKVcNoYl31I0yY2Mp8 rHaYaoUvECdEhGnVXKVrmeBYG4n7AtsDABy5cYWHBqWakU6LEKhFgoTox2FIhb7rYOvPY+ TKVfOV3fxJhfaic0MZ6mxCAxwbcXVD9bd9hzg2cCK8vA9cF75qdCxMIodEUmCtNWKqKvHF Jc8hMUCjmlWJnjLQ8IkZhgNsnbgXtZAtIgQCG5U341yqYtk9QT1kvEPomAjMaBDDycHw4V MxHir79KZk21koV7KTlHZMNwzHA8q2dRpH+ngxAXb5eyl4+IrcoVXFXuejmkLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728741519; a=rsa-sha256; cv=none; b=cLQH8C9Lgb7Ebzlf++qnecQwMF0NUu4SlQzXAGUqCiGn0f4Edd2ZYgbolqbEDH9fIHg3BU iEH91KJwL1V/2L9NCzGlL5RQtolU0TRdohiPcMnqKWco0VAtdwON979lwZGKDUcrkxBncR XVhonvPy9O8fqNMfb4nhMNYxgo+ZXK/QsLYAOu1LiUW9QHbLX1C+hDJVeCsQvJZdbcOopi piJn8Cz1WO79Ucdypky3PTil94fhgfHSbgUcUypUfJoxB9PovyWpIFqhzg3UejgaeViWzr xKop256U71RoSOl9VYTYivtbhnrEIVFEp+gsu2EtC+zf6nZZgtiiJk5aOY3zaw== 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 4XQlTC08lHz1RHb; Sat, 12 Oct 2024 13:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49CDwcpo026222; Sat, 12 Oct 2024 13:58:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49CDwcRH026219; Sat, 12 Oct 2024 13:58:38 GMT (envelope-from git) Date: Sat, 12 Oct 2024 13:58:38 GMT Message-Id: <202410121358.49CDwcRH026219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: c7a2636889a6 - main - axgbe: Fix setting promisc mode 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7a2636889a649985e323de23fe495608b6fe483 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=c7a2636889a649985e323de23fe495608b6fe483 commit c7a2636889a649985e323de23fe495608b6fe483 Author: Zhenlei Huang AuthorDate: 2024-10-12 13:56:56 +0000 Commit: Zhenlei Huang CommitDate: 2024-10-12 13:56:56 +0000 axgbe: Fix setting promisc mode Ethernet drivers should respect IFF_PROMISC rather than IFF_PPROMISC. The latter is for user-requested promisc mode, it implies the former but not vice versa. Some in-kernel components such as if_bridge(4) and bpf(4) will set promisc mode for interfaces on-demand. While here, update the debugging message to be not confusing. This was spotted while reviewing markj@ 's work D46524. Test from Franco shows that the interface seems to be unconditionally initialized to promisc mode regardless of this fix. That needs further investigation. Reviewed by: markj, Franco Fichtner Tested by: Franco Fichtner MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46794 --- sys/dev/axgbe/if_axgbe_pci.c | 10 ++++++---- sys/dev/axgbe/xgbe-dev.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c index d3078a1c33c1..290156ff11ca 100644 --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -2363,11 +2363,11 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags) axgbe_printf(1, "%s: MAC_PFR 0x%x drv_flags 0x%x if_flags 0x%x\n", __func__, XGMAC_IOREAD(pdata, MAC_PFR), if_getdrvflags(ifp), - if_getflags(ifp)); + flags); - if (if_getflags(ifp) & IFF_PPROMISC) { + if (flags & IFF_PROMISC) { - axgbe_printf(1, "User requested to enter promisc mode\n"); + axgbe_printf(1, "Requested to enter promisc mode\n"); if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 1) { axgbe_printf(1, "Already in promisc mode\n"); @@ -2376,10 +2376,11 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags) axgbe_printf(1, "Entering promisc mode\n"); XGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1); + /* Disable VLAN filtering */ XGMAC_IOWRITE_BITS(pdata, MAC_PFR, VTFE, 0); } else { - axgbe_printf(1, "User requested to leave promisc mode\n"); + axgbe_printf(1, "Requested to leave promisc mode\n"); if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 0) { axgbe_printf(1, "Already not in promisc mode\n"); @@ -2388,6 +2389,7 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags) axgbe_printf(1, "Leaving promisc mode\n"); XGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0); + /* Enable VLAN filtering */ XGMAC_IOWRITE_BITS(pdata, MAC_PFR, VTFE, 1); } diff --git a/sys/dev/axgbe/xgbe-dev.c b/sys/dev/axgbe/xgbe-dev.c index 3a7d683ea5a9..48f3f2b587f0 100644 --- a/sys/dev/axgbe/xgbe-dev.c +++ b/sys/dev/axgbe/xgbe-dev.c @@ -970,7 +970,7 @@ xgbe_config_rx_mode(struct xgbe_prv_data *pdata) { unsigned int pr_mode, am_mode; - pr_mode = ((if_getflags(pdata->netdev) & IFF_PPROMISC) != 0); + pr_mode = ((if_getflags(pdata->netdev) & IFF_PROMISC) != 0); am_mode = ((if_getflags(pdata->netdev) & IFF_ALLMULTI) != 0); xgbe_set_promiscuous_mode(pdata, pr_mode);