All of lore.kernel.org
 help / color / mirror / Atom feed
From: George McCollister <george.mccollister@gmail.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev <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 08/15] net: dsa: remove cross-chip support for HSR
Date: Tue, 4 Jan 2022 16:03:56 -0600	[thread overview]
Message-ID: <CAFSKS=N-31qNir6xmj1u2ZR2qjERiqg5qyEtsRebc0ihjr5FRg@mail.gmail.com> (raw)
In-Reply-To: <20220104171413.2293847-9-vladimir.oltean@nxp.com>

On Tue, Jan 4, 2022 at 11:14 AM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> The cross-chip notifiers for HSR 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.
>
> Cc: George McCollister <george.mccollister@gmail.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  net/dsa/dsa_priv.h |  2 --
>  net/dsa/port.c     | 20 ++++++--------------
>  net/dsa/switch.c   | 24 ------------------------
>  3 files changed, 6 insertions(+), 40 deletions(-)
>
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 54c23479b9ba..b3386d408fc6 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -25,8 +25,6 @@ enum {
>         DSA_NOTIFIER_FDB_DEL,
>         DSA_NOTIFIER_HOST_FDB_ADD,
>         DSA_NOTIFIER_HOST_FDB_DEL,
> -       DSA_NOTIFIER_HSR_JOIN,
> -       DSA_NOTIFIER_HSR_LEAVE,
>         DSA_NOTIFIER_LAG_CHANGE,
>         DSA_NOTIFIER_LAG_JOIN,
>         DSA_NOTIFIER_LAG_LEAVE,
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 5c72f890c6a2..9e7c421c47b9 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -1317,16 +1317,12 @@ EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count);
>
>  int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
>  {
> -       struct dsa_notifier_hsr_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .hsr = hsr,
> -       };
> +       struct dsa_switch *ds = dp->ds;
>         int err;
>
>         dp->hsr_dev = hsr;
>
> -       err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_JOIN, &info);
> +       err = ds->ops->port_hsr_join(ds, dp->index, hsr);
>         if (err)
>                 dp->hsr_dev = NULL;
>
> @@ -1335,20 +1331,16 @@ int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
>
>  void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr)
>  {
> -       struct dsa_notifier_hsr_info info = {
> -               .sw_index = dp->ds->index,
> -               .port = dp->index,
> -               .hsr = hsr,
> -       };
> +       struct dsa_switch *ds = dp->ds;
>         int err;
>
>         dp->hsr_dev = NULL;
>
> -       err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_LEAVE, &info);
> +       err = ds->ops->port_hsr_leave(ds, dp->index, hsr);
>         if (err)
>                 dev_err(dp->ds->dev,
> -                       "port %d failed to notify DSA_NOTIFIER_HSR_LEAVE: %pe\n",
> -                       dp->index, ERR_PTR(err));
> +                       "port %d failed to leave HSR %s: %pe\n",
> +                       dp->index, hsr->name, ERR_PTR(err));
>  }
>
>  int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast)
> diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> index a164ec02b4e9..e3c7d2627a61 100644
> --- a/net/dsa/switch.c
> +++ b/net/dsa/switch.c
> @@ -437,24 +437,6 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds,
>         return dsa_port_do_fdb_del(dp, info->addr, info->vid);
>  }
>
> -static int dsa_switch_hsr_join(struct dsa_switch *ds,
> -                              struct dsa_notifier_hsr_info *info)
> -{
> -       if (ds->index == info->sw_index && ds->ops->port_hsr_join)
> -               return ds->ops->port_hsr_join(ds, info->port, info->hsr);
> -
> -       return -EOPNOTSUPP;
> -}
> -
> -static int dsa_switch_hsr_leave(struct dsa_switch *ds,
> -                               struct dsa_notifier_hsr_info *info)
> -{
> -       if (ds->index == info->sw_index && ds->ops->port_hsr_leave)
> -               return ds->ops->port_hsr_leave(ds, info->port, info->hsr);
> -
> -       return -EOPNOTSUPP;
> -}
> -
>  static int dsa_switch_lag_change(struct dsa_switch *ds,
>                                  struct dsa_notifier_lag_info *info)
>  {
> @@ -729,12 +711,6 @@ static int dsa_switch_event(struct notifier_block *nb,
>         case DSA_NOTIFIER_HOST_FDB_DEL:
>                 err = dsa_switch_host_fdb_del(ds, info);
>                 break;
> -       case DSA_NOTIFIER_HSR_JOIN:
> -               err = dsa_switch_hsr_join(ds, info);
> -               break;
> -       case DSA_NOTIFIER_HSR_LEAVE:
> -               err = dsa_switch_hsr_leave(ds, info);
> -               break;
>         case DSA_NOTIFIER_LAG_CHANGE:
>                 err = dsa_switch_lag_change(ds, info);
>                 break;
> --
> 2.25.1
>

Looks good.

Reviewed-by: George McCollister <george.mccollister@gmail.com>

  reply	other threads:[~2022-01-04 22:04 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
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 [this message]
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='CAFSKS=N-31qNir6xmj1u2ZR2qjERiqg5qyEtsRebc0ihjr5FRg@mail.gmail.com' \
    --to=george.mccollister@gmail.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.