Commit 9be99f2d authored by Horatiu Vultur's avatar Horatiu Vultur Committed by David S. Miller

net: lan966x: Extend FDB to support also lag

Offload FDB entries when the original device is a lag interface. Because
all the ports under the lag have the same chip id, which is the chip id
of first port, then add the entries only for the first port.
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cabc9d49
...@@ -199,6 +199,34 @@ static void lan966x_fdb_bridge_event_work(struct lan966x_fdb_event_work *fdb_wor ...@@ -199,6 +199,34 @@ static void lan966x_fdb_bridge_event_work(struct lan966x_fdb_event_work *fdb_wor
} }
} }
static void lan966x_fdb_lag_event_work(struct lan966x_fdb_event_work *fdb_work)
{
struct switchdev_notifier_fdb_info *fdb_info;
struct lan966x_port *port;
struct lan966x *lan966x;
if (!lan966x_lag_first_port(fdb_work->orig_dev, fdb_work->dev))
return;
lan966x = fdb_work->lan966x;
port = netdev_priv(fdb_work->dev);
fdb_info = &fdb_work->fdb_info;
switch (fdb_work->event) {
case SWITCHDEV_FDB_ADD_TO_DEVICE:
if (!fdb_info->added_by_user)
break;
lan966x_mac_add_entry(lan966x, port, fdb_info->addr,
fdb_info->vid);
break;
case SWITCHDEV_FDB_DEL_TO_DEVICE:
if (!fdb_info->added_by_user)
break;
lan966x_mac_del_entry(lan966x, fdb_info->addr, fdb_info->vid);
break;
}
}
static void lan966x_fdb_event_work(struct work_struct *work) static void lan966x_fdb_event_work(struct work_struct *work)
{ {
struct lan966x_fdb_event_work *fdb_work = struct lan966x_fdb_event_work *fdb_work =
...@@ -208,6 +236,8 @@ static void lan966x_fdb_event_work(struct work_struct *work) ...@@ -208,6 +236,8 @@ static void lan966x_fdb_event_work(struct work_struct *work)
lan966x_fdb_port_event_work(fdb_work); lan966x_fdb_port_event_work(fdb_work);
else if (netif_is_bridge_master(fdb_work->orig_dev)) else if (netif_is_bridge_master(fdb_work->orig_dev))
lan966x_fdb_bridge_event_work(fdb_work); lan966x_fdb_bridge_event_work(fdb_work);
else if (netif_is_lag_master(fdb_work->orig_dev))
lan966x_fdb_lag_event_work(fdb_work);
kfree(fdb_work->fdb_info.addr); kfree(fdb_work->fdb_info.addr);
kfree(fdb_work); kfree(fdb_work);
......
...@@ -348,6 +348,7 @@ int lan966x_port_prechangeupper(struct net_device *dev, ...@@ -348,6 +348,7 @@ int lan966x_port_prechangeupper(struct net_device *dev,
return err; return err;
switchdev_bridge_port_unoffload(brport_dev, port, NULL, NULL); switchdev_bridge_port_unoffload(brport_dev, port, NULL, NULL);
lan966x_fdb_flush_workqueue(port->lan966x);
} }
return err; return err;
......
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