Re: [PATCH net-next v3 1/2] net: dsa: Use conduit and user terms

From: Vladimir Oltean
Date: Mon Oct 16 2023 - 09:23:42 EST


On Fri, Oct 13, 2023 at 02:52:50PM -0700, Florian Fainelli wrote:
> Use more inclusive terms throughout the DSA subsystem by moving away
> from "master" which is replaced by "conduit" and "slave" which is
> replaced by "user". No functional changes.
>
> Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
> ---
> diff --git a/Documentation/networking/dsa/configuration.rst b/Documentation/networking/dsa/configuration.rst
> index d2934c40f0f1..e6c9719874b0 100644
> --- a/Documentation/networking/dsa/configuration.rst
> +++ b/Documentation/networking/dsa/configuration.rst
> -Past this point, the DSA slave network devices get delivered regular Ethernet
> +Past this point, the DSA user network devices get delivered regular Ethernet
> frames that can be processed by the networking stack.
>
> -Slave network devices
> +User network devices
> ---------------------

Please adjust section underline width.

Do we want a sentence in the documentation that clarifies that "user interfaces"
and "conduit interfaces" used to be called "slave interfaces" and "master interfaces"
(for 15 years), so that old time users don't get confused as to what happened?

> @@ -863,7 +863,7 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
> }
>
> /* This enforces legacy behavior for switch drivers which assume they can't
> - * receive VLAN configuration when enslaved to a bridge with vlan_filtering=0
> + * receive VLAN configuration when enuserd to a bridge with vlan_filtering=0

when joining a bridge

> */
> bool dsa_port_skip_vlan_configuration(struct dsa_port *dp)
> {
> @@ -1057,7 +1057,7 @@ static int dsa_switch_event(struct notifier_block *nb,
> err = dsa_switch_tag_8021q_vlan_del(ds, info);
> break;
> case DSA_NOTIFIER_MASTER_STATE_CHANGE:

As Stephen points out, maybe you want to change this notifier name as well.

> - err = dsa_switch_master_state_change(ds, info);
> + err = dsa_switch_conduit_state_change(ds, info);
> break;
> default:
> err = -EOPNOTSUPP;
> diff --git a/net/dsa/tag.h b/net/dsa/tag.h
> index 32d12f4a9d73..f6b9c73718df 100644
> --- a/net/dsa/tag.h
> +++ b/net/dsa/tag.h
> @@ -9,7 +9,7 @@
> #include <net/dsa.h>
>
> #include "port.h"
> -#include "slave.h"
> +#include "user.h"
>
> struct dsa_tag_driver {
> const struct dsa_device_ops *ops;
> @@ -29,7 +29,7 @@ static inline int dsa_tag_protocol_overhead(const struct dsa_device_ops *ops)
> return ops->needed_headroom + ops->needed_tailroom;
> }
>
> -static inline struct net_device *dsa_master_find_slave(struct net_device *dev,
> +static inline struct net_device *dsa_conduit_find_user(struct net_device *dev,
> int device, int port)

Please adjust alignment.

> {
> struct dsa_port *cpu_dp = dev->dsa_ptr;
> diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
> index cbdfc392f7e0..71b26ae6db39 100644
> --- a/net/dsa/tag_8021q.c
> +++ b/net/dsa/tag_8021q.c
> @@ -468,10 +468,10 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
> }
> EXPORT_SYMBOL_GPL(dsa_8021q_xmit);
>
> -struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
> +struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *conduit,
> int vbid)

Alignment.

> {
> - struct dsa_port *cpu_dp = master->dsa_ptr;
> + struct dsa_port *cpu_dp = conduit->dsa_ptr;
> struct dsa_switch_tree *dst = cpu_dp->dst;
> struct dsa_port *dp;
>
> diff --git a/net/dsa/tag_8021q.h b/net/dsa/tag_8021q.h
> index b75cbaa028ef..41f7167ac520 100644
> --- a/net/dsa/tag_8021q.h
> +++ b/net/dsa/tag_8021q.h
> @@ -16,7 +16,7 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
> void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
> int *vbid);
>
> -struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
> +struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *conduit,
> int vbid);

Alignment.

> diff --git a/net/dsa/slave.c b/net/dsa/user.c
> similarity index 62%
> rename from net/dsa/slave.c
> rename to net/dsa/user.c
> index 4c3e502d7e16..c03e41e4e660 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/user.c
> @@ -2898,15 +2898,15 @@ static int dsa_slave_prechangeupper(struct net_device *dev,
> else if (netif_is_lag_master(info->upper_dev) && !info->linking)
> dsa_port_pre_lag_leave(dp, info->upper_dev);
> /* dsa_port_pre_hsr_leave is not yet necessary since hsr cannot be
> - * meaningfully enslaved to a bridge yet
> + * meaningfully enuserd to a bridge yet

"cannot be meaningfully be placed under a bridge yet"

> */
>
> return NOTIFY_DONE;
> }
>
> static int
> -dsa_slave_lag_changeupper(struct net_device *dev,
> - struct netdev_notifier_changeupper_info *info)
> +dsa_user_lag_changeupper(struct net_device *dev,
> + struct netdev_notifier_changeupper_info *info)
> {
> struct net_device *lower;
> struct list_head *iter;
> @@ -2991,7 +2991,7 @@ dsa_prevent_bridging_8021q_upper(struct net_device *dev,
> if (br_vlan_enabled(br) &&
> netif_is_bridge_master(info->upper_dev) && info->linking) {
> NL_SET_ERR_MSG_MOD(ext_ack,
> - "Cannot enslave VLAN device into VLAN aware bridge");
> + "Cannot enuser VLAN device into VLAN aware bridge");

"Cannot make VLAN device join VLAN-aware bridge"

> return notifier_from_errno(-EINVAL);
> }
>
> @@ -3050,17 +3050,17 @@ dsa_slave_prechangeupper_sanity_check(struct net_device *dev,
> }
>
> if (is_vlan_dev(info->upper_dev))
> - return dsa_slave_check_8021q_upper(dev, info);
> + return dsa_user_check_8021q_upper(dev, info);
>
> return NOTIFY_DONE;
> }
>
> -/* To be eligible as a DSA master, a LAG must have all lower interfaces be
> - * eligible DSA masters. Additionally, all LAG slaves must be DSA masters of
> +/* To be eligible as a DSA conduit, a LAG must have all lower interfaces be
> + * eligible DSA conduits. Additionally, all LAG users must be DSA conduits of

"Additionally, all LAG slaves" should not be replaced with "users".
"Lowers", "ports" or "slaves", preferably leaving it as "slaves" because
it isn't the topic of this patch.

> * switches in the same switch tree.
> */
> -static int dsa_lag_master_validate(struct net_device *lag_dev,
> - struct netlink_ext_ack *extack)
> +static int dsa_lag_conduit_validate(struct net_device *lag_dev,
> + struct netlink_ext_ack *extack)
> {
> struct net_device *lower1, *lower2;
> struct list_head *iter1, *iter2;
> diff --git a/net/dsa/user.h b/net/dsa/user.h
> new file mode 100644
> index 000000000000..425ed9257858
> --- /dev/null
> +++ b/net/dsa/user.h
> @@ -0,0 +1,69 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef __DSA_OPERATIVE_H
> +#define __DSA_OPERATIVE_H

__DSA_USER_H

> +
> +#include <linux/if_bridge.h>
> +#include <linux/if_vlan.h>
> +#include <linux/list.h>
> +#include <linux/netpoll.h>
> +#include <linux/types.h>
> +#include <net/dsa.h>
> +#include <net/gro_cells.h>