Re: [PATCH net-next v7 9/9] net: lan966x: Extend switchdev with fdb support
flat view
From: Horatiu Vultur <horatiu.vultur@microchip.com>
Date: 2021-12-18 12:58:33
Also in:
lkml, netdev
The 12/17/2021 18:12, Vladimir Oltean wrote:
On Fri, Dec 17, 2021 at 04:53:53PM +0100, Horatiu Vultur wrote:quoted
Extend lan966x driver with fdb support by implementing the switchdev calls SWITCHDEV_FDB_ADD_TO_DEVICE and SWITCHDEV_FDB_DEL_TO_DEVICE. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> ---Looks pretty good. Just one question, since I can't figure this out by looking at the code. Is the CPU port in the unknown unicast flood mask currently?
It is not. Because under a bridge can be only lan966x ports so the HW will do already the flooding of the frames.
quoted
.../net/ethernet/microchip/lan966x/Makefile | 2 +- .../ethernet/microchip/lan966x/lan966x_fdb.c | 244 ++++++++++++++++++ .../ethernet/microchip/lan966x/lan966x_main.c | 5 + .../ethernet/microchip/lan966x/lan966x_main.h | 14 + .../microchip/lan966x/lan966x_switchdev.c | 21 ++ .../ethernet/microchip/lan966x/lan966x_vlan.c | 15 +- 6 files changed, 298 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/microchip/lan966x/lan966x_fdb.c(...)quoted
+static void lan966x_fdb_add_entry(struct lan966x *lan966x, + struct switchdev_notifier_fdb_info *fdb_info) +{ + struct lan966x_fdb_entry *fdb_entry; + + fdb_entry = lan966x_fdb_find_entry(lan966x, fdb_info); + if (fdb_entry) { + fdb_entry->references++; + return; + } + + fdb_entry = kzalloc(sizeof(*fdb_entry), GFP_KERNEL); + if (!fdb_entry) + return; + + memcpy(fdb_entry->mac, fdb_info->addr, ETH_ALEN);ether_addr_copyquoted
+ fdb_entry->vid = fdb_info->vid; + fdb_entry->references = 1; + list_add_tail(&fdb_entry->list, &lan966x->fdb_entries); +}
-- /Horatiu