mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 15:22:21 -04:00
dpaa2-switch: consolidate unicast and multicast management
This patch consolidates the unicast and multicast management by creating two new functions - dpaa2_switch_port_fdb_[add|del]() - which can be used for either uc or mc addresses. Having this common entrypoint for both types of addresses will help us in the next patches to streamline the same addresses but on LAG ports. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Link: https://patch.msgid.link/20260629112309.154328-8-ioana.ciornei@nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
06840a2363
commit
28b79b5585
@@ -552,6 +552,28 @@ static int dpaa2_switch_port_fdb_del_mc(struct ethsw_port_priv *port_priv,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dpaa2_switch_port_fdb_add(struct ethsw_port_priv *port_priv,
|
||||
const unsigned char *addr)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (is_unicast_ether_addr(addr))
|
||||
err = dpaa2_switch_port_fdb_add_uc(port_priv, addr);
|
||||
else
|
||||
err = dpaa2_switch_port_fdb_add_mc(port_priv, addr);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dpaa2_switch_port_fdb_del(struct ethsw_port_priv *port_priv,
|
||||
const unsigned char *addr)
|
||||
{
|
||||
if (is_unicast_ether_addr(addr))
|
||||
return dpaa2_switch_port_fdb_del_uc(port_priv, addr);
|
||||
else
|
||||
return dpaa2_switch_port_fdb_del_mc(port_priv, addr);
|
||||
}
|
||||
|
||||
static void dpaa2_switch_port_get_stats(struct net_device *netdev,
|
||||
struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
@@ -1880,7 +1902,7 @@ static int dpaa2_switch_port_mdb_add(struct net_device *netdev,
|
||||
{
|
||||
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||
|
||||
return dpaa2_switch_port_fdb_add_mc(port_priv, mdb->addr);
|
||||
return dpaa2_switch_port_fdb_add(port_priv, mdb->addr);
|
||||
}
|
||||
|
||||
static int dpaa2_switch_port_obj_add(struct net_device *netdev,
|
||||
@@ -1984,7 +2006,7 @@ static int dpaa2_switch_port_mdb_del(struct net_device *netdev,
|
||||
{
|
||||
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||
|
||||
return dpaa2_switch_port_fdb_del_mc(port_priv, mdb->addr);
|
||||
return dpaa2_switch_port_fdb_del(port_priv, mdb->addr);
|
||||
}
|
||||
|
||||
static int dpaa2_switch_port_obj_del(struct net_device *netdev,
|
||||
@@ -2325,12 +2347,8 @@ static void dpaa2_switch_event_work(struct work_struct *work)
|
||||
|
||||
switch (switchdev_work->event) {
|
||||
case SWITCHDEV_FDB_ADD_TO_DEVICE:
|
||||
if (is_unicast_ether_addr(fdb_info->addr))
|
||||
err = dpaa2_switch_port_fdb_add_uc(netdev_priv(dev),
|
||||
fdb_info->addr);
|
||||
else
|
||||
err = dpaa2_switch_port_fdb_add_mc(netdev_priv(dev),
|
||||
fdb_info->addr);
|
||||
err = dpaa2_switch_port_fdb_add(netdev_priv(dev),
|
||||
fdb_info->addr);
|
||||
if (err)
|
||||
break;
|
||||
fdb_info->offloaded = true;
|
||||
@@ -2338,10 +2356,7 @@ static void dpaa2_switch_event_work(struct work_struct *work)
|
||||
&fdb_info->info, NULL);
|
||||
break;
|
||||
case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
||||
if (is_unicast_ether_addr(fdb_info->addr))
|
||||
dpaa2_switch_port_fdb_del_uc(netdev_priv(dev), fdb_info->addr);
|
||||
else
|
||||
dpaa2_switch_port_fdb_del_mc(netdev_priv(dev), fdb_info->addr);
|
||||
dpaa2_switch_port_fdb_del(netdev_priv(dev), fdb_info->addr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user