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

mlxsw: spectrum_acl: Propagate extack pointer

Propagate extack pointer in order to add extack messages for ACL.
In the follow-up patches, appropriate messages will be added
in various points.
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 3730cf4d
...@@ -753,7 +753,8 @@ mlxsw_afa_vlan_pack(char *payload, ...@@ -753,7 +753,8 @@ mlxsw_afa_vlan_pack(char *payload,
} }
int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block,
u16 vid, u8 pcp, u8 et) u16 vid, u8 pcp, u8 et,
struct netlink_ext_ack *extack)
{ {
char *act = mlxsw_afa_block_append_action(block, char *act = mlxsw_afa_block_append_action(block,
MLXSW_AFA_VLAN_CODE, MLXSW_AFA_VLAN_CODE,
...@@ -953,7 +954,8 @@ mlxsw_afa_block_append_allocated_mirror(struct mlxsw_afa_block *block, ...@@ -953,7 +954,8 @@ mlxsw_afa_block_append_allocated_mirror(struct mlxsw_afa_block *block,
int int
mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block, u8 local_in_port, mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block, u8 local_in_port,
const struct net_device *out_dev, bool ingress) const struct net_device *out_dev, bool ingress,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_afa_mirror *mirror; struct mlxsw_afa_mirror *mirror;
int err; int err;
...@@ -1015,7 +1017,8 @@ mlxsw_afa_forward_pack(char *payload, enum mlxsw_afa_forward_type type, ...@@ -1015,7 +1017,8 @@ mlxsw_afa_forward_pack(char *payload, enum mlxsw_afa_forward_type type,
} }
int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
u8 local_port, bool in_port) u8 local_port, bool in_port,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref; struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref;
u32 kvdl_index; u32 kvdl_index;
...@@ -1096,7 +1099,8 @@ int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block, ...@@ -1096,7 +1099,8 @@ int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block,
EXPORT_SYMBOL(mlxsw_afa_block_append_allocated_counter); EXPORT_SYMBOL(mlxsw_afa_block_append_allocated_counter);
int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block,
u32 *p_counter_index) u32 *p_counter_index,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_afa_counter *counter; struct mlxsw_afa_counter *counter;
u32 counter_index; u32 counter_index;
...@@ -1153,7 +1157,8 @@ static inline void mlxsw_afa_virfwd_pack(char *payload, ...@@ -1153,7 +1157,8 @@ static inline void mlxsw_afa_virfwd_pack(char *payload,
mlxsw_afa_virfwd_fid_set(payload, fid); mlxsw_afa_virfwd_fid_set(payload, fid);
} }
int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid) int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid,
struct netlink_ext_ack *extack)
{ {
char *act = mlxsw_afa_block_append_action(block, char *act = mlxsw_afa_block_append_action(block,
MLXSW_AFA_VIRFWD_CODE, MLXSW_AFA_VIRFWD_CODE,
......
...@@ -80,16 +80,21 @@ int mlxsw_afa_block_append_trap_and_forward(struct mlxsw_afa_block *block, ...@@ -80,16 +80,21 @@ int mlxsw_afa_block_append_trap_and_forward(struct mlxsw_afa_block *block,
int mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block,
u8 local_in_port, u8 local_in_port,
const struct net_device *out_dev, const struct net_device *out_dev,
bool ingress); bool ingress,
struct netlink_ext_ack *extack);
int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
u8 local_port, bool in_port); u8 local_port, bool in_port,
struct netlink_ext_ack *extack);
int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block,
u16 vid, u8 pcp, u8 et); u16 vid, u8 pcp, u8 et,
struct netlink_ext_ack *extack);
int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block,
u32 counter_index); u32 counter_index);
int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block,
u32 *p_counter_index); u32 *p_counter_index,
int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid); struct netlink_ext_ack *extack);
int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid,
struct netlink_ext_ack *extack);
int mlxsw_afa_block_append_mcrouter(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_mcrouter(struct mlxsw_afa_block *block,
u16 expected_irif, u16 min_mtu, u16 expected_irif, u16 min_mtu,
bool rmid_valid, u32 kvdl_index); bool rmid_valid, u32 kvdl_index);
......
...@@ -571,25 +571,30 @@ int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei); ...@@ -571,25 +571,30 @@ int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei);
int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
struct mlxsw_sp_acl_block *block, struct mlxsw_sp_acl_block *block,
struct net_device *out_dev); struct net_device *out_dev,
struct netlink_ext_ack *extack);
int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
struct net_device *out_dev); struct net_device *out_dev,
struct netlink_ext_ack *extack);
int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
u32 action, u16 vid, u16 proto, u8 prio); u32 action, u16 vid, u16 proto, u8 prio,
struct netlink_ext_ack *extack);
int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei); struct mlxsw_sp_acl_rule_info *rulei,
struct netlink_ext_ack *extack);
int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
u16 fid); u16 fid, struct netlink_ext_ack *extack);
struct mlxsw_sp_acl_rule; struct mlxsw_sp_acl_rule;
struct mlxsw_sp_acl_rule * struct mlxsw_sp_acl_rule *
mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_ruleset *ruleset, struct mlxsw_sp_acl_ruleset *ruleset,
unsigned long cookie); unsigned long cookie,
struct netlink_ext_ack *extack);
void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule *rule); struct mlxsw_sp_acl_rule *rule);
int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp,
......
...@@ -538,7 +538,8 @@ int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei) ...@@ -538,7 +538,8 @@ int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei)
int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
struct net_device *out_dev) struct net_device *out_dev,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_sp_port *mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port;
u8 local_port; u8 local_port;
...@@ -560,13 +561,14 @@ int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, ...@@ -560,13 +561,14 @@ int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
in_port = true; in_port = true;
} }
return mlxsw_afa_block_append_fwd(rulei->act_block, return mlxsw_afa_block_append_fwd(rulei->act_block,
local_port, in_port); local_port, in_port, extack);
} }
int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
struct mlxsw_sp_acl_block *block, struct mlxsw_sp_acl_block *block,
struct net_device *out_dev) struct net_device *out_dev,
struct netlink_ext_ack *extack)
{ {
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;
...@@ -581,12 +583,14 @@ int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, ...@@ -581,12 +583,14 @@ int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp,
return mlxsw_afa_block_append_mirror(rulei->act_block, return mlxsw_afa_block_append_mirror(rulei->act_block,
in_port->local_port, in_port->local_port,
out_dev, out_dev,
binding->ingress); binding->ingress,
extack);
} }
int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
u32 action, u16 vid, u16 proto, u8 prio) u32 action, u16 vid, u16 proto, u8 prio,
struct netlink_ext_ack *extack)
{ {
u8 ethertype; u8 ethertype;
...@@ -605,7 +609,8 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, ...@@ -605,7 +609,8 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
} }
return mlxsw_afa_block_append_vlan_modify(rulei->act_block, return mlxsw_afa_block_append_vlan_modify(rulei->act_block,
vid, prio, ethertype); vid, prio, ethertype,
extack);
} else { } else {
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;
...@@ -613,23 +618,25 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, ...@@ -613,23 +618,25 @@ int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
} }
int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei) struct mlxsw_sp_acl_rule_info *rulei,
struct netlink_ext_ack *extack)
{ {
return mlxsw_afa_block_append_counter(rulei->act_block, return mlxsw_afa_block_append_counter(rulei->act_block,
&rulei->counter_index); &rulei->counter_index, extack);
} }
int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
u16 fid) u16 fid, struct netlink_ext_ack *extack)
{ {
return mlxsw_afa_block_append_fid_set(rulei->act_block, fid); return mlxsw_afa_block_append_fid_set(rulei->act_block, fid, extack);
} }
struct mlxsw_sp_acl_rule * struct mlxsw_sp_acl_rule *
mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_ruleset *ruleset, struct mlxsw_sp_acl_ruleset *ruleset,
unsigned long cookie) unsigned long cookie,
struct netlink_ext_ack *extack)
{ {
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
struct mlxsw_sp_acl_rule *rule; struct mlxsw_sp_acl_rule *rule;
......
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_block *block, struct mlxsw_sp_acl_block *block,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
struct tcf_exts *exts) struct tcf_exts *exts,
struct netlink_ext_ack *extack)
{ {
const struct tc_action *a; const struct tc_action *a;
LIST_HEAD(actions); LIST_HEAD(actions);
...@@ -58,7 +59,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -58,7 +59,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
return 0; return 0;
/* Count action is inserted first */ /* Count action is inserted first */
err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei); err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack);
if (err) if (err)
return err; return err;
...@@ -99,20 +100,21 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -99,20 +100,21 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
fid = mlxsw_sp_acl_dummy_fid(mlxsw_sp); fid = mlxsw_sp_acl_dummy_fid(mlxsw_sp);
fid_index = mlxsw_sp_fid_index(fid); fid_index = mlxsw_sp_fid_index(fid);
err = mlxsw_sp_acl_rulei_act_fid_set(mlxsw_sp, rulei, err = mlxsw_sp_acl_rulei_act_fid_set(mlxsw_sp, rulei,
fid_index); fid_index, extack);
if (err) if (err)
return err; return err;
out_dev = tcf_mirred_dev(a); out_dev = tcf_mirred_dev(a);
err = mlxsw_sp_acl_rulei_act_fwd(mlxsw_sp, rulei, err = mlxsw_sp_acl_rulei_act_fwd(mlxsw_sp, rulei,
out_dev); out_dev, extack);
if (err) if (err)
return err; return err;
} else if (is_tcf_mirred_egress_mirror(a)) { } else if (is_tcf_mirred_egress_mirror(a)) {
struct net_device *out_dev = tcf_mirred_dev(a); struct net_device *out_dev = tcf_mirred_dev(a);
err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei, err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
block, out_dev); block, out_dev,
extack);
if (err) if (err)
return err; return err;
} else if (is_tcf_vlan(a)) { } else if (is_tcf_vlan(a)) {
...@@ -123,7 +125,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -123,7 +125,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
return mlxsw_sp_acl_rulei_act_vlan(mlxsw_sp, rulei, return mlxsw_sp_acl_rulei_act_vlan(mlxsw_sp, rulei,
action, vid, action, vid,
proto, prio); proto, prio, extack);
} else { } else {
dev_err(mlxsw_sp->bus_info->dev, "Unsupported action\n"); dev_err(mlxsw_sp->bus_info->dev, "Unsupported action\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -400,7 +402,8 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp, ...@@ -400,7 +402,8 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
if (err) if (err)
return err; return err;
return mlxsw_sp_flower_parse_actions(mlxsw_sp, block, rulei, f->exts); return mlxsw_sp_flower_parse_actions(mlxsw_sp, block, rulei, f->exts,
f->common.extack);
} }
int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp,
...@@ -418,7 +421,8 @@ int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp, ...@@ -418,7 +421,8 @@ int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp,
if (IS_ERR(ruleset)) if (IS_ERR(ruleset))
return PTR_ERR(ruleset); return PTR_ERR(ruleset);
rule = mlxsw_sp_acl_rule_create(mlxsw_sp, ruleset, f->cookie); rule = mlxsw_sp_acl_rule_create(mlxsw_sp, ruleset, f->cookie,
f->common.extack);
if (IS_ERR(rule)) { if (IS_ERR(rule)) {
err = PTR_ERR(rule); err = PTR_ERR(rule);
goto err_rule_create; goto err_rule_create;
......
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