mlxsw: spectrum: Add extack messages to VXLAN FDB rejection

Annotate the rejections in mlxsw_sp_switchdev_vxlan_work_prepare() with
textual reasons.

Because this code ends up being invoked for FDB replay as well, drop the
default message from there, so that the more accurate error message is
not overwritten.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Petr Machata 2019-01-16 23:06:58 +00:00 committed by David S. Miller
parent 6685987c29
commit a40313d956
2 changed files with 19 additions and 10 deletions

View File

@ -842,10 +842,8 @@ int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,
nve->config = config;
err = ops->fdb_replay(params->dev, params->vni, extack);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to offload the FDB");
if (err)
goto err_fdb_replay;
}
return 0;

View File

@ -3099,23 +3099,34 @@ mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *
struct vxlan_dev *vxlan = netdev_priv(switchdev_work->dev);
struct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;
struct vxlan_config *cfg = &vxlan->cfg;
struct netlink_ext_ack *extack;
extack = switchdev_notifier_info_to_extack(info);
vxlan_fdb_info = container_of(info,
struct switchdev_notifier_vxlan_fdb_info,
info);
if (vxlan_fdb_info->remote_port != cfg->dst_port)
if (vxlan_fdb_info->remote_port != cfg->dst_port) {
NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Non-default remote port is not supported");
return -EOPNOTSUPP;
if (vxlan_fdb_info->remote_vni != cfg->vni)
}
if (vxlan_fdb_info->remote_vni != cfg->vni ||
vxlan_fdb_info->vni != cfg->vni) {
NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Non-default VNI is not supported");
return -EOPNOTSUPP;
if (vxlan_fdb_info->vni != cfg->vni)
}
if (vxlan_fdb_info->remote_ifindex) {
NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Local interface is not supported");
return -EOPNOTSUPP;
if (vxlan_fdb_info->remote_ifindex)
}
if (is_multicast_ether_addr(vxlan_fdb_info->eth_addr)) {
NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Multicast MAC addresses not supported");
return -EOPNOTSUPP;
if (is_multicast_ether_addr(vxlan_fdb_info->eth_addr))
return -EOPNOTSUPP;
if (vxlan_addr_multicast(&vxlan_fdb_info->remote_ip))
}
if (vxlan_addr_multicast(&vxlan_fdb_info->remote_ip)) {
NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Multicast destination IP is not supported");
return -EOPNOTSUPP;
}
switchdev_work->vxlan_fdb_info = *vxlan_fdb_info;