Commit af1fe786 authored by Nir Dotan's avatar Nir Dotan Committed by David S. Miller

mlxsw: spectrum_acl: Add extack messages

Return extack messages for failures in action set creation.
Messages provide reasons for not being able to implement
the action in HW.
Signed-off-by: default avatarNir Dotan <nird@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9c10812a
...@@ -546,11 +546,15 @@ int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, ...@@ -546,11 +546,15 @@ int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
bool in_port; bool in_port;
if (out_dev) { if (out_dev) {
if (!mlxsw_sp_port_dev_check(out_dev)) if (!mlxsw_sp_port_dev_check(out_dev)) {
NL_SET_ERR_MSG_MOD(extack, "Invalid output device");
return -EINVAL; return -EINVAL;
}
mlxsw_sp_port = netdev_priv(out_dev); mlxsw_sp_port = netdev_priv(out_dev);
if (mlxsw_sp_port->mlxsw_sp != mlxsw_sp) if (mlxsw_sp_port->mlxsw_sp != mlxsw_sp) {
NL_SET_ERR_MSG_MOD(extack, "Invalid output device");
return -EINVAL; return -EINVAL;
}
local_port = mlxsw_sp_port->local_port; local_port = mlxsw_sp_port->local_port;
in_port = false; in_port = false;
} else { } else {
...@@ -573,9 +577,10 @@ int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, ...@@ -573,9 +577,10 @@ int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_block_binding *binding; struct mlxsw_sp_acl_block_binding *binding;
struct mlxsw_sp_port *in_port; struct mlxsw_sp_port *in_port;
if (!list_is_singular(&block->binding_list)) if (!list_is_singular(&block->binding_list)) {
NL_SET_ERR_MSG_MOD(extack, "Only a single mirror source is allowed");
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
binding = list_first_entry(&block->binding_list, binding = list_first_entry(&block->binding_list,
struct mlxsw_sp_acl_block_binding, list); struct mlxsw_sp_acl_block_binding, list);
in_port = binding->mlxsw_sp_port; in_port = binding->mlxsw_sp_port;
...@@ -603,6 +608,7 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, ...@@ -603,6 +608,7 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
ethertype = 1; ethertype = 1;
break; break;
default: default:
NL_SET_ERR_MSG_MOD(extack, "Unsupported VLAN protocol");
dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN protocol %#04x\n", dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN protocol %#04x\n",
proto); proto);
return -EINVAL; return -EINVAL;
...@@ -612,6 +618,7 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, ...@@ -612,6 +618,7 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
vid, prio, ethertype, vid, prio, ethertype,
extack); extack);
} else { } else {
NL_SET_ERR_MSG_MOD(extack, "Unsupported VLAN action");
dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN action\n"); dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN action\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment