net: dsa: deduplicate code adding / deleting the port address to fdb
authorMarek Behún <kabel@kernel.org>
Wed, 5 Jun 2024 13:33:28 +0000 (15:33 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Jun 2024 12:48:06 +0000 (13:48 +0100)
commit77f7541248fcfcc79afff68ff9acf1f09ab8e1e4
treef295d98c6f6367a7b698e66ee63ae12e10b606ba
parent395059c52e0104a5e01832f866caa8b15284dd9a
net: dsa: deduplicate code adding / deleting the port address to fdb

The sequence
  if (dsa_switch_supports_uc_filtering(ds))
    dsa_port_standalone_host_fdb_add(dp, addr, 0);
  if (!ether_addr_equal(addr, conduit->dev_addr))
    dev_uc_add(conduit, addr);
is executed both in dsa_user_open() and dsa_user_set_mac_addr().

Its reverse is executed both in dsa_user_close() and
dsa_user_set_mac_addr().

Refactor these sequences into new functions dsa_user_host_uc_install()
and dsa_user_host_uc_uninstall().

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/user.c