netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	Danielle Ratson <danieller@nvidia.com>, <mlxsw@nvidia.com>
Subject: [PATCH net-next 06/17] mlxsw: spectrum: Split a helper out of mlxsw_sp_netdevice_event()
Date: Wed, 19 Jul 2023 13:01:21 +0200	[thread overview]
Message-ID: <fb0cfe48d8eb3a271ece73f12d2fa00f94818a85.1689763088.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1689763088.git.petrm@nvidia.com>

Move the meat of mlxsw_sp_netdevice_event() to a separate function that
does just the validation. This separate helper will be possible to call
later for recursive ascent when validating attachment of a front panel port
to a bridge with uppers.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
---
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 86e2f0ed64d3..0488fe5695bd 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -5146,21 +5146,18 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
 	return 0;
 }
 
-static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
-				    unsigned long event, void *ptr)
+static int __mlxsw_sp_netdevice_event(struct mlxsw_sp *mlxsw_sp,
+				      unsigned long event, void *ptr)
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct mlxsw_sp_span_entry *span_entry;
-	struct mlxsw_sp *mlxsw_sp;
 	int err = 0;
 
-	mlxsw_sp = container_of(nb, struct mlxsw_sp, netdevice_nb);
 	if (event == NETDEV_UNREGISTER) {
 		span_entry = mlxsw_sp_span_entry_find_by_port(mlxsw_sp, dev);
 		if (span_entry)
 			mlxsw_sp_span_entry_invalidate(mlxsw_sp, span_entry);
 	}
-	mlxsw_sp_span_respin(mlxsw_sp);
 
 	if (netif_is_vxlan(dev))
 		err = mlxsw_sp_netdevice_vxlan_event(mlxsw_sp, dev, event, ptr);
@@ -5175,6 +5172,19 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
 	else if (netif_is_macvlan(dev))
 		err = mlxsw_sp_netdevice_macvlan_event(dev, event, ptr);
 
+	return err;
+}
+
+static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
+				    unsigned long event, void *ptr)
+{
+	struct mlxsw_sp *mlxsw_sp;
+	int err;
+
+	mlxsw_sp = container_of(nb, struct mlxsw_sp, netdevice_nb);
+	mlxsw_sp_span_respin(mlxsw_sp);
+	err = __mlxsw_sp_netdevice_event(mlxsw_sp, event, ptr);
+
 	return notifier_from_errno(err);
 }
 
-- 
2.40.1


  parent reply	other threads:[~2023-07-19 11:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 11:01 [PATCH net-next 00/17] mlxsw: Permit enslavement to netdevices with uppers Petr Machata
2023-07-19 11:01 ` [PATCH net-next 01/17] net: bridge: br_switchdev: Tolerate -EOPNOTSUPP when replaying MDB Petr Machata
2023-07-19 11:01 ` [PATCH net-next 02/17] net: switchdev: Add a helper to replay objects on a bridge port Petr Machata
2024-01-31 15:47   ` Vladimir Oltean
2023-07-19 11:01 ` [PATCH net-next 03/17] selftests: mlxsw: rtnetlink: Drop obsolete tests Petr Machata
2023-07-19 11:01 ` [PATCH net-next 04/17] mlxsw: spectrum_router: Allow address handlers to run on bridge ports Petr Machata
2023-07-19 11:01 ` [PATCH net-next 05/17] mlxsw: spectrum_router: Extract a helper to schedule neighbour work Petr Machata
2023-07-19 11:01 ` Petr Machata [this message]
2023-07-19 11:01 ` [PATCH net-next 07/17] mlxsw: spectrum: Allow event handlers to check unowned bridges Petr Machata
2023-07-19 11:01 ` [PATCH net-next 08/17] mlxsw: spectrum: Add a replay_deslavement argument to event handlers Petr Machata
2023-07-19 11:01 ` [PATCH net-next 09/17] mlxsw: spectrum: On port enslavement to a LAG, join upper's bridges Petr Machata
2023-07-19 11:01 ` [PATCH net-next 10/17] mlxsw: spectrum_switchdev: Replay switchdev objects on port join Petr Machata
2023-07-19 11:01 ` [PATCH net-next 11/17] mlxsw: spectrum_router: Join RIFs of LAG upper VLANs Petr Machata
2023-07-19 11:01 ` [PATCH net-next 12/17] mlxsw: spectrum_router: Offload ethernet nexthops when RIF is made Petr Machata
2023-07-19 11:01 ` [PATCH net-next 13/17] mlxsw: spectrum_router: Replay MACVLANs " Petr Machata
2023-07-19 11:01 ` [PATCH net-next 14/17] mlxsw: spectrum_router: Replay neighbours " Petr Machata
2023-07-19 11:01 ` [PATCH net-next 15/17] mlxsw: spectrum_router: Replay IP NETDEV_UP on device enslavement Petr Machata
2023-07-19 11:01 ` [PATCH net-next 16/17] mlxsw: spectrum_router: Replay IP NETDEV_UP on device deslavement Petr Machata
2023-07-19 11:01 ` [PATCH net-next 17/17] mlxsw: spectrum: Permit enslavement to netdevices with uppers Petr Machata
2023-07-21  8:10 ` [PATCH net-next 00/17] mlxsw: " patchwork-bot+netdevbpf

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=fb0cfe48d8eb3a271ece73f12d2fa00f94818a85.1689763088.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).