Commit df990477 authored by Roi Dayan's avatar Roi Dayan Committed by Saeed Mahameed
Browse files

net/mlx5e: TC, Move common flow_action checks into function



Remove duplicate checks on flow_action by using common function.

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 70a140ea
Loading
Loading
Loading
Loading
+24 −20
Original line number Original line Diff line number Diff line
@@ -3445,18 +3445,9 @@ actions_prepare_mod_hdr_actions(struct mlx5e_priv *priv,
}
}


static int
static int
parse_tc_nic_actions(struct mlx5e_priv *priv,
flow_action_supported(struct flow_action *flow_action,
		     struct flow_action *flow_action,
		     struct mlx5e_tc_flow *flow,
		      struct netlink_ext_ack *extack)
		      struct netlink_ext_ack *extack)
{
{
	struct mlx5e_tc_flow_parse_attr *parse_attr;
	struct mlx5_flow_attr *attr = flow->attr;
	struct pedit_headers_action hdrs[2] = {};
	const struct flow_action_entry *act;
	struct mlx5_nic_flow_attr *nic_attr;
	int err, i;

	if (!flow_action_has_entries(flow_action)) {
	if (!flow_action_has_entries(flow_action)) {
		NL_SET_ERR_MSG_MOD(extack, "Flow action doesn't have any entries");
		NL_SET_ERR_MSG_MOD(extack, "Flow action doesn't have any entries");
		return -EINVAL;
		return -EINVAL;
@@ -3468,6 +3459,26 @@ parse_tc_nic_actions(struct mlx5e_priv *priv,
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}


	return 0;
}

static int
parse_tc_nic_actions(struct mlx5e_priv *priv,
		     struct flow_action *flow_action,
		     struct mlx5e_tc_flow *flow,
		     struct netlink_ext_ack *extack)
{
	struct mlx5e_tc_flow_parse_attr *parse_attr;
	struct mlx5_flow_attr *attr = flow->attr;
	struct pedit_headers_action hdrs[2] = {};
	const struct flow_action_entry *act;
	struct mlx5_nic_flow_attr *nic_attr;
	int err, i;

	err = flow_action_supported(flow_action, extack);
	if (err)
		return err;

	nic_attr = attr->nic_attr;
	nic_attr = attr->nic_attr;
	nic_attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
	nic_attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
	parse_attr = attr->parse_attr;
	parse_attr = attr->parse_attr;
@@ -3883,16 +3894,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
	bool ptype_host = false;
	bool ptype_host = false;
	bool mpls_push = false;
	bool mpls_push = false;


	if (!flow_action_has_entries(flow_action)) {
	err = flow_action_supported(flow_action, extack);
		NL_SET_ERR_MSG_MOD(extack, "Flow action doesn't have any entries");
	if (err)
		return -EINVAL;
		return err;
	}

	if (!flow_action_hw_stats_check(flow_action, extack,
					FLOW_ACTION_HW_STATS_DELAYED_BIT)) {
		NL_SET_ERR_MSG_MOD(extack, "Flow action HW stats type is not supported");
		return -EOPNOTSUPP;
	}


	esw_attr = attr->esw_attr;
	esw_attr = attr->esw_attr;
	parse_attr = attr->parse_attr;
	parse_attr = attr->parse_attr;