diff options
author | Pieter Van Trappen <pieter.van.trappen@cern.ch> | 2024-09-09 15:42:59 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-09-10 17:27:56 -0700 |
commit | 3f464b193d40e49299dcd087b10cc3b77cbbea68 (patch) | |
tree | 7b994f13bfc674efef80e52b2263a522c9d3f853 | |
parent | 97b1ebb1e27d71a34367f6401ddebbd837d076a9 (diff) | |
download | linux-3f464b193d40e49299dcd087b10cc3b77cbbea68.tar.gz linux-3f464b193d40e49299dcd087b10cc3b77cbbea68.tar.bz2 linux-3f464b193d40e49299dcd087b10cc3b77cbbea68.zip |
net: dsa: microchip: update tag_ksz masks for KSZ9477 family
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>
-rw-r--r-- | net/dsa/tag_ksz.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 1f46de394f2e..281bbac5539d 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -178,8 +178,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME); #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_PRIO GENMASK(8, 7) #define KSZ9477_TAIL_TAG_OVERRIDE BIT(9) #define KSZ9477_TAIL_TAG_LOOKUP BIT(10) @@ -312,7 +313,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 */ |