mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 22:42:10 +00:00
switchdev: Add extack argument to call_switchdev_notifiers()
A follow-up patch will enable vetoing of FDB entries. Make it possible to communicate details of why an FDB entry is not acceptable back to the user. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4c59b7d160
commit
6685987c29
10 changed files with 24 additions and 19 deletions
|
@ -196,7 +196,7 @@ The switch device will learn/forget source MAC address/VLAN on ingress packets
|
||||||
and notify the switch driver of the mac/vlan/port tuples. The switch driver,
|
and notify the switch driver of the mac/vlan/port tuples. The switch driver,
|
||||||
in turn, will notify the bridge driver using the switchdev notifier call:
|
in turn, will notify the bridge driver using the switchdev notifier call:
|
||||||
|
|
||||||
err = call_switchdev_notifiers(val, dev, info);
|
err = call_switchdev_notifiers(val, dev, info, extack);
|
||||||
|
|
||||||
Where val is SWITCHDEV_FDB_ADD when learning and SWITCHDEV_FDB_DEL when
|
Where val is SWITCHDEV_FDB_ADD when learning and SWITCHDEV_FDB_DEL when
|
||||||
forgetting, and info points to a struct switchdev_notifier_fdb_info. On
|
forgetting, and info points to a struct switchdev_notifier_fdb_info. On
|
||||||
|
|
|
@ -7294,7 +7294,8 @@ static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
|
||||||
|
|
||||||
info.addr = mac;
|
info.addr = mac;
|
||||||
info.vid = vid;
|
info.vid = vid;
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE, dev, &info.info);
|
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE, dev, &info.info,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_vlan_ops = {
|
static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_vlan_ops = {
|
||||||
|
@ -7381,7 +7382,8 @@ static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
|
||||||
|
|
||||||
info.addr = mac;
|
info.addr = mac;
|
||||||
info.vid = 0;
|
info.vid = 0;
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE, dev, &info.info);
|
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE, dev, &info.info,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_fid_ops = {
|
static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_fid_ops = {
|
||||||
|
|
|
@ -2443,7 +2443,7 @@ static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,
|
||||||
ether_addr_copy(info.eth_addr, mac);
|
ether_addr_copy(info.eth_addr, mac);
|
||||||
info.vni = vni;
|
info.vni = vni;
|
||||||
info.offloaded = adding;
|
info.offloaded = adding;
|
||||||
call_switchdev_notifiers(type, dev, &info.info);
|
call_switchdev_notifiers(type, dev, &info.info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlxsw_sp_fdb_nve_call_notifiers(struct net_device *dev,
|
static void mlxsw_sp_fdb_nve_call_notifiers(struct net_device *dev,
|
||||||
|
@ -2468,7 +2468,7 @@ mlxsw_sp_fdb_call_notifiers(enum switchdev_notifier_type type,
|
||||||
info.addr = mac;
|
info.addr = mac;
|
||||||
info.vid = vid;
|
info.vid = vid;
|
||||||
info.offloaded = offloaded;
|
info.offloaded = offloaded;
|
||||||
call_switchdev_notifiers(type, dev, &info.info);
|
call_switchdev_notifiers(type, dev, &info.info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
|
static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
|
||||||
|
@ -2819,7 +2819,7 @@ mlxsw_sp_switchdev_bridge_vxlan_fdb_event(struct mlxsw_sp *mlxsw_sp,
|
||||||
return;
|
return;
|
||||||
vxlan_fdb_info.offloaded = true;
|
vxlan_fdb_info.offloaded = true;
|
||||||
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
||||||
&vxlan_fdb_info.info);
|
&vxlan_fdb_info.info, NULL);
|
||||||
mlxsw_sp_fdb_call_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
mlxsw_sp_fdb_call_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
||||||
vxlan_fdb_info.eth_addr,
|
vxlan_fdb_info.eth_addr,
|
||||||
fdb_info->vid, dev, true);
|
fdb_info->vid, dev, true);
|
||||||
|
@ -2832,7 +2832,7 @@ mlxsw_sp_switchdev_bridge_vxlan_fdb_event(struct mlxsw_sp *mlxsw_sp,
|
||||||
false);
|
false);
|
||||||
vxlan_fdb_info.offloaded = false;
|
vxlan_fdb_info.offloaded = false;
|
||||||
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
||||||
&vxlan_fdb_info.info);
|
&vxlan_fdb_info.info, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2977,7 +2977,7 @@ mlxsw_sp_switchdev_vxlan_fdb_add(struct mlxsw_sp *mlxsw_sp,
|
||||||
}
|
}
|
||||||
vxlan_fdb_info->offloaded = true;
|
vxlan_fdb_info->offloaded = true;
|
||||||
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
||||||
&vxlan_fdb_info->info);
|
&vxlan_fdb_info->info, NULL);
|
||||||
mlxsw_sp_fid_put(fid);
|
mlxsw_sp_fid_put(fid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2998,7 +2998,7 @@ mlxsw_sp_switchdev_vxlan_fdb_add(struct mlxsw_sp *mlxsw_sp,
|
||||||
goto err_fdb_tunnel_uc_op;
|
goto err_fdb_tunnel_uc_op;
|
||||||
vxlan_fdb_info->offloaded = true;
|
vxlan_fdb_info->offloaded = true;
|
||||||
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
call_switchdev_notifiers(SWITCHDEV_VXLAN_FDB_OFFLOADED, dev,
|
||||||
&vxlan_fdb_info->info);
|
&vxlan_fdb_info->info, NULL);
|
||||||
mlxsw_sp_fdb_call_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
mlxsw_sp_fdb_call_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
||||||
vxlan_fdb_info->eth_addr, vid, dev, true);
|
vxlan_fdb_info->eth_addr, vid, dev, true);
|
||||||
|
|
||||||
|
|
|
@ -2725,7 +2725,7 @@ rocker_fdb_offload_notify(struct rocker_port *rocker_port,
|
||||||
info.vid = recv_info->vid;
|
info.vid = recv_info->vid;
|
||||||
info.offloaded = true;
|
info.offloaded = true;
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED,
|
||||||
rocker_port->dev, &info.info);
|
rocker_port->dev, &info.info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rocker_switchdev_event_work(struct work_struct *work)
|
static void rocker_switchdev_event_work(struct work_struct *work)
|
||||||
|
|
|
@ -1833,10 +1833,10 @@ static void ofdpa_port_fdb_learn_work(struct work_struct *work)
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
if (learned && removing)
|
if (learned && removing)
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE,
|
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE,
|
||||||
lw->ofdpa_port->dev, &info.info);
|
lw->ofdpa_port->dev, &info.info, NULL);
|
||||||
else if (learned && !removing)
|
else if (learned && !removing)
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
|
call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
|
||||||
lw->ofdpa_port->dev, &info.info);
|
lw->ofdpa_port->dev, &info.info, NULL);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
||||||
kfree(work);
|
kfree(work);
|
||||||
|
|
|
@ -393,7 +393,7 @@ static int vxlan_fdb_switchdev_call_notifiers(struct vxlan_dev *vxlan,
|
||||||
: SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE;
|
: SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE;
|
||||||
vxlan_fdb_switchdev_notifier_info(vxlan, fdb, rd, NULL, &info);
|
vxlan_fdb_switchdev_notifier_info(vxlan, fdb, rd, NULL, &info);
|
||||||
ret = call_switchdev_notifiers(notifier_type, vxlan->dev,
|
ret = call_switchdev_notifiers(notifier_type, vxlan->dev,
|
||||||
&info.info);
|
&info.info, extack);
|
||||||
return notifier_to_errno(ret);
|
return notifier_to_errno(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,8 @@ int switchdev_port_obj_del(struct net_device *dev,
|
||||||
int register_switchdev_notifier(struct notifier_block *nb);
|
int register_switchdev_notifier(struct notifier_block *nb);
|
||||||
int unregister_switchdev_notifier(struct notifier_block *nb);
|
int unregister_switchdev_notifier(struct notifier_block *nb);
|
||||||
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
||||||
struct switchdev_notifier_info *info);
|
struct switchdev_notifier_info *info,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
|
|
||||||
int register_switchdev_blocking_notifier(struct notifier_block *nb);
|
int register_switchdev_blocking_notifier(struct notifier_block *nb);
|
||||||
int unregister_switchdev_blocking_notifier(struct notifier_block *nb);
|
int unregister_switchdev_blocking_notifier(struct notifier_block *nb);
|
||||||
|
@ -267,7 +268,8 @@ static inline int unregister_switchdev_notifier(struct notifier_block *nb)
|
||||||
|
|
||||||
static inline int call_switchdev_notifiers(unsigned long val,
|
static inline int call_switchdev_notifiers(unsigned long val,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
struct switchdev_notifier_info *info)
|
struct switchdev_notifier_info *info,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ br_switchdev_fdb_call_notifiers(bool adding, const unsigned char *mac,
|
||||||
info.added_by_user = added_by_user;
|
info.added_by_user = added_by_user;
|
||||||
info.offloaded = offloaded;
|
info.offloaded = offloaded;
|
||||||
notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE;
|
notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE;
|
||||||
call_switchdev_notifiers(notifier_type, dev, &info.info);
|
call_switchdev_notifiers(notifier_type, dev, &info.info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
|
||||||
}
|
}
|
||||||
fdb_info->offloaded = true;
|
fdb_info->offloaded = true;
|
||||||
call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, dev,
|
call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, dev,
|
||||||
&fdb_info->info);
|
&fdb_info->info, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
||||||
|
|
|
@ -556,10 +556,11 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
|
||||||
* Call all network notifier blocks.
|
* Call all network notifier blocks.
|
||||||
*/
|
*/
|
||||||
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
||||||
struct switchdev_notifier_info *info)
|
struct switchdev_notifier_info *info,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
info->dev = dev;
|
info->dev = dev;
|
||||||
info->extack = NULL;
|
info->extack = extack;
|
||||||
return atomic_notifier_call_chain(&switchdev_notif_chain, val, info);
|
return atomic_notifier_call_chain(&switchdev_notif_chain, val, info);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
|
EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue