Skip to content

Commit 3f464b1

Browse files
pvantrapkuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 97b1ebb commit 3f464b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/dsa/tag_ksz.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME);
178178

179179
#define KSZ9477_INGRESS_TAG_LEN 2
180180
#define KSZ9477_PTP_TAG_LEN 4
181-
#define KSZ9477_PTP_TAG_INDICATION 0x80
181+
#define KSZ9477_PTP_TAG_INDICATION BIT(7)
182182

183+
#define KSZ9477_TAIL_TAG_EG_PORT_M GENMASK(2, 0)
183184
#define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)
184185
#define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)
185186
#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)
312313
{
313314
/* Tag decoding */
314315
u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
315-
unsigned int port = tag[0] & 7;
316+
unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
316317
unsigned int len = KSZ_EGRESS_TAG_LEN;
317318

318319
/* Extra 4-bytes PTP timestamp */

0 commit comments

Comments
 (0)