Commit 6f2b72c0 authored by Pieter Van Trappen's avatar Pieter Van Trappen Committed by Jakub Kicinski

net: dsa: microchip: fix tag_ksz egress mask for KSZ8795 family

Fix the tag_ksz egress mask for DSA_TAG_PROTO_KSZ8795, the port is
encoded in the two and not three LSB. This fix is for completeness,
for example the bug doesn't manifest itself on the KSZ8794 because bit
2 seems to be always zero.
Signed-off-by: default avatarPieter Van Trappen <pieter.van.trappen@cern.ch>
Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
Link: https://patch.msgid.link/20240813142750.772781-7-vtpieter@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0d3edc90
...@@ -111,9 +111,10 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, ...@@ -111,9 +111,10 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
* DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|FCS(4bytes) * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|FCS(4bytes)
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* tag0 : zero-based value represents port * tag0 : zero-based value represents port
* (eg, 0x00=port1, 0x02=port3, 0x06=port7) * (eg, 0x0=port1, 0x2=port3, 0x3=port4)
*/ */
#define KSZ8795_TAIL_TAG_EG_PORT_M GENMASK(1, 0)
#define KSZ8795_TAIL_TAG_OVERRIDE BIT(6) #define KSZ8795_TAIL_TAG_OVERRIDE BIT(6)
#define KSZ8795_TAIL_TAG_LOOKUP BIT(7) #define KSZ8795_TAIL_TAG_LOOKUP BIT(7)
...@@ -141,7 +142,8 @@ static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev) ...@@ -141,7 +142,8 @@ static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev)
{ {
u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN; u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
return ksz_common_rcv(skb, dev, tag[0] & 7, KSZ_EGRESS_TAG_LEN); return ksz_common_rcv(skb, dev, tag[0] & KSZ8795_TAIL_TAG_EG_PORT_M,
KSZ_EGRESS_TAG_LEN);
} }
static const struct dsa_device_ops ksz8795_netdev_ops = { static const struct dsa_device_ops ksz8795_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment