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 11/17] mlxsw: spectrum_router: Join RIFs of LAG upper VLANs
Date: Wed, 19 Jul 2023 13:01:26 +0200 [thread overview]
Message-ID: <e7e69b46f4401270be3bb7462ce9ce2b47b9b9e7.1689763089.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1689763088.git.petrm@nvidia.com>
In the following patches, the requirement that ports be only enslaved to
masters without uppers, is going to be relaxed. It will therefore be
necessary to join not only RIF for the immediate LAG, as is currently the
case, but also RIFs for VLAN netdevices upper to the LAG.
In this patch, extend mlxsw_sp_netdevice_router_join_lag() to walk the
uppers of a LAG being joined, and also join any VLAN ones.
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
---
.../ethernet/mellanox/mlxsw/spectrum_router.c | 55 ++++++++++++++++++-
1 file changed, 52 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 18e059e94079..ae2d5e760f1b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -9685,15 +9685,64 @@ mlxsw_sp_port_vid_router_join_existing(struct mlxsw_sp_port *mlxsw_sp_port,
dev, extack);
}
+static void
+mlxsw_sp_port_vid_router_leave(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
+ struct net_device *dev)
+{
+ struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
+
+ mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port,
+ vid);
+ if (WARN_ON(!mlxsw_sp_port_vlan))
+ return;
+
+ __mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
+}
+
static int __mlxsw_sp_router_port_join_lag(struct mlxsw_sp_port *mlxsw_sp_port,
struct net_device *lag_dev,
struct netlink_ext_ack *extack)
{
u16 default_vid = MLXSW_SP_DEFAULT_VID;
+ struct net_device *upper_dev;
+ struct list_head *iter;
+ int done = 0;
+ u16 vid;
+ int err;
- return mlxsw_sp_port_vid_router_join_existing(mlxsw_sp_port,
- default_vid, lag_dev,
- extack);
+ err = mlxsw_sp_port_vid_router_join_existing(mlxsw_sp_port, default_vid,
+ lag_dev, extack);
+ if (err)
+ return err;
+
+ netdev_for_each_upper_dev_rcu(lag_dev, upper_dev, iter) {
+ if (!is_vlan_dev(upper_dev))
+ continue;
+
+ vid = vlan_dev_vlan_id(upper_dev);
+ err = mlxsw_sp_port_vid_router_join_existing(mlxsw_sp_port, vid,
+ upper_dev, extack);
+ if (err)
+ goto err_router_join_dev;
+
+ ++done;
+ }
+
+ return 0;
+
+err_router_join_dev:
+ netdev_for_each_upper_dev_rcu(lag_dev, upper_dev, iter) {
+ if (!is_vlan_dev(upper_dev))
+ continue;
+ if (!done--)
+ break;
+
+ vid = vlan_dev_vlan_id(upper_dev);
+ mlxsw_sp_port_vid_router_leave(mlxsw_sp_port, vid, upper_dev);
+ }
+
+ mlxsw_sp_port_vid_router_leave(mlxsw_sp_port, default_vid, lag_dev);
+ return err;
}
int mlxsw_sp_router_port_join_lag(struct mlxsw_sp_port *mlxsw_sp_port,
--
2.40.1
next prev 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 ` [PATCH net-next 06/17] mlxsw: spectrum: Split a helper out of mlxsw_sp_netdevice_event() Petr Machata
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 ` Petr Machata [this message]
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=e7e69b46f4401270be3bb7462ce9ce2b47b9b9e7.1689763089.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).