diff mbox series

[v2,net-next,6/6] net: dsa: remove cross-chip support from the MRP notifiers

Message ID 20210621164219.3780244-7-olteanv@gmail.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series Improvement for DSA cross-chip setups | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 82 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Vladimir Oltean June 21, 2021, 4:42 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

With MRP hardware assist being supported only by the ocelot switch
family, which by design does not support cross-chip bridging, the
current match functions are at best a guess and have not been confirmed
in any way to do anything relevant in a multi-switch topology.

Drop the code and make the notifiers match only on the targeted switch
port.

Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
v1->v2: remove unused variable "err" in dsa_switch_mrp_add_ring_role()

 net/dsa/switch.c | 55 ++++++------------------------------------------
 1 file changed, 7 insertions(+), 48 deletions(-)

Comments

Horatiu Vultur June 22, 2021, 7:46 a.m. UTC | #1
The 06/21/2021 19:42, Vladimir Oltean wrote:

Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> With MRP hardware assist being supported only by the ocelot switch
> family, which by design does not support cross-chip bridging, the
> current match functions are at best a guess and have not been confirmed
> in any way to do anything relevant in a multi-switch topology.
> 
> Drop the code and make the notifiers match only on the targeted switch
> port.
> 
> Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> v1->v2: remove unused variable "err" in dsa_switch_mrp_add_ring_role()
> 
>  net/dsa/switch.c | 55 ++++++------------------------------------------
>  1 file changed, 7 insertions(+), 48 deletions(-)
> 
> diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> index 75f567390a6b..c1e5afafe633 100644
> --- a/net/dsa/switch.c
> +++ b/net/dsa/switch.c
> @@ -346,36 +346,16 @@ static int dsa_switch_change_tag_proto(struct dsa_switch *ds,
>         return 0;
>  }
> 
> -static bool dsa_switch_mrp_match(struct dsa_switch *ds, int port,
> -                                struct dsa_notifier_mrp_info *info)
> -{
> -       if (ds->index == info->sw_index && port == info->port)
> -               return true;
> -
> -       if (dsa_is_dsa_port(ds, port))
> -               return true;
> -
> -       return false;
> -}
> -
>  static int dsa_switch_mrp_add(struct dsa_switch *ds,
>                               struct dsa_notifier_mrp_info *info)
>  {
> -       int err = 0;
> -       int port;
> -
>         if (!ds->ops->port_mrp_add)
>                 return -EOPNOTSUPP;
> 
> -       for (port = 0; port < ds->num_ports; port++) {
> -               if (dsa_switch_mrp_match(ds, port, info)) {
> -                       err = ds->ops->port_mrp_add(ds, port, info->mrp);
> -                       if (err)
> -                               break;
> -               }
> -       }
> +       if (ds->index == info->sw_index)
> +               return ds->ops->port_mrp_add(ds, info->port, info->mrp);
> 
> -       return err;
> +       return 0;
>  }
> 
>  static int dsa_switch_mrp_del(struct dsa_switch *ds,
> @@ -390,39 +370,18 @@ static int dsa_switch_mrp_del(struct dsa_switch *ds,
>         return 0;
>  }
> 
> -static bool
> -dsa_switch_mrp_ring_role_match(struct dsa_switch *ds, int port,
> -                              struct dsa_notifier_mrp_ring_role_info *info)
> -{
> -       if (ds->index == info->sw_index && port == info->port)
> -               return true;
> -
> -       if (dsa_is_dsa_port(ds, port))
> -               return true;
> -
> -       return false;
> -}
> -
>  static int
>  dsa_switch_mrp_add_ring_role(struct dsa_switch *ds,
>                              struct dsa_notifier_mrp_ring_role_info *info)
>  {
> -       int err = 0;
> -       int port;
> -
>         if (!ds->ops->port_mrp_add)
>                 return -EOPNOTSUPP;
> 
> -       for (port = 0; port < ds->num_ports; port++) {
> -               if (dsa_switch_mrp_ring_role_match(ds, port, info)) {
> -                       err = ds->ops->port_mrp_add_ring_role(ds, port,
> -                                                             info->mrp);
> -                       if (err)
> -                               break;
> -               }
> -       }
> +       if (ds->index == info->sw_index)
> +               return ds->ops->port_mrp_add_ring_role(ds, info->port,
> +                                                      info->mrp);
> 
> -       return err;
> +       return 0;
>  }
> 
>  static int
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 75f567390a6b..c1e5afafe633 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -346,36 +346,16 @@  static int dsa_switch_change_tag_proto(struct dsa_switch *ds,
 	return 0;
 }
 
-static bool dsa_switch_mrp_match(struct dsa_switch *ds, int port,
-				 struct dsa_notifier_mrp_info *info)
-{
-	if (ds->index == info->sw_index && port == info->port)
-		return true;
-
-	if (dsa_is_dsa_port(ds, port))
-		return true;
-
-	return false;
-}
-
 static int dsa_switch_mrp_add(struct dsa_switch *ds,
 			      struct dsa_notifier_mrp_info *info)
 {
-	int err = 0;
-	int port;
-
 	if (!ds->ops->port_mrp_add)
 		return -EOPNOTSUPP;
 
-	for (port = 0; port < ds->num_ports; port++) {
-		if (dsa_switch_mrp_match(ds, port, info)) {
-			err = ds->ops->port_mrp_add(ds, port, info->mrp);
-			if (err)
-				break;
-		}
-	}
+	if (ds->index == info->sw_index)
+		return ds->ops->port_mrp_add(ds, info->port, info->mrp);
 
-	return err;
+	return 0;
 }
 
 static int dsa_switch_mrp_del(struct dsa_switch *ds,
@@ -390,39 +370,18 @@  static int dsa_switch_mrp_del(struct dsa_switch *ds,
 	return 0;
 }
 
-static bool
-dsa_switch_mrp_ring_role_match(struct dsa_switch *ds, int port,
-			       struct dsa_notifier_mrp_ring_role_info *info)
-{
-	if (ds->index == info->sw_index && port == info->port)
-		return true;
-
-	if (dsa_is_dsa_port(ds, port))
-		return true;
-
-	return false;
-}
-
 static int
 dsa_switch_mrp_add_ring_role(struct dsa_switch *ds,
 			     struct dsa_notifier_mrp_ring_role_info *info)
 {
-	int err = 0;
-	int port;
-
 	if (!ds->ops->port_mrp_add)
 		return -EOPNOTSUPP;
 
-	for (port = 0; port < ds->num_ports; port++) {
-		if (dsa_switch_mrp_ring_role_match(ds, port, info)) {
-			err = ds->ops->port_mrp_add_ring_role(ds, port,
-							      info->mrp);
-			if (err)
-				break;
-		}
-	}
+	if (ds->index == info->sw_index)
+		return ds->ops->port_mrp_add_ring_role(ds, info->port,
+						       info->mrp);
 
-	return err;
+	return 0;
 }
 
 static int