From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, petrm@nvidia.com, mlxsw@nvidia.com,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 05/10] mlxsw: spectrum: Move handling of router events to router code
Date: Sun, 8 May 2022 11:08:18 +0300 [thread overview]
Message-ID: <20220508080823.32154-6-idosch@nvidia.com> (raw)
In-Reply-To: <20220508080823.32154-1-idosch@nvidia.com>
From: Petr Machata <petrm@nvidia.com>
The events NETDEV_PRE_CHANGEADDR, NETDEV_CHANGEADDR and NETDEV_CHANGEMTU
have implications for in-ASIC router interface objects, and as such are
handled in the router module. Move the handling from the central dispatcher
in spectrum.c to the new notifier handler in the router module.
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 14 --------------
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 --
.../ethernet/mellanox/mlxsw/spectrum_router.c | 18 ++++++++++++++++--
3 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 367b9b6e040a..afc03ba93826 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -5004,18 +5004,6 @@ static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp,
return 0;
}
-static bool mlxsw_sp_netdevice_event_is_router(unsigned long event)
-{
- switch (event) {
- case NETDEV_PRE_CHANGEADDR:
- case NETDEV_CHANGEADDR:
- case NETDEV_CHANGEMTU:
- return true;
- default:
- return false;
- }
-}
-
static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{
@@ -5040,8 +5028,6 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
else if (mlxsw_sp_netdev_is_ipip_ul(mlxsw_sp, dev))
err = mlxsw_sp_netdevice_ipip_ul_event(mlxsw_sp, dev,
event, ptr);
- else if (mlxsw_sp_netdevice_event_is_router(event))
- err = mlxsw_sp_netdevice_router_port_event(dev, event, ptr);
else if (mlxsw_sp_port_dev_check(dev))
err = mlxsw_sp_netdevice_port_event(dev, dev, event, ptr);
else if (netif_is_lag_master(dev))
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index a20e2a1b8569..983195ee881e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -718,8 +718,6 @@ union mlxsw_sp_l3addr {
int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
struct netlink_ext_ack *extack);
void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
-int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
- unsigned long event, void *ptr);
void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
const struct net_device *macvlan_dev);
int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 01f10200aeaa..d5a8307aecb3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -9438,8 +9438,20 @@ mlxsw_sp_netdevice_offload_xstats_cmd(struct mlxsw_sp *mlxsw_sp,
return err;
}
-int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
- unsigned long event, void *ptr)
+static bool mlxsw_sp_is_router_event(unsigned long event)
+{
+ switch (event) {
+ case NETDEV_PRE_CHANGEADDR:
+ case NETDEV_CHANGEADDR:
+ case NETDEV_CHANGEMTU:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
+ unsigned long event, void *ptr)
{
struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr);
struct mlxsw_sp *mlxsw_sp;
@@ -9557,6 +9569,8 @@ static int mlxsw_sp_router_netdevice_event(struct notifier_block *nb,
if (mlxsw_sp_is_offload_xstats_event(event))
err = mlxsw_sp_netdevice_offload_xstats_cmd(mlxsw_sp, dev,
event, ptr);
+ else if (mlxsw_sp_is_router_event(event))
+ err = mlxsw_sp_netdevice_router_port_event(dev, event, ptr);
else if (mlxsw_sp_is_vrf_event(event, ptr))
err = mlxsw_sp_netdevice_vrf_event(dev, event, ptr);
--
2.35.1
next prev parent reply other threads:[~2022-05-08 8:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-08 8:08 [PATCH net-next 00/10] mlxsw: A dedicated notifier block for router code Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 01/10] mlxsw: spectrum: Tolerate enslaving of various devices to VRF Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 02/10] mlxsw: spectrum_router: Add a dedicated notifier block Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 03/10] mlxsw: spectrum: Move handling of VRF events to router code Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 04/10] mlxsw: spectrum: Move handling of HW stats " Ido Schimmel
2022-05-08 8:08 ` Ido Schimmel [this message]
2022-05-08 8:08 ` [PATCH net-next 06/10] mlxsw: spectrum: Move handling of tunnel " Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 07/10] mlxsw: spectrum: Update a comment Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 08/10] mlxsw: spectrum_router: Take router lock in router notifier handler Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 09/10] selftests: lib: Add a generic helper for obtaining HW stats Ido Schimmel
2022-05-08 8:08 ` [PATCH net-next 10/10] selftests: forwarding: Add a tunnel-based test for L3 " Ido Schimmel
2022-05-08 10:50 ` [PATCH net-next 00/10] mlxsw: A dedicated notifier block for router code 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=20220508080823.32154-6-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.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).