All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
@ 2021-07-30 22:57 Vladimir Oltean
  2021-07-31  2:54 ` DENG Qingfang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vladimir Oltean @ 2021-07-30 22:57 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, David S. Miller
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Sean Wang,
	Landen Chao, DENG Qingfang

It is desirable to reduce the surface of DSA_TAG_PROTO_NONE as much as
we can, because we now have options for switches without hardware
support for DSA tagging, and the occurrence in the mt7530 driver is in
fact quite gratuitout and easy to remove. Since ds->ops->get_tag_protocol()
is only called for CPU ports, the checks for a CPU port in
mtk_get_tag_protocol() are redundant and can be removed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/mt7530.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 69f21b71614c..b6e0b347947e 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1717,15 +1717,7 @@ static enum dsa_tag_protocol
 mtk_get_tag_protocol(struct dsa_switch *ds, int port,
 		     enum dsa_tag_protocol mp)
 {
-	struct mt7530_priv *priv = ds->priv;
-
-	if (port != MT7530_CPU_PORT) {
-		dev_warn(priv->dev,
-			 "port not matched with tagging CPU port\n");
-		return DSA_TAG_PROTO_NONE;
-	} else {
-		return DSA_TAG_PROTO_MTK;
-	}
+	return DSA_TAG_PROTO_MTK;
 }
 
 #ifdef CONFIG_GPIOLIB
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
  2021-07-30 22:57 [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol() Vladimir Oltean
@ 2021-07-31  2:54 ` DENG Qingfang
  2021-07-31  3:08 ` Florian Fainelli
  2021-08-02 14:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: DENG Qingfang @ 2021-07-31  2:54 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, Jakub Kicinski, David S. Miller, Andrew Lunn,
	Florian Fainelli, Vivien Didelot, Sean Wang, Landen Chao

On Sat, Jul 31, 2021 at 01:57:14AM +0300, Vladimir Oltean wrote:
> It is desirable to reduce the surface of DSA_TAG_PROTO_NONE as much as
> we can, because we now have options for switches without hardware
> support for DSA tagging, and the occurrence in the mt7530 driver is in
> fact quite gratuitout and easy to remove. Since ds->ops->get_tag_protocol()
> is only called for CPU ports, the checks for a CPU port in
> mtk_get_tag_protocol() are redundant and can be removed.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/dsa/mt7530.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 69f21b71614c..b6e0b347947e 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -1717,15 +1717,7 @@ static enum dsa_tag_protocol
>  mtk_get_tag_protocol(struct dsa_switch *ds, int port,
>  		     enum dsa_tag_protocol mp)
>  {
> -	struct mt7530_priv *priv = ds->priv;
> -
> -	if (port != MT7530_CPU_PORT) {
> -		dev_warn(priv->dev,
> -			 "port not matched with tagging CPU port\n");
> -		return DSA_TAG_PROTO_NONE;
> -	} else {
> -		return DSA_TAG_PROTO_MTK;
> -	}
> +	return DSA_TAG_PROTO_MTK;
>  }
>  
>  #ifdef CONFIG_GPIOLIB
> -- 
> 2.25.1
> 

Acked-by: DENG Qingfang <dqfext@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
  2021-07-30 22:57 [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol() Vladimir Oltean
  2021-07-31  2:54 ` DENG Qingfang
@ 2021-07-31  3:08 ` Florian Fainelli
  2021-07-31 14:08   ` Vladimir Oltean
  2021-08-02 14:10 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2021-07-31  3:08 UTC (permalink / raw)
  To: Vladimir Oltean, netdev, Jakub Kicinski, David S. Miller
  Cc: Andrew Lunn, Vivien Didelot, Sean Wang, Landen Chao, DENG Qingfang



On 7/30/2021 3:57 PM, Vladimir Oltean wrote:
> It is desirable to reduce the surface of DSA_TAG_PROTO_NONE as much as
> we can, because we now have options for switches without hardware
> support for DSA tagging, and the occurrence in the mt7530 driver is in
> fact quite gratuitout and easy to remove. Since ds->ops->get_tag_protocol()
> is only called for CPU ports, the checks for a CPU port in
> mtk_get_tag_protocol() are redundant and can be removed.

The point of the check was in case the designated CPU port from device 
tree/platform data would not match what the Mediatek driver supports, 
similar to what b53 does in the same vein. I am fine with removing that 
check for mt7530 as it does not look like there is an use case where the 
CPU port is not actually MT7530_CPU_PORT.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
  2021-07-31  3:08 ` Florian Fainelli
@ 2021-07-31 14:08   ` Vladimir Oltean
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2021-07-31 14:08 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Vladimir Oltean, netdev, Jakub Kicinski, David S. Miller,
	Andrew Lunn, Vivien Didelot, Sean Wang, Landen Chao,
	DENG Qingfang

On Fri, Jul 30, 2021 at 08:08:43PM -0700, Florian Fainelli wrote:
> On 7/30/2021 3:57 PM, Vladimir Oltean wrote:
> > It is desirable to reduce the surface of DSA_TAG_PROTO_NONE as much as
> > we can, because we now have options for switches without hardware
> > support for DSA tagging, and the occurrence in the mt7530 driver is in
> > fact quite gratuitout and easy to remove. Since ds->ops->get_tag_protocol()
> > is only called for CPU ports, the checks for a CPU port in
> > mtk_get_tag_protocol() are redundant and can be removed.
> 
> The point of the check was in case the designated CPU port from device
> tree/platform data would not match what the Mediatek driver supports,
> similar to what b53 does in the same vein. I am fine with removing that
> check for mt7530 as it does not look like there is an use case where the CPU
> port is not actually MT7530_CPU_PORT.

So if mt7530 only supports port 6 as a CPU port, how is Qingfang testing
multiple CPU ports on it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
  2021-07-30 22:57 [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol() Vladimir Oltean
  2021-07-31  2:54 ` DENG Qingfang
  2021-07-31  3:08 ` Florian Fainelli
@ 2021-08-02 14:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-02 14:10 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, kuba, davem, andrew, f.fainelli, vivien.didelot,
	sean.wang, Landen.Chao, dqfext

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sat, 31 Jul 2021 01:57:14 +0300 you wrote:
> It is desirable to reduce the surface of DSA_TAG_PROTO_NONE as much as
> we can, because we now have options for switches without hardware
> support for DSA tagging, and the occurrence in the mt7530 driver is in
> fact quite gratuitout and easy to remove. Since ds->ops->get_tag_protocol()
> is only called for CPU ports, the checks for a CPU port in
> mtk_get_tag_protocol() are redundant and can be removed.
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol()
    https://git.kernel.org/netdev/net-next/c/244f8a802911

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-02 14:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 22:57 [PATCH net-next] net: dsa: mt7530: drop paranoid checks in .get_tag_protocol() Vladimir Oltean
2021-07-31  2:54 ` DENG Qingfang
2021-07-31  3:08 ` Florian Fainelli
2021-07-31 14:08   ` Vladimir Oltean
2021-08-02 14:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.