public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	linux@armlinux.org.uk
Subject: Re: [RFC PATCH net-next 06/11] net: dsa: microchip: lan937x: get cascade tag protocol
Date: Sat, 4 Feb 2023 01:30:55 +0200	[thread overview]
Message-ID: <20230203233055.vdctyjmdeam4tj5p@skbuf> (raw)
In-Reply-To: <20230202125930.271740-7-rakesh.sankaranarayanan@microchip.com>

On Thu, Feb 02, 2023 at 06:29:25PM +0530, Rakesh Sankaranarayanan wrote:
> 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.

Nope, last_switch does not contain the total number of switches
registered, but the index of the last switch in this tree. DSA does not
assume that the indices are consecutive.

If you make any assumption in the driver regarding switch numbering in a
cascade setup, it is an assumption that a device tree writer who is not
you needs to know about. So you must document it in
Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml.

> 
> Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
> ---
>  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;
> +	}

Also nope, see the comment on patch 1.

> +
>  	return proto;
>  }
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-02-03 23:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 12:59 [RFC PATCH net-next 00/11] net: dsa: microchip: lan937x: add switch cascade support Rakesh Sankaranarayanan
2023-02-02 12:59 ` [RFC PATCH net-next 01/11] net: dsa: microchip: lan937x: add cascade tailtag Rakesh Sankaranarayanan
2023-02-03 23:10   ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 02/11] net: dsa: microchip: lan937x: update SMI index Rakesh Sankaranarayanan
2023-02-03 23:18   ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 03/11] net: dsa: microchip: lan937x: enable cascade port Rakesh Sankaranarayanan
2023-02-03 23:24   ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 04/11] net: dsa: microchip: lan937x: update port number for LAN9373 Rakesh Sankaranarayanan
2023-02-02 15:19   ` Andrew Lunn
2023-02-03 10:43     ` Rakesh.Sankaranarayanan
2023-02-03 23:26       ` Vladimir Oltean
2023-02-06 14:38         ` Arun.Ramadoss
2023-02-02 12:59 ` [RFC PATCH net-next 05/11] net: dsa: microchip: lan937x: add shared global interrupt Rakesh Sankaranarayanan
2023-02-02 15:25   ` Andrew Lunn
2023-02-02 12:59 ` [RFC PATCH net-next 06/11] net: dsa: microchip: lan937x: get cascade tag protocol Rakesh Sankaranarayanan
2023-02-03 23:30   ` Vladimir Oltean [this message]
2023-02-02 12:59 ` [RFC PATCH net-next 07/11] net: dsa: microchip: lan937x: update switch register Rakesh Sankaranarayanan
2023-02-02 15:40   ` Andrew Lunn
2023-02-03 10:48     ` Rakesh.Sankaranarayanan
2023-02-03 23:37     ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 08/11] net: dsa: microchip: lan937x: avoid mib read for cascaded port Rakesh Sankaranarayanan
2023-02-02 15:45   ` Andrew Lunn
2023-02-02 12:59 ` [RFC PATCH net-next 09/11] net: dsa: microchip: lan937x: update port membership with dsa port Rakesh Sankaranarayanan
2023-02-03 23:47   ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 10/11] net: dsa: microchip: lan937x: update vlan untag membership Rakesh Sankaranarayanan
2023-02-03 23:48   ` Vladimir Oltean
2023-02-02 12:59 ` [RFC PATCH net-next 11/11] net: dsa: microchip: lan937x: update multicast table Rakesh Sankaranarayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203233055.vdctyjmdeam4tj5p@skbuf \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rakesh.sankaranarayanan@microchip.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox