Commit 86bac7f1 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by David S. Miller

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: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b4ed7d2
...@@ -128,6 +128,11 @@ void lan966x_fdb_deinit(struct lan966x *lan966x) ...@@ -128,6 +128,11 @@ void lan966x_fdb_deinit(struct lan966x *lan966x)
lan966x_fdb_purge_entries(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) static void lan966x_fdb_port_event_work(struct lan966x_fdb_event_work *fdb_work)
{ {
struct switchdev_notifier_fdb_info *fdb_info; struct switchdev_notifier_fdb_info *fdb_info;
...@@ -205,8 +210,6 @@ static void lan966x_fdb_event_work(struct work_struct *work) ...@@ -205,8 +210,6 @@ static void lan966x_fdb_event_work(struct work_struct *work)
lan966x_fdb_bridge_event_work(fdb_work); lan966x_fdb_bridge_event_work(fdb_work);
kfree(fdb_work->fdb_info.addr); kfree(fdb_work->fdb_info.addr);
dev_put(fdb_work->dev);
dev_put(fdb_work->orig_dev);
kfree(fdb_work); kfree(fdb_work);
} }
...@@ -244,8 +247,6 @@ int lan966x_handle_fdb(struct net_device *dev, ...@@ -244,8 +247,6 @@ int lan966x_handle_fdb(struct net_device *dev,
goto err_addr_alloc; goto err_addr_alloc;
ether_addr_copy((u8 *)fdb_work->fdb_info.addr, fdb_info->addr); 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); queue_work(lan966x->fdb_work, &fdb_work->work);
break; break;
......
...@@ -369,6 +369,7 @@ void lan966x_fdb_write_entries(struct lan966x *lan966x, u16 vid); ...@@ -369,6 +369,7 @@ void lan966x_fdb_write_entries(struct lan966x *lan966x, u16 vid);
void lan966x_fdb_erase_entries(struct lan966x *lan966x, u16 vid); void lan966x_fdb_erase_entries(struct lan966x *lan966x, u16 vid);
int lan966x_fdb_init(struct lan966x *lan966x); int lan966x_fdb_init(struct lan966x *lan966x);
void lan966x_fdb_deinit(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, int lan966x_handle_fdb(struct net_device *dev,
struct net_device *orig_dev, struct net_device *orig_dev,
unsigned long event, const void *ctx, unsigned long event, const void *ctx,
......
...@@ -320,9 +320,10 @@ static int lan966x_port_prechangeupper(struct net_device *dev, ...@@ -320,9 +320,10 @@ static int lan966x_port_prechangeupper(struct net_device *dev,
{ {
struct lan966x_port *port = netdev_priv(dev); struct lan966x_port *port = netdev_priv(dev);
if (netif_is_bridge_master(info->upper_dev) && !info->linking) if (netif_is_bridge_master(info->upper_dev) && !info->linking) {
switchdev_bridge_port_unoffload(port->dev, port, switchdev_bridge_port_unoffload(port->dev, port, NULL, NULL);
NULL, NULL); lan966x_fdb_flush_workqueue(port->lan966x);
}
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment