Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c06897a authored by Or Gerlitz's avatar Or Gerlitz Committed by Saeed Mahameed
Browse files

net/mlx5: Add core support for vlan push/pop steering action



Newer NICs (ConnectX-5 and onward) can apply vlan pop or push as an
action taking place during flow steering. Add the core bits for that.

Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent aa24670e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -136,6 +136,8 @@ TRACE_EVENT(mlx5_fs_del_fg,
	{MLX5_FLOW_CONTEXT_ACTION_ENCAP,	 "ENCAP"},\
	{MLX5_FLOW_CONTEXT_ACTION_DECAP,	 "DECAP"},\
	{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR,	 "MOD_HDR"},\
	{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH,	 "VLAN_PUSH"},\
	{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP,	 "VLAN_POP"},\
	{MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}

TRACE_EVENT(mlx5_fs_set_fte,
+0 −3
Original line number Diff line number Diff line
@@ -227,9 +227,6 @@ enum {
	SET_VLAN_INSERT	= BIT(1)
};

#define MLX5_FLOW_CONTEXT_ACTION_VLAN_POP  0x4000
#define MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH 0x8000

struct mlx5_esw_flow_attr {
	struct mlx5_eswitch_rep *in_rep;
	struct mlx5_eswitch_rep *out_rep;
+9 −1
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
		fte->dests_size * MLX5_ST_SZ_BYTES(dest_format_struct);
	u32 out[MLX5_ST_SZ_DW(set_fte_out)] = {0};
	struct mlx5_flow_rule *dst;
	void *in_flow_context;
	void *in_flow_context, *vlan;
	void *in_match_value;
	void *in_dests;
	u32 *in;
@@ -340,11 +340,19 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,

	in_flow_context = MLX5_ADDR_OF(set_fte_in, in, flow_context);
	MLX5_SET(flow_context, in_flow_context, group_id, group_id);

	MLX5_SET(flow_context, in_flow_context, flow_tag, fte->action.flow_tag);
	MLX5_SET(flow_context, in_flow_context, action, fte->action.action);
	MLX5_SET(flow_context, in_flow_context, encap_id, fte->action.encap_id);
	MLX5_SET(flow_context, in_flow_context, modify_header_id,
		 fte->action.modify_id);

	vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan);

	MLX5_SET(vlan, vlan, ethtype, fte->action.vlan.ethtype);
	MLX5_SET(vlan, vlan, vid, fte->action.vlan.vid);
	MLX5_SET(vlan, vlan, prio, fte->action.vlan.prio);

	in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context,
				      match_value);
	memcpy(in_match_value, &fte->val, sizeof(fte->val));
+3 −1
Original line number Diff line number Diff line
@@ -1439,7 +1439,9 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
	if (xored_actions & (MLX5_FLOW_CONTEXT_ACTION_DROP  |
			     MLX5_FLOW_CONTEXT_ACTION_ENCAP |
			     MLX5_FLOW_CONTEXT_ACTION_DECAP |
			     MLX5_FLOW_CONTEXT_ACTION_MOD_HDR))
			     MLX5_FLOW_CONTEXT_ACTION_MOD_HDR  |
			     MLX5_FLOW_CONTEXT_ACTION_VLAN_POP |
			     MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH))
		return true;

	return false;
+7 −0
Original line number Diff line number Diff line
@@ -142,6 +142,12 @@ struct mlx5_flow_group *
mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in);
void mlx5_destroy_flow_group(struct mlx5_flow_group *fg);

struct mlx5_fs_vlan {
        u16 ethtype;
        u16 vid;
        u8  prio;
};

struct mlx5_flow_act {
	u32 action;
	bool has_flow_tag;
@@ -149,6 +155,7 @@ struct mlx5_flow_act {
	u32 encap_id;
	u32 modify_id;
	uintptr_t esp_id;
	struct mlx5_fs_vlan vlan;
};

#define MLX5_DECLARE_FLOW_ACT(name) \
Loading