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

net/mlx5e: TC, Store mapped tunnel id on flow attr



In preparation for multiple attr instances the tunnel_id should
be attr specific and not flow specific.

Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
Reviewed-by: default avatarOz Shlomo <ozsh@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 84ba8062
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -492,8 +492,7 @@ del_post_rule(struct mlx5_eswitch *esw, struct mlx5e_sample_flow *sample_flow,
struct mlx5_flow_handle *
mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
			struct mlx5_flow_spec *spec,
			struct mlx5_flow_attr *attr,
			u32 tunnel_id)
			struct mlx5_flow_attr *attr)
{
	struct mlx5e_post_act_handle *post_act_handle = NULL;
	struct mlx5_esw_flow_attr *esw_attr = attr->esw_attr;
@@ -502,6 +501,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
	struct mlx5e_sample_flow *sample_flow;
	struct mlx5e_sample_attr *sample_attr;
	struct mlx5_flow_attr *pre_attr;
	u32 tunnel_id = attr->tunnel_id;
	struct mlx5_eswitch *esw;
	u32 default_tbl_id;
	u32 obj_id;
+2 −4
Original line number Diff line number Diff line
@@ -26,8 +26,7 @@ void mlx5e_tc_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj
struct mlx5_flow_handle *
mlx5e_tc_sample_offload(struct mlx5e_tc_psample *sample_priv,
			struct mlx5_flow_spec *spec,
			struct mlx5_flow_attr *attr,
			u32 tunnel_id);
			struct mlx5_flow_attr *attr);

void
mlx5e_tc_sample_unoffload(struct mlx5e_tc_psample *sample_priv,
@@ -45,8 +44,7 @@ mlx5e_tc_sample_cleanup(struct mlx5e_tc_psample *tc_psample);
static inline struct mlx5_flow_handle *
mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
			struct mlx5_flow_spec *spec,
			struct mlx5_flow_attr *attr,
			u32 tunnel_id)
			struct mlx5_flow_attr *attr)
{ return ERR_PTR(-EOPNOTSUPP); }

static inline void
+1 −3
Original line number Diff line number Diff line
@@ -1871,12 +1871,10 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv,
	 */
	if ((pre_ct_attr->action & MLX5_FLOW_CONTEXT_ACTION_DECAP) &&
	    attr->chain == 0) {
		u32 tun_id = mlx5e_tc_get_flow_tun_id(flow);

		err = mlx5e_tc_match_to_reg_set(priv->mdev, &pre_mod_acts,
						ct_priv->ns_type,
						TUNNEL_TO_REG,
						tun_id);
						attr->tunnel_id);
		if (err) {
			ct_dbg("Failed to set tunnel register mapping");
			goto err_mapping;
+0 −1
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ struct mlx5e_tc_flow {
	struct rcu_head rcu_head;
	struct completion init_done;
	struct completion del_hw_done;
	int tunnel_id; /* the mapped tunnel id of this flow */
	struct mlx5_flow_attr *attr;
};

+4 −10
Original line number Diff line number Diff line
@@ -308,7 +308,6 @@ mlx5e_tc_rule_offload(struct mlx5e_priv *priv,
		      struct mlx5_flow_attr *attr)
{
	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
	u32 tun_id = mlx5e_tc_get_flow_tun_id(flow);

	if (attr->flags & MLX5_ATTR_FLAG_CT) {
		struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts =
@@ -323,7 +322,7 @@ mlx5e_tc_rule_offload(struct mlx5e_priv *priv,
		return mlx5e_add_offloaded_nic_rule(priv, spec, attr);

	if (attr->flags & MLX5_ATTR_FLAG_SAMPLE)
		return mlx5e_tc_sample_offload(get_sample_priv(priv), spec, attr, tun_id);
		return mlx5e_tc_sample_offload(get_sample_priv(priv), spec, attr);

	return mlx5_eswitch_add_offloaded_rule(esw, spec, attr);
}
@@ -1933,7 +1932,7 @@ static int mlx5e_get_flow_tunnel_id(struct mlx5e_priv *priv,
		attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
	}

	flow->tunnel_id = value;
	flow->attr->tunnel_id = value;
	return 0;

err_set:
@@ -1947,8 +1946,8 @@ static int mlx5e_get_flow_tunnel_id(struct mlx5e_priv *priv,

static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow)
{
	u32 enc_opts_id = flow->tunnel_id & ENC_OPTS_BITS_MASK;
	u32 tun_id = flow->tunnel_id >> ENC_OPTS_BITS;
	u32 enc_opts_id = flow->attr->tunnel_id & ENC_OPTS_BITS_MASK;
	u32 tun_id = flow->attr->tunnel_id >> ENC_OPTS_BITS;
	struct mlx5_rep_uplink_priv *uplink_priv;
	struct mlx5e_rep_priv *uplink_rpriv;
	struct mlx5_eswitch *esw;
@@ -1964,11 +1963,6 @@ static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow)
			       enc_opts_id);
}

u32 mlx5e_tc_get_flow_tun_id(struct mlx5e_tc_flow *flow)
{
	return flow->tunnel_id;
}

void mlx5e_tc_set_ethertype(struct mlx5_core_dev *mdev,
			    struct flow_match_basic *match, bool outer,
			    void *headers_c, void *headers_v)
Loading