Skip to content

Commit 371cf74

Browse files
maorgottliebSaeed Mahameed
authored andcommitted
net/mlx5: Move TTC logic to fs_ttc
Now that TTC logic is not dependent on mlx5e structs, move it to lib/fs_ttc.c so it could be used other part of the mlx5 driver. Signed-off-by: Maor Gottlieb <maorg@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent bc29764 commit 371cf74

7 files changed

Lines changed: 665 additions & 638 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
1515
health.o mcg.o cq.o alloc.o port.o mr.o pd.o \
1616
transobj.o vport.o sriov.o fs_cmd.o fs_core.o pci_irq.o \
1717
fs_counters.o fs_ft_pool.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
18-
lib/devcom.o lib/pci_vsc.o lib/dm.o diag/fs_tracepoint.o \
18+
lib/devcom.o lib/pci_vsc.o lib/dm.o lib/fs_ttc.o diag/fs_tracepoint.o \
1919
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \
2020
fw_reset.o qos.o
2121

‎drivers/net/ethernet/mellanox/mlx5/core/en.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ struct page_pool;
6666
#define MLX5E_METADATA_ETHER_TYPE (0x8CE4)
6767
#define MLX5E_METADATA_ETHER_LEN 8
6868

69-
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
70-
7169
#define MLX5E_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)
7270

7371
#define MLX5E_HW2SW_MTU(params, hwmtu) ((hwmtu) - ((params)->hard_mtu))

‎drivers/net/ethernet/mellanox/mlx5/core/en/fs.h‎

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define __MLX5E_FLOW_STEER_H__
66

77
#include "mod_hdr.h"
8+
#include "lib/fs_ttc.h"
89

910
enum {
1011
MLX5E_TC_FT_LEVEL = 0,
@@ -67,21 +68,6 @@ struct mlx5e_l2_table {
6768
bool promisc_enabled;
6869
};
6970

70-
enum mlx5_traffic_types {
71-
MLX5_TT_IPV4_TCP,
72-
MLX5_TT_IPV6_TCP,
73-
MLX5_TT_IPV4_UDP,
74-
MLX5_TT_IPV6_UDP,
75-
MLX5_TT_IPV4_IPSEC_AH,
76-
MLX5_TT_IPV6_IPSEC_AH,
77-
MLX5_TT_IPV4_IPSEC_ESP,
78-
MLX5_TT_IPV6_IPSEC_ESP,
79-
MLX5_TT_IPV4,
80-
MLX5_TT_IPV6,
81-
MLX5_TT_ANY,
82-
MLX5_NUM_TT,
83-
};
84-
8571
#define MLX5E_NUM_INDIR_TIRS (MLX5_NUM_TT - 1)
8672

8773
#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
@@ -94,32 +80,6 @@ enum mlx5_traffic_types {
9480
MLX5_HASH_FIELD_SEL_DST_IP |\
9581
MLX5_HASH_FIELD_SEL_IPSEC_SPI)
9682

97-
enum mlx5_tunnel_types {
98-
MLX5_TT_IPV4_GRE,
99-
MLX5_TT_IPV6_GRE,
100-
MLX5_TT_IPV4_IPIP,
101-
MLX5_TT_IPV6_IPIP,
102-
MLX5_TT_IPV4_IPV6,
103-
MLX5_TT_IPV6_IPV6,
104-
MLX5_NUM_TUNNEL_TT,
105-
};
106-
107-
bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
108-
109-
struct mlx5_ttc_rule {
110-
struct mlx5_flow_handle *rule;
111-
struct mlx5_flow_destination default_dest;
112-
};
113-
114-
/* L3/L4 traffic type classifier */
115-
struct mlx5_ttc_table {
116-
int num_groups;
117-
struct mlx5_flow_table *t;
118-
struct mlx5_flow_group **g;
119-
struct mlx5_ttc_rule rules[MLX5_NUM_TT];
120-
struct mlx5_flow_handle *tunnel_rules[MLX5_NUM_TUNNEL_TT];
121-
};
122-
12383
/* NIC prio FTS */
12484
enum {
12585
MLX5E_PROMISC_FT_LEVEL,
@@ -141,22 +101,6 @@ enum {
141101
#endif
142102
};
143103

144-
#define MLX5_TTC_NUM_GROUPS 3
145-
#define MLX5_TTC_GROUP1_SIZE (BIT(3) + MLX5_NUM_TUNNEL_TT)
146-
#define MLX5_TTC_GROUP2_SIZE BIT(1)
147-
#define MLX5_TTC_GROUP3_SIZE BIT(0)
148-
#define MLX5_TTC_TABLE_SIZE (MLX5_TTC_GROUP1_SIZE +\
149-
MLX5_TTC_GROUP2_SIZE +\
150-
MLX5_TTC_GROUP3_SIZE)
151-
152-
#define MLX5_INNER_TTC_NUM_GROUPS 3
153-
#define MLX5_INNER_TTC_GROUP1_SIZE BIT(3)
154-
#define MLX5_INNER_TTC_GROUP2_SIZE BIT(1)
155-
#define MLX5_INNER_TTC_GROUP3_SIZE BIT(0)
156-
#define MLX5_INNER_TTC_TABLE_SIZE (MLX5_INNER_TTC_GROUP1_SIZE +\
157-
MLX5_INNER_TTC_GROUP2_SIZE +\
158-
MLX5_INNER_TTC_GROUP3_SIZE)
159-
160104
struct mlx5e_priv;
161105

162106
#ifdef CONFIG_MLX5_EN_RXNFC
@@ -238,37 +182,17 @@ struct mlx5e_flow_steering {
238182
struct mlx5e_ptp_fs *ptp_fs;
239183
};
240184

241-
struct ttc_params {
242-
struct mlx5_flow_namespace *ns;
243-
struct mlx5_flow_table_attr ft_attr;
244-
struct mlx5_flow_destination dests[MLX5_NUM_TT];
245-
bool inner_ttc;
246-
struct mlx5_flow_destination tunnel_dests[MLX5_NUM_TUNNEL_TT];
247-
};
248-
249185
void mlx5e_set_ttc_params(struct mlx5e_priv *priv,
250186
struct ttc_params *ttc_params, bool tunnel);
251187

252-
int mlx5_create_ttc_table(struct mlx5_core_dev *dev, struct ttc_params *params,
253-
struct mlx5_ttc_table *ttc);
254-
void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc);
255-
256188
void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
257-
int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type,
258-
struct mlx5_flow_destination *new_dest);
259-
struct mlx5_flow_destination
260-
mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc,
261-
enum mlx5_traffic_types type);
262-
int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc,
263-
enum mlx5_traffic_types type);
264189

265190
void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv);
266191
void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
267192

268193
int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
269194
void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
270195

271-
u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
272196
int mlx5e_add_vlan_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);
273197
void mlx5e_remove_vlan_trap(struct mlx5e_priv *priv);
274198
int mlx5e_add_mac_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);

0 commit comments

Comments
 (0)