lkml.org 
[lkml]   [2021]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next v7 9/9] net: lan966x: Extend switchdev with fdb support
Date
On Fri, Dec 17, 2021 at 04:53:53PM +0100, Horatiu Vultur wrote:
> 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?

> .../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
(...)
> +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_copy

> + fdb_entry->vid = fdb_info->vid;
> + fdb_entry->references = 1;
> + list_add_tail(&fdb_entry->list, &lan966x->fdb_entries);
> +}
\
 
 \ /
  Last update: 2021-12-17 19:13    [W:0.167 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site