[RFC PATCH net-next 06/11] net: dsa: microchip: lan937x: get cascade tag protocol

From: Rakesh Sankaranarayanan
Date: Thu Feb 02 2023 - 07:59:22 EST


Update ksz_get_tag_protocol to return separate tag protocol if
switch is connected in cascade mode. Variable ds->dst->last_switch
will contain total number of switches registered. For cascaded
connection alone, this will be more than zero.

Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@xxxxxxxxxxxxx>
---
drivers/net/dsa/microchip/ksz_common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index adf8391dd29f..2160a3e61a5a 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -2567,9 +2567,13 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
dev->chip_id == KSZ9567_CHIP_ID)
proto = DSA_TAG_PROTO_KSZ9477;

- if (is_lan937x(dev))
+ if (is_lan937x(dev)) {
proto = DSA_TAG_PROTO_LAN937X_VALUE;

+ if (ds->dst->last_switch)
+ proto = DSA_TAG_PROTO_LAN937X_CASCADE_VALUE;
+ }
+
return proto;
}

--
2.34.1