]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: microchip: update tag_ksz masks for KSZ9477 family
authorPieter Van Trappen <pieter.van.trappen@cern.ch>
Fri, 5 Sep 2025 19:09:03 +0000 (15:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:45:23 +0000 (18:45 +0200)
[ Upstream commit 3f464b193d40e49299dcd087b10cc3b77cbbea68 ]

Remove magic number 7 by introducing a GENMASK macro instead.
Remove magic number 0x80 by using the BIT macro instead.

Signed-off-by: Pieter Van Trappen <pieter.van.trappen@cern.ch>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20240909134301.75448-1-vtpieter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/tag_ksz.c

index 230ddf45dff0dcc58c1350d15a2e88c707ff98fa..e949d374b26ab13c631f9b48e7412b6977b648f6 100644 (file)
@@ -103,8 +103,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795);
 
 #define KSZ9477_INGRESS_TAG_LEN                2
 #define KSZ9477_PTP_TAG_LEN            4
-#define KSZ9477_PTP_TAG_INDICATION     0x80
+#define KSZ9477_PTP_TAG_INDICATION     BIT(7)
 
+#define KSZ9477_TAIL_TAG_EG_PORT_M     GENMASK(2, 0)
 #define KSZ9477_TAIL_TAG_OVERRIDE      BIT(9)
 #define KSZ9477_TAIL_TAG_LOOKUP                BIT(10)
 
@@ -135,7 +136,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev,
 {
        /* Tag decoding */
        u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-       unsigned int port = tag[0] & 7;
+       unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
        unsigned int len = KSZ_EGRESS_TAG_LEN;
 
        /* Extra 4-bytes PTP timestamp */