Commit 0a7fcb78 authored by Paul Blakey's avatar Paul Blakey Committed by Saeed Mahameed

net/mlx5e: Support inner header rewrite with goto action

The hardware supports header rewrite of outer headers only.
To perform header rewrite on inner headers, we must first
decapsulate the packet.

Currently, the hardware decap action is explicitly set by the tc
tunnel_key unset action. However, with goto action the user won't
use the tunnel_key unset action. In addition, header rewrites actions
will not apply to the inner header as done by the software model.

To support this, we will map each tunnel matches seen on a tc rule to
a unique tunnel id, implicity add a decap action on tc chain 0 flows,
and mark the packets with this unique tunnel id. Tunnel matches on
the decapsulated tunnel on later chains will match on this unique id
instead of the actual packet.

We will also use this mapping to restore the tunnel info metadata
on miss.
Signed-off-by: default avatarPaul Blakey <paulb@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarOz Shlomo <ozsh@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 7f2fd0a5
...@@ -81,6 +81,11 @@ struct mlx5_rep_uplink_priv { ...@@ -81,6 +81,11 @@ struct mlx5_rep_uplink_priv {
struct mutex unready_flows_lock; struct mutex unready_flows_lock;
struct list_head unready_flows; struct list_head unready_flows;
struct work_struct reoffload_flows_work; struct work_struct reoffload_flows_work;
/* maps tun_info to a unique id*/
struct mapping_ctx *tunnel_mapping;
/* maps tun_enc_opts to a unique id*/
struct mapping_ctx *tunnel_enc_opts_mapping;
}; };
struct mlx5e_rep_priv { struct mlx5e_rep_priv {
......
...@@ -93,12 +93,15 @@ void mlx5e_tc_reoffload_flows_work(struct work_struct *work); ...@@ -93,12 +93,15 @@ void mlx5e_tc_reoffload_flows_work(struct work_struct *work);
enum mlx5e_tc_attr_to_reg { enum mlx5e_tc_attr_to_reg {
CHAIN_TO_REG, CHAIN_TO_REG,
TUNNEL_TO_REG,
}; };
struct mlx5e_tc_attr_to_reg_mapping { struct mlx5e_tc_attr_to_reg_mapping {
int mfield; /* rewrite field */ int mfield; /* rewrite field */
int moffset; /* offset of mfield */ int moffset; /* offset of mfield */
int mlen; /* bytes to rewrite/match */ int mlen; /* bytes to rewrite/match */
int soffset; /* offset of spec for match */
}; };
extern struct mlx5e_tc_attr_to_reg_mapping mlx5e_tc_attr_to_reg_mappings[]; extern struct mlx5e_tc_attr_to_reg_mapping mlx5e_tc_attr_to_reg_mappings[];
...@@ -114,6 +117,16 @@ struct mlx5e_tc_mod_hdr_acts { ...@@ -114,6 +117,16 @@ struct mlx5e_tc_mod_hdr_acts {
void *actions; void *actions;
}; };
int mlx5e_tc_match_to_reg_set(struct mlx5_core_dev *mdev,
struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts,
enum mlx5e_tc_attr_to_reg type,
u32 data);
void mlx5e_tc_match_to_reg_match(struct mlx5_flow_spec *spec,
enum mlx5e_tc_attr_to_reg type,
u32 data,
u32 mask);
int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev, int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev,
int namespace, int namespace,
struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts); struct mlx5e_tc_mod_hdr_acts *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