2022-08-17 19:54:24

by Horatiu Vultur

[permalink] [raw]
Subject: [PATCH net-next v4 0/8] net: lan966x: Add lag support

Add lag support for lan966x.
First 4 patches don't do any changes to the current behaviour, they
just prepare for lag support. While the rest is to add the lag support.

v3->v4:
- aggregation configuration is global for all bonds, so make sure that
there can't be enabled multiple configurations at the same time
- return error faster from lan966x_foreign_bridging_check, don't
continue the search if the error is seen already
- flush fdb workqueue when a port leaves a bridge or lag.

v2->v3:
- return error code from 'switchdev_bridge_port_offload()'
- fix lan966x_foreign_dev_check(), it was missing lag support
- remove lan966x_lag_mac_add_entry and lan966x_mac_del_entry as
they are not needed
- fix race conditions when accessing port->bond
- move FDB entries when a new port joins the lag if it has a lower

v1->v2:
- fix the LAG PGIDs when ports go down, in this way is not
needed anymore the last patch of the series.

Horatiu Vultur (8):
net: lan966x: Add registers used to configure lag interfaces
net: lan966x: Split lan966x_fdb_event_work
net: lan966x: Flush fdb workqueue when port is leaving a bridge.
net: lan966x: Expose lan966x_switchdev_nb and
lan966x_switchdev_blocking_nb
net: lan966x: Extend lan966x_foreign_bridging_check
net: lan966x: Add lag support for lan966x
net: lan966x: Extend FDB to support also lag
net: lan966x: Extend MAC to support also lag interfaces.

.../net/ethernet/microchip/lan966x/Kconfig | 1 +
.../net/ethernet/microchip/lan966x/Makefile | 2 +-
.../ethernet/microchip/lan966x/lan966x_fdb.c | 155 +++++---
.../ethernet/microchip/lan966x/lan966x_lag.c | 363 ++++++++++++++++++
.../ethernet/microchip/lan966x/lan966x_mac.c | 104 ++++-
.../ethernet/microchip/lan966x/lan966x_main.h | 39 ++
.../ethernet/microchip/lan966x/lan966x_regs.h | 45 +++
.../microchip/lan966x/lan966x_switchdev.c | 138 +++++--
8 files changed, 741 insertions(+), 106 deletions(-)
create mode 100644 drivers/net/ethernet/microchip/lan966x/lan966x_lag.c

--
2.33.0


2022-08-17 19:56:03

by Horatiu Vultur

[permalink] [raw]
Subject: [PATCH net-next v4 3/8] net: lan966x: Flush fdb workqueue when port is leaving a bridge.

Whenever a port leaves a bridge, flush the workqueue of the FDB work.

Signed-off-by: Horatiu Vultur <[email protected]>
---
drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c | 9 +++++----
drivers/net/ethernet/microchip/lan966x/lan966x_main.h | 1 +
.../net/ethernet/microchip/lan966x/lan966x_switchdev.c | 7 ++++---
3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c
index c760f73c0621..5142e7c0de31 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c
@@ -128,6 +128,11 @@ void lan966x_fdb_deinit(struct lan966x *lan966x)
lan966x_fdb_purge_entries(lan966x);
}

+void lan966x_fdb_flush_workqueue(struct lan966x *lan966x)
+{
+ flush_workqueue(lan966x->fdb_work);
+}
+
static void lan966x_fdb_port_event_work(struct lan966x_fdb_event_work *fdb_work)
{
struct switchdev_notifier_fdb_info *fdb_info;
@@ -205,8 +210,6 @@ static void lan966x_fdb_event_work(struct work_struct *work)
lan966x_fdb_bridge_event_work(fdb_work);

kfree(fdb_work->fdb_info.addr);
- dev_put(fdb_work->dev);
- dev_put(fdb_work->orig_dev);
kfree(fdb_work);
}

@@ -244,8 +247,6 @@ int lan966x_handle_fdb(struct net_device *dev,
goto err_addr_alloc;

ether_addr_copy((u8 *)fdb_work->fdb_info.addr, fdb_info->addr);
- dev_hold(dev);
- dev_hold(orig_dev);

queue_work(lan966x->fdb_work, &fdb_work->work);
break;
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
index 2787055c1847..b02c1c803945 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
@@ -369,6 +369,7 @@ void lan966x_fdb_write_entries(struct lan966x *lan966x, u16 vid);
void lan966x_fdb_erase_entries(struct lan966x *lan966x, u16 vid);
int lan966x_fdb_init(struct lan966x *lan966x);
void lan966x_fdb_deinit(struct lan966x *lan966x);
+void lan966x_fdb_flush_workqueue(struct lan966x *lan966x);
int lan966x_handle_fdb(struct net_device *dev,
struct net_device *orig_dev,
unsigned long event, const void *ctx,
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c b/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
index df2bee678559..d9fc6a9a3da1 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
@@ -320,9 +320,10 @@ static int lan966x_port_prechangeupper(struct net_device *dev,
{
struct lan966x_port *port = netdev_priv(dev);

- if (netif_is_bridge_master(info->upper_dev) && !info->linking)
- switchdev_bridge_port_unoffload(port->dev, port,
- NULL, NULL);
+ if (netif_is_bridge_master(info->upper_dev) && !info->linking) {
+ switchdev_bridge_port_unoffload(port->dev, port, NULL, NULL);
+ lan966x_fdb_flush_workqueue(port->lan966x);
+ }

return NOTIFY_DONE;
}
--
2.33.0

2022-08-22 14:04:07

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next v4 0/8] net: lan966x: Add lag support

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <[email protected]>:

On Wed, 17 Aug 2022 21:34:41 +0200 you wrote:
> Add lag support for lan966x.
> First 4 patches don't do any changes to the current behaviour, they
> just prepare for lag support. While the rest is to add the lag support.
>
> v3->v4:
> - aggregation configuration is global for all bonds, so make sure that
> there can't be enabled multiple configurations at the same time
> - return error faster from lan966x_foreign_bridging_check, don't
> continue the search if the error is seen already
> - flush fdb workqueue when a port leaves a bridge or lag.
>
> [...]

Here is the summary with links:
- [net-next,v4,1/8] net: lan966x: Add registers used to configure lag interfaces
https://git.kernel.org/netdev/net-next/c/7c300735a1a1
- [net-next,v4,2/8] net: lan966x: Split lan966x_fdb_event_work
https://git.kernel.org/netdev/net-next/c/9b4ed7d262f3
- [net-next,v4,3/8] net: lan966x: Flush fdb workqueue when port is leaving a bridge.
https://git.kernel.org/netdev/net-next/c/86bac7f11788
- [net-next,v4,4/8] net: lan966x: Expose lan966x_switchdev_nb and lan966x_switchdev_blocking_nb
https://git.kernel.org/netdev/net-next/c/d6208adfc9a9
- [net-next,v4,5/8] net: lan966x: Extend lan966x_foreign_bridging_check
https://git.kernel.org/netdev/net-next/c/a751ea4d74e9
- [net-next,v4,6/8] net: lan966x: Add lag support for lan966x
https://git.kernel.org/netdev/net-next/c/cabc9d49333d
- [net-next,v4,7/8] net: lan966x: Extend FDB to support also lag
https://git.kernel.org/netdev/net-next/c/9be99f2d1d28
- [net-next,v4,8/8] net: lan966x: Extend MAC to support also lag interfaces.
https://git.kernel.org/netdev/net-next/c/e09ce97778e8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html