All of lore.kernel.org
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next 07/15] net: dsa: remove cross-chip support for MRP
Date: Wed, 5 Jan 2022 11:01:52 +0100	[thread overview]
Message-ID: <20220105100152.cnu3zcjmqp6vizer@soft-dev3-1.localhost> (raw)
In-Reply-To: <20220104171413.2293847-8-vladimir.oltean@nxp.com>

The 01/04/2022 19:14, Vladimir Oltean wrote:
> 
> The cross-chip notifiers for MRP are bypass operations, meaning that
> even though all switches in a tree are notified, only the switch
> specified in the info structure is targeted.
> 
> We can eliminate the unnecessary complexity by deleting the cross-chip
> notifier logic and calling the ds->ops straight from port.c.

It looks like structs dsa_notifier_mrp_info and
dsa_notifier_mrp_ring_role_info are not used anywhere anymore. So they
should also be deleted.

> 
> Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  net/dsa/dsa_priv.h |  4 ---
>  net/dsa/port.c     | 44 +++++++++++++++----------------
>  net/dsa/switch.c   | 64 ----------------------------------------------
>  3 files changed, 20 insertions(+), 92 deletions(-)
> 
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index b5ae21f172a8..54c23479b9ba 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -40,10 +40,6 @@ enum {
>         DSA_NOTIFIER_TAG_PROTO,
>         DSA_NOTIFIER_TAG_PROTO_CONNECT,
>         DSA_NOTIFIER_TAG_PROTO_DISCONNECT,
> -       DSA_NOTIFIER_MRP_ADD,
> -       DSA_NOTIFIER_MRP_DEL,
> -       DSA_NOTIFIER_MRP_ADD_RING_ROLE,
> -       DSA_NOTIFIER_MRP_DEL_RING_ROLE,
>         DSA_NOTIFIER_TAG_8021Q_VLAN_ADD,
>         DSA_NOTIFIER_TAG_8021Q_VLAN_DEL,
>  };
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 05677e016982..5c72f890c6a2 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -907,49 +907,45 @@ int dsa_port_vlan_del(struct dsa_port *dp,
>  int dsa_port_mrp_add(const struct dsa_port *dp,
>                      const struct switchdev_obj_mrp *mrp)
>  {
> -       struct dsa_notifier_mrp_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .mrp = mrp,
> -       };
> +       struct dsa_switch *ds = dp->ds;
> +
> +       if (!ds->ops->port_mrp_add)
> +               return -EOPNOTSUPP;
> 
> -       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD, &info);
> +       return ds->ops->port_mrp_add(ds, dp->index, mrp);
>  }
> 
>  int dsa_port_mrp_del(const struct dsa_port *dp,
>                      const struct switchdev_obj_mrp *mrp)
>  {
> -       struct dsa_notifier_mrp_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .mrp = mrp,
> -       };
> +       struct dsa_switch *ds = dp->ds;
> +
> +       if (!ds->ops->port_mrp_del)
> +               return -EOPNOTSUPP;
> 
> -       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL, &info);
> +       return ds->ops->port_mrp_del(ds, dp->index, mrp);
>  }
> 
>  int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
>                                const struct switchdev_obj_ring_role_mrp *mrp)
>  {
> -       struct dsa_notifier_mrp_ring_role_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .mrp = mrp,
> -       };
> +       struct dsa_switch *ds = dp->ds;
> +
> +       if (!ds->ops->port_mrp_add)
> +               return -EOPNOTSUPP;
> 
> -       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD_RING_ROLE, &info);
> +       return ds->ops->port_mrp_add_ring_role(ds, dp->index, mrp);
>  }
> 
>  int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
>                                const struct switchdev_obj_ring_role_mrp *mrp)
>  {
> -       struct dsa_notifier_mrp_ring_role_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .mrp = mrp,
> -       };
> +       struct dsa_switch *ds = dp->ds;
> +
> +       if (!ds->ops->port_mrp_del)
> +               return -EOPNOTSUPP;
> 
> -       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL_RING_ROLE, &info);
> +       return ds->ops->port_mrp_del_ring_role(ds, dp->index, mrp);
>  }
> 
>  void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,
> diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> index 393f2d8a860a..a164ec02b4e9 100644
> --- a/net/dsa/switch.c
> +++ b/net/dsa/switch.c
> @@ -701,58 +701,6 @@ dsa_switch_disconnect_tag_proto(struct dsa_switch *ds,
>         return 0;
>  }
> 
> -static int dsa_switch_mrp_add(struct dsa_switch *ds,
> -                             struct dsa_notifier_mrp_info *info)
> -{
> -       if (!ds->ops->port_mrp_add)
> -               return -EOPNOTSUPP;
> -
> -       if (ds->index == info->sw_index)
> -               return ds->ops->port_mrp_add(ds, info->port, info->mrp);
> -
> -       return 0;
> -}
> -
> -static int dsa_switch_mrp_del(struct dsa_switch *ds,
> -                             struct dsa_notifier_mrp_info *info)
> -{
> -       if (!ds->ops->port_mrp_del)
> -               return -EOPNOTSUPP;
> -
> -       if (ds->index == info->sw_index)
> -               return ds->ops->port_mrp_del(ds, info->port, info->mrp);
> -
> -       return 0;
> -}
> -
> -static int
> -dsa_switch_mrp_add_ring_role(struct dsa_switch *ds,
> -                            struct dsa_notifier_mrp_ring_role_info *info)
> -{
> -       if (!ds->ops->port_mrp_add)
> -               return -EOPNOTSUPP;
> -
> -       if (ds->index == info->sw_index)
> -               return ds->ops->port_mrp_add_ring_role(ds, info->port,
> -                                                      info->mrp);
> -
> -       return 0;
> -}
> -
> -static int
> -dsa_switch_mrp_del_ring_role(struct dsa_switch *ds,
> -                            struct dsa_notifier_mrp_ring_role_info *info)
> -{
> -       if (!ds->ops->port_mrp_del)
> -               return -EOPNOTSUPP;
> -
> -       if (ds->index == info->sw_index)
> -               return ds->ops->port_mrp_del_ring_role(ds, info->port,
> -                                                      info->mrp);
> -
> -       return 0;
> -}
> -
>  static int dsa_switch_event(struct notifier_block *nb,
>                             unsigned long event, void *info)
>  {
> @@ -826,18 +774,6 @@ static int dsa_switch_event(struct notifier_block *nb,
>         case DSA_NOTIFIER_TAG_PROTO_DISCONNECT:
>                 err = dsa_switch_disconnect_tag_proto(ds, info);
>                 break;
> -       case DSA_NOTIFIER_MRP_ADD:
> -               err = dsa_switch_mrp_add(ds, info);
> -               break;
> -       case DSA_NOTIFIER_MRP_DEL:
> -               err = dsa_switch_mrp_del(ds, info);
> -               break;
> -       case DSA_NOTIFIER_MRP_ADD_RING_ROLE:
> -               err = dsa_switch_mrp_add_ring_role(ds, info);
> -               break;
> -       case DSA_NOTIFIER_MRP_DEL_RING_ROLE:
> -               err = dsa_switch_mrp_del_ring_role(ds, info);
> -               break;
>         case DSA_NOTIFIER_TAG_8021Q_VLAN_ADD:
>                 err = dsa_switch_tag_8021q_vlan_add(ds, info);
>                 break;
> --
> 2.25.1
> 

-- 
/Horatiu

  reply	other threads:[~2022-01-05  9:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 17:13 [PATCH net-next 00/15] DSA miscellaneous cleanups Vladimir Oltean
2022-01-04 17:13 ` [PATCH net-next 01/15] net: dsa: reorder PHY initialization with MTU setup in slave.c Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 02/15] net: dsa: merge rtnl_lock sections in dsa_slave_create Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 03/15] net: dsa: stop updating master MTU from master.c Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 04/15] net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown} Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 05/15] net: dsa: first set up shared ports, then non-shared ports Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 06/15] net: dsa: setup master before ports Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 07/15] net: dsa: remove cross-chip support for MRP Vladimir Oltean
2022-01-05 10:01   ` Horatiu Vultur [this message]
2022-01-05 11:51     ` Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 08/15] net: dsa: remove cross-chip support for HSR Vladimir Oltean
2022-01-04 22:03   ` George McCollister
2022-01-04 22:20     ` Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 09/15] net: dsa: move dsa_port :: stp_state near dsa_port :: mac Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 10/15] net: dsa: merge all bools of struct dsa_port into a single u8 Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 11/15] net: dsa: move dsa_port :: type near dsa_port :: index Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 12/15] net: dsa: merge all bools of struct dsa_switch into a single u32 Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 13/15] net: dsa: make dsa_switch :: num_ports an unsigned int Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 14/15] net: dsa: move dsa_switch_tree :: ports and lags to first cache line Vladimir Oltean
2022-01-04 17:14 ` [PATCH net-next 15/15] net: dsa: combine two holes in struct dsa_switch_tree Vladimir Oltean

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=20220105100152.cnu3zcjmqp6vizer@soft-dev3-1.localhost \
    --to=horatiu.vultur@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.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 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.