Commit 918ed7bf authored by Roi Dayan's avatar Roi Dayan Committed by Saeed Mahameed

net/mlx5e: TC, Split pedit offloads verify from alloc_tc_pedit_action()

Split pedit verify part into a new subfunction for better
maintainability.
Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
Reviewed-by: default avatarOz Shlomo <ozsh@nvidia.com>
Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 09bf9792
...@@ -2993,19 +2993,13 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, ...@@ -2993,19 +2993,13 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
static const struct pedit_headers zero_masks = {}; static const struct pedit_headers zero_masks = {};
static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace, static int verify_offload_pedit_fields(struct mlx5e_priv *priv,
struct mlx5e_tc_flow_parse_attr *parse_attr, struct mlx5e_tc_flow_parse_attr *parse_attr,
u32 *action_flags, struct netlink_ext_ack *extack)
struct netlink_ext_ack *extack)
{ {
struct pedit_headers *cmd_masks; struct pedit_headers *cmd_masks;
int err;
u8 cmd; u8 cmd;
err = offload_pedit_fields(priv, namespace, parse_attr, action_flags, extack);
if (err < 0)
goto out_dealloc_parsed_actions;
for (cmd = 0; cmd < __PEDIT_CMD_MAX; cmd++) { for (cmd = 0; cmd < __PEDIT_CMD_MAX; cmd++) {
cmd_masks = &parse_attr->hdrs[cmd].masks; cmd_masks = &parse_attr->hdrs[cmd].masks;
if (memcmp(cmd_masks, &zero_masks, sizeof(zero_masks))) { if (memcmp(cmd_masks, &zero_masks, sizeof(zero_masks))) {
...@@ -3013,12 +3007,29 @@ static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace, ...@@ -3013,12 +3007,29 @@ static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace,
netdev_warn(priv->netdev, "attempt to offload an unsupported field (cmd %d)\n", cmd); netdev_warn(priv->netdev, "attempt to offload an unsupported field (cmd %d)\n", cmd);
print_hex_dump(KERN_WARNING, "mask: ", DUMP_PREFIX_ADDRESS, print_hex_dump(KERN_WARNING, "mask: ", DUMP_PREFIX_ADDRESS,
16, 1, cmd_masks, sizeof(zero_masks), true); 16, 1, cmd_masks, sizeof(zero_masks), true);
err = -EOPNOTSUPP; return -EOPNOTSUPP;
goto out_dealloc_parsed_actions;
} }
} }
return 0; return 0;
}
static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace,
struct mlx5e_tc_flow_parse_attr *parse_attr,
u32 *action_flags,
struct netlink_ext_ack *extack)
{
int err;
err = offload_pedit_fields(priv, namespace, parse_attr, action_flags, extack);
if (err)
goto out_dealloc_parsed_actions;
err = verify_offload_pedit_fields(priv, parse_attr, extack);
if (err)
goto out_dealloc_parsed_actions;
return 0;
out_dealloc_parsed_actions: out_dealloc_parsed_actions:
mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts); mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts);
......
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