Skip to content

Commit 34ca653

Browse files
w1ldptrSaeed Mahameed
authored andcommitted
net/mlx5: E-Switch, Indirect table infrastructure
Indirect table infrastructure is used to allow fully processing VF tunnel traffic in hardware. Kernel software model uses two TC rules for such traffic: UL rep to tunnel device, then tunnel VF rep to destination VF rep. To implement such pipeline driver needs to program the hardware after matching on UL rule to overwrite source vport from UL to tunnel VF and recirculate the packet to the root table to allow matching on the rule installed on tunnel VF. For this indirect table matches all encapsulated traffic by tunnel parameters and all other IP traffic is sent to tunnel VF by the miss rule. Indirect table API overview: - mlx5_esw_indir_table_{init|destroy}() - init and destroy opaque indirect table object. - mlx5_esw_indir_table_get() - get or create new table according to vport id and IP version. Table has following pre-created groups: recirculation group with match on ethertype and VNI (rules that match encapsulated packets are installed to this group) and forward group with default/miss rule that forwards to vport of tunnel endpoint VF (rule for regular non-encapsulated packets). - mlx5_esw_indir_table_put() - decrease reference to the indirect table and matching rule (for encapsulated traffic). - mlx5_esw_indir_table_needed() - check that in_port is an uplink port and out_port is VF on the same eswitch, verify that the rule is for IP traffic and source port rewrite functionality can be used. - mlx5_esw_indir_table_decap_vport() - function returns decap vport of flow attribute. Co-developed-by: Dmytro Linkin <[email protected]> Signed-off-by: Dmytro Linkin <[email protected]> Signed-off-by: Vlad Buslov <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 6717986 commit 34ca653

File tree

6 files changed

+616
-0
lines changed

6 files changed

+616
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ mlx5_core-$(CONFIG_MLX5_ESWITCH) += lag_mp.o lib/geneve.o lib/port_tun.o \
4040
en_rep.o en/rep/bond.o en/mod_hdr.o
4141
mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en_tc.o en/rep/tc.o en/rep/neigh.o \
4242
en/mapping.o lib/fs_chains.o en/tc_tun.o \
43+
esw/indir_table.o \
4344
en/tc_tun_vxlan.o en/tc_tun_gre.o en/tc_tun_geneve.o \
4445
en/tc_tun_mplsoudp.o diag/en_tc_tracepoint.o
4546
mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o

drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,27 @@ struct mlx5_flow_attr {
7676
struct mlx5_flow_table *dest_ft;
7777
u8 inner_match_level;
7878
u8 outer_match_level;
79+
u8 ip_version;
7980
u32 flags;
8081
union {
8182
struct mlx5_esw_flow_attr esw_attr[0];
8283
struct mlx5_nic_flow_attr nic_attr[0];
8384
};
8485
};
8586

87+
struct mlx5_rx_tun_attr {
88+
u16 decap_vport;
89+
union {
90+
__be32 v4;
91+
struct in6_addr v6;
92+
} src_ip; /* Valid if decap_vport is not zero */
93+
union {
94+
__be32 v4;
95+
struct in6_addr v6;
96+
} dst_ip; /* Valid if decap_vport is not zero */
97+
u32 vni;
98+
};
99+
86100
#define MLX5E_TC_TABLE_CHAIN_TAG_BITS 16
87101
#define MLX5E_TC_TABLE_CHAIN_TAG_MASK GENMASK(MLX5E_TC_TABLE_CHAIN_TAG_BITS - 1, 0)
88102

0 commit comments

Comments
 (0)