lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251127120902.292555-16-vladimir.oltean@nxp.com>
Date: Thu, 27 Nov 2025 14:09:02 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	David Yang <mmyangfl@...il.com>
Subject: [PATCH net-next 15/15] net: dsa: tag_yt921x: use the dsa_xmit_port_mask() helper

The "yt921x" tagging protocol populates a bit mask for the TX ports,
so we can use dsa_xmit_port_mask() to centralize the decision of how to
set that field.

Cc: David Yang <mmyangfl@...il.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 net/dsa/tag_yt921x.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/dsa/tag_yt921x.c b/net/dsa/tag_yt921x.c
index 995da44f0a2a..6bbfd42dc5df 100644
--- a/net/dsa/tag_yt921x.c
+++ b/net/dsa/tag_yt921x.c
@@ -38,14 +38,11 @@
 #define  YT921X_TAG_RX_CMD_FORWARDED		0x80
 #define  YT921X_TAG_RX_CMD_UNK_UCAST		0xb2
 #define  YT921X_TAG_RX_CMD_UNK_MCAST		0xb4
-#define YT921X_TAG_TX_PORTS_M		GENMASK(10, 0)
-#define YT921X_TAG_TX_PORTn(port)	BIT(port)
+#define YT921X_TAG_TX_PORTS		GENMASK(10, 0)
 
 static struct sk_buff *
 yt921x_tag_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
-	struct dsa_port *dp = dsa_user_to_port(netdev);
-	unsigned int port = dp->index;
 	__be16 *tag;
 	u16 tx;
 
@@ -58,7 +55,8 @@ yt921x_tag_xmit(struct sk_buff *skb, struct net_device *netdev)
 	/* VLAN tag unrelated when TX */
 	tag[1] = 0;
 	tag[2] = 0;
-	tx = YT921X_TAG_PORT_EN | YT921X_TAG_TX_PORTn(port);
+	tx = FIELD_PREP(YT921X_TAG_TX_PORTS, dsa_xmit_port_mask(skb, netdev)) |
+	     YT921X_TAG_PORT_EN;
 	tag[3] = htons(tx);
 
 	return skb;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ