All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH net-next 0/2] More aggressive DSA cleanup
@ 2022-01-07 18:48 Vladimir Oltean
  2022-01-07 18:48 ` [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id Vladimir Oltean
  2022-01-07 18:48 ` [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list Vladimir Oltean
  0 siblings, 2 replies; 9+ messages in thread
From: Vladimir Oltean @ 2022-01-07 18:48 UTC (permalink / raw)
  To: netdev; +Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli

I'm sending these as RFC because I'm not 100% sure and may be missing
something. I've had these patches in my tree for a while though, and
testing on my boards didn't reveal any issues.

Vladimir Oltean (2):
  net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  net: dsa: remove lockdep class for DSA master address list

 net/dsa/master.c |  4 ----
 net/dsa/slave.c  | 42 +-----------------------------------------
 2 files changed, 1 insertion(+), 45 deletions(-)

-- 
2.25.1


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

* [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-07 18:48 [RFC PATCH net-next 0/2] More aggressive DSA cleanup Vladimir Oltean
@ 2022-01-07 18:48 ` Vladimir Oltean
  2022-01-07 19:37   ` Andrew Lunn
  2022-01-09 17:25   ` Ido Schimmel
  2022-01-07 18:48 ` [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list Vladimir Oltean
  1 sibling, 2 replies; 9+ messages in thread
From: Vladimir Oltean @ 2022-01-07 18:48 UTC (permalink / raw)
  To: netdev; +Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli

There are no legacy ports, DSA registers a devlink instance with ports
unconditionally for all switch drivers. Therefore, delete the old-style
ndo operations used for determining bridge forwarding domains.

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

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index eccd0288e572..3acb2a2db473 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -515,26 +515,6 @@ static int dsa_slave_port_obj_del(struct net_device *dev, const void *ctx,
 	return err;
 }
 
-static int dsa_slave_get_port_parent_id(struct net_device *dev,
-					struct netdev_phys_item_id *ppid)
-{
-	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct dsa_switch *ds = dp->ds;
-	struct dsa_switch_tree *dst = ds->dst;
-
-	/* For non-legacy ports, devlink is used and it takes
-	 * care of the name generation. This ndo implementation
-	 * should be removed with legacy support.
-	 */
-	if (dp->ds->devlink)
-		return -EOPNOTSUPP;
-
-	ppid->id_len = sizeof(dst->index);
-	memcpy(&ppid->id, &dst->index, ppid->id_len);
-
-	return 0;
-}
-
 static inline netdev_tx_t dsa_slave_netpoll_send_skb(struct net_device *dev,
 						     struct sk_buff *skb)
 {
@@ -973,24 +953,6 @@ static void dsa_slave_poll_controller(struct net_device *dev)
 }
 #endif
 
-static int dsa_slave_get_phys_port_name(struct net_device *dev,
-					char *name, size_t len)
-{
-	struct dsa_port *dp = dsa_slave_to_port(dev);
-
-	/* For non-legacy ports, devlink is used and it takes
-	 * care of the name generation. This ndo implementation
-	 * should be removed with legacy support.
-	 */
-	if (dp->ds->devlink)
-		return -EOPNOTSUPP;
-
-	if (snprintf(name, len, "p%d", dp->index) >= len)
-		return -EINVAL;
-
-	return 0;
-}
-
 static struct dsa_mall_tc_entry *
 dsa_slave_mall_tc_entry_find(struct net_device *dev, unsigned long cookie)
 {
@@ -1747,7 +1709,7 @@ static struct devlink_port *dsa_slave_get_devlink_port(struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
 
-	return dp->ds->devlink ? &dp->devlink_port : NULL;
+	return &dp->devlink_port;
 }
 
 static void dsa_slave_get_stats64(struct net_device *dev,
@@ -1792,10 +1754,8 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
 	.ndo_netpoll_cleanup	= dsa_slave_netpoll_cleanup,
 	.ndo_poll_controller	= dsa_slave_poll_controller,
 #endif
-	.ndo_get_phys_port_name	= dsa_slave_get_phys_port_name,
 	.ndo_setup_tc		= dsa_slave_setup_tc,
 	.ndo_get_stats64	= dsa_slave_get_stats64,
-	.ndo_get_port_parent_id	= dsa_slave_get_port_parent_id,
 	.ndo_vlan_rx_add_vid	= dsa_slave_vlan_rx_add_vid,
 	.ndo_vlan_rx_kill_vid	= dsa_slave_vlan_rx_kill_vid,
 	.ndo_get_devlink_port	= dsa_slave_get_devlink_port,
-- 
2.25.1


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

* [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list
  2022-01-07 18:48 [RFC PATCH net-next 0/2] More aggressive DSA cleanup Vladimir Oltean
  2022-01-07 18:48 ` [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id Vladimir Oltean
@ 2022-01-07 18:48 ` Vladimir Oltean
  2022-01-07 19:57   ` Florian Fainelli
  1 sibling, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2022-01-07 18:48 UTC (permalink / raw)
  To: netdev; +Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Cong Wang

Since commit 2f1e8ea726e9 ("net: dsa: link interfaces with the DSA
master to get rid of lockdep warnings"), suggested by Cong Wang, the
DSA interfaces and their master have different dev->nested_level, which
makes netif_addr_lock() stop complaining about potentially recursive
locking on the same lock class.

So we no longer need DSA masters to have their own lockdep class.

Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/dsa/master.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/dsa/master.c b/net/dsa/master.c
index 2199104ca7df..6ac393cc6ea7 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -330,8 +330,6 @@ static const struct attribute_group dsa_group = {
 	.attrs	= dsa_slave_attrs,
 };
 
-static struct lock_class_key dsa_master_addr_list_lock_key;
-
 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
 {
 	struct dsa_switch *ds = cpu_dp->ds;
@@ -353,8 +351,6 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
 	wmb();
 
 	dev->dsa_ptr = cpu_dp;
-	lockdep_set_class(&dev->addr_list_lock,
-			  &dsa_master_addr_list_lock_key);
 
 	dsa_master_set_promiscuity(dev, 1);
 
-- 
2.25.1


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

* Re: [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-07 18:48 ` [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id Vladimir Oltean
@ 2022-01-07 19:37   ` Andrew Lunn
  2022-01-07 19:48     ` Florian Fainelli
  2022-01-09 17:25   ` Ido Schimmel
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2022-01-07 19:37 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: netdev, Vivien Didelot, Florian Fainelli

On Fri, Jan 07, 2022 at 08:48:41PM +0200, Vladimir Oltean wrote:
> There are no legacy ports, DSA registers a devlink instance with ports
> unconditionally for all switch drivers. Therefore, delete the old-style
> ndo operations used for determining bridge forwarding domains.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Hi Vladimir

Maybe ask Ido or Jiri to review this? But none of the Mellanox drivers
use use these ndo's, suggesting it is correct.

	   Andrew

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

* Re: [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-07 19:37   ` Andrew Lunn
@ 2022-01-07 19:48     ` Florian Fainelli
  2022-01-07 20:00       ` Vladimir Oltean
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2022-01-07 19:48 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean; +Cc: netdev, Vivien Didelot

On 1/7/22 11:37 AM, Andrew Lunn wrote:
> On Fri, Jan 07, 2022 at 08:48:41PM +0200, Vladimir Oltean wrote:
>> There are no legacy ports, DSA registers a devlink instance with ports
>> unconditionally for all switch drivers. Therefore, delete the old-style
>> ndo operations used for determining bridge forwarding domains.
>>
>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Hi Vladimir
> 
> Maybe ask Ido or Jiri to review this? But none of the Mellanox drivers
> use use these ndo's, suggesting it is correct.

I confirmed that /sys/class/net/*/phys_port_name continues to work
before and after this patch, so:

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

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

* Re: [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list
  2022-01-07 18:48 ` [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list Vladimir Oltean
@ 2022-01-07 19:57   ` Florian Fainelli
  0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2022-01-07 19:57 UTC (permalink / raw)
  To: Vladimir Oltean, netdev; +Cc: Andrew Lunn, Vivien Didelot, Cong Wang

On 1/7/22 10:48 AM, Vladimir Oltean wrote:
> Since commit 2f1e8ea726e9 ("net: dsa: link interfaces with the DSA
> master to get rid of lockdep warnings"), suggested by Cong Wang, the
> DSA interfaces and their master have different dev->nested_level, which
> makes netif_addr_lock() stop complaining about potentially recursive
> locking on the same lock class.
> 
> So we no longer need DSA masters to have their own lockdep class.
> 
> Cc: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

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

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

* Re: [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-07 19:48     ` Florian Fainelli
@ 2022-01-07 20:00       ` Vladimir Oltean
  0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2022-01-07 20:00 UTC (permalink / raw)
  To: Jiri Pirko, Ido Schimmel
  Cc: Andrew Lunn, netdev, Vivien Didelot, Florian Fainelli

On Fri, Jan 07, 2022 at 11:48:30AM -0800, Florian Fainelli wrote:
> On 1/7/22 11:37 AM, Andrew Lunn wrote:
> > On Fri, Jan 07, 2022 at 08:48:41PM +0200, Vladimir Oltean wrote:
> >> There are no legacy ports, DSA registers a devlink instance with ports
> >> unconditionally for all switch drivers. Therefore, delete the old-style
> >> ndo operations used for determining bridge forwarding domains.
> >>
> >> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > 
> > Hi Vladimir
> > 
> > Maybe ask Ido or Jiri to review this? But none of the Mellanox drivers
> > use use these ndo's, suggesting it is correct.
> 
> I confirmed that /sys/class/net/*/phys_port_name continues to work
> before and after this patch, so:
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Tested-by: Florian Fainelli <f.fainelli@gmail.com>

Hi Jiri, Ido, could you please take a look? Patch content got cut, but
it's right here:
https://patchwork.kernel.org/project/netdevbpf/patch/20220107184842.550334-2-vladimir.oltean@nxp.com/

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

* Re: [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-07 18:48 ` [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id Vladimir Oltean
  2022-01-07 19:37   ` Andrew Lunn
@ 2022-01-09 17:25   ` Ido Schimmel
  2022-01-10  9:33     ` Jiri Pirko
  1 sibling, 1 reply; 9+ messages in thread
From: Ido Schimmel @ 2022-01-09 17:25 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli

On Fri, Jan 07, 2022 at 08:48:41PM +0200, Vladimir Oltean wrote:
> There are no legacy ports, DSA registers a devlink instance with ports
> unconditionally for all switch drivers. Therefore, delete the old-style
> ndo operations used for determining bridge forwarding domains.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Looks correct to me.

If ndo_get_phys_port_name() is not implemented, then
devlink_compat_phys_port_name_get() is called which invokes
ndo_get_devlink_port() that you have implemented. Similarly, for
ndo_get_port_parent_id().

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

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

* Re: [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id
  2022-01-09 17:25   ` Ido Schimmel
@ 2022-01-10  9:33     ` Jiri Pirko
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-01-10  9:33 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: Vladimir Oltean, netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli

Sun, Jan 09, 2022 at 06:25:38PM CET, idosch@idosch.org wrote:
>On Fri, Jan 07, 2022 at 08:48:41PM +0200, Vladimir Oltean wrote:
>> There are no legacy ports, DSA registers a devlink instance with ports
>> unconditionally for all switch drivers. Therefore, delete the old-style
>> ndo operations used for determining bridge forwarding domains.
>> 
>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>
>Looks correct to me.

+1

>
>If ndo_get_phys_port_name() is not implemented, then
>devlink_compat_phys_port_name_get() is called which invokes
>ndo_get_devlink_port() that you have implemented. Similarly, for
>ndo_get_port_parent_id().
>
>Reviewed-by: Ido Schimmel <idosch@nvidia.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

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

end of thread, other threads:[~2022-01-10  9:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 18:48 [RFC PATCH net-next 0/2] More aggressive DSA cleanup Vladimir Oltean
2022-01-07 18:48 ` [RFC PATCH net-next 1/2] net: dsa: remove ndo_get_phys_port_name and ndo_get_port_parent_id Vladimir Oltean
2022-01-07 19:37   ` Andrew Lunn
2022-01-07 19:48     ` Florian Fainelli
2022-01-07 20:00       ` Vladimir Oltean
2022-01-09 17:25   ` Ido Schimmel
2022-01-10  9:33     ` Jiri Pirko
2022-01-07 18:48 ` [RFC PATCH net-next 2/2] net: dsa: remove lockdep class for DSA master address list Vladimir Oltean
2022-01-07 19:57   ` Florian Fainelli

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.