mirror of
https://github.com/t2linux/kernel.git
synced 2026-04-30 13:48:59 -07:00
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>
This commit is contained in:
committed by
Saeed Mahameed
parent
bc29764ed9
commit
371cf74e78
@@ -15,7 +15,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
|
||||
health.o mcg.o cq.o alloc.o port.o mr.o pd.o \
|
||||
transobj.o vport.o sriov.o fs_cmd.o fs_core.o pci_irq.o \
|
||||
fs_counters.o fs_ft_pool.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
|
||||
lib/devcom.o lib/pci_vsc.o lib/dm.o diag/fs_tracepoint.o \
|
||||
lib/devcom.o lib/pci_vsc.o lib/dm.o lib/fs_ttc.o diag/fs_tracepoint.o \
|
||||
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \
|
||||
fw_reset.o qos.o
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@ struct page_pool;
|
||||
#define MLX5E_METADATA_ETHER_TYPE (0x8CE4)
|
||||
#define MLX5E_METADATA_ETHER_LEN 8
|
||||
|
||||
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
|
||||
|
||||
#define MLX5E_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)
|
||||
|
||||
#define MLX5E_HW2SW_MTU(params, hwmtu) ((hwmtu) - ((params)->hard_mtu))
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#define __MLX5E_FLOW_STEER_H__
|
||||
|
||||
#include "mod_hdr.h"
|
||||
#include "lib/fs_ttc.h"
|
||||
|
||||
enum {
|
||||
MLX5E_TC_FT_LEVEL = 0,
|
||||
@@ -67,21 +68,6 @@ struct mlx5e_l2_table {
|
||||
bool promisc_enabled;
|
||||
};
|
||||
|
||||
enum mlx5_traffic_types {
|
||||
MLX5_TT_IPV4_TCP,
|
||||
MLX5_TT_IPV6_TCP,
|
||||
MLX5_TT_IPV4_UDP,
|
||||
MLX5_TT_IPV6_UDP,
|
||||
MLX5_TT_IPV4_IPSEC_AH,
|
||||
MLX5_TT_IPV6_IPSEC_AH,
|
||||
MLX5_TT_IPV4_IPSEC_ESP,
|
||||
MLX5_TT_IPV6_IPSEC_ESP,
|
||||
MLX5_TT_IPV4,
|
||||
MLX5_TT_IPV6,
|
||||
MLX5_TT_ANY,
|
||||
MLX5_NUM_TT,
|
||||
};
|
||||
|
||||
#define MLX5E_NUM_INDIR_TIRS (MLX5_NUM_TT - 1)
|
||||
|
||||
#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
|
||||
@@ -94,32 +80,6 @@ enum mlx5_traffic_types {
|
||||
MLX5_HASH_FIELD_SEL_DST_IP |\
|
||||
MLX5_HASH_FIELD_SEL_IPSEC_SPI)
|
||||
|
||||
enum mlx5_tunnel_types {
|
||||
MLX5_TT_IPV4_GRE,
|
||||
MLX5_TT_IPV6_GRE,
|
||||
MLX5_TT_IPV4_IPIP,
|
||||
MLX5_TT_IPV6_IPIP,
|
||||
MLX5_TT_IPV4_IPV6,
|
||||
MLX5_TT_IPV6_IPV6,
|
||||
MLX5_NUM_TUNNEL_TT,
|
||||
};
|
||||
|
||||
bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
|
||||
|
||||
struct mlx5_ttc_rule {
|
||||
struct mlx5_flow_handle *rule;
|
||||
struct mlx5_flow_destination default_dest;
|
||||
};
|
||||
|
||||
/* L3/L4 traffic type classifier */
|
||||
struct mlx5_ttc_table {
|
||||
int num_groups;
|
||||
struct mlx5_flow_table *t;
|
||||
struct mlx5_flow_group **g;
|
||||
struct mlx5_ttc_rule rules[MLX5_NUM_TT];
|
||||
struct mlx5_flow_handle *tunnel_rules[MLX5_NUM_TUNNEL_TT];
|
||||
};
|
||||
|
||||
/* NIC prio FTS */
|
||||
enum {
|
||||
MLX5E_PROMISC_FT_LEVEL,
|
||||
@@ -141,22 +101,6 @@ enum {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MLX5_TTC_NUM_GROUPS 3
|
||||
#define MLX5_TTC_GROUP1_SIZE (BIT(3) + MLX5_NUM_TUNNEL_TT)
|
||||
#define MLX5_TTC_GROUP2_SIZE BIT(1)
|
||||
#define MLX5_TTC_GROUP3_SIZE BIT(0)
|
||||
#define MLX5_TTC_TABLE_SIZE (MLX5_TTC_GROUP1_SIZE +\
|
||||
MLX5_TTC_GROUP2_SIZE +\
|
||||
MLX5_TTC_GROUP3_SIZE)
|
||||
|
||||
#define MLX5_INNER_TTC_NUM_GROUPS 3
|
||||
#define MLX5_INNER_TTC_GROUP1_SIZE BIT(3)
|
||||
#define MLX5_INNER_TTC_GROUP2_SIZE BIT(1)
|
||||
#define MLX5_INNER_TTC_GROUP3_SIZE BIT(0)
|
||||
#define MLX5_INNER_TTC_TABLE_SIZE (MLX5_INNER_TTC_GROUP1_SIZE +\
|
||||
MLX5_INNER_TTC_GROUP2_SIZE +\
|
||||
MLX5_INNER_TTC_GROUP3_SIZE)
|
||||
|
||||
struct mlx5e_priv;
|
||||
|
||||
#ifdef CONFIG_MLX5_EN_RXNFC
|
||||
@@ -238,29 +182,10 @@ struct mlx5e_flow_steering {
|
||||
struct mlx5e_ptp_fs *ptp_fs;
|
||||
};
|
||||
|
||||
struct ttc_params {
|
||||
struct mlx5_flow_namespace *ns;
|
||||
struct mlx5_flow_table_attr ft_attr;
|
||||
struct mlx5_flow_destination dests[MLX5_NUM_TT];
|
||||
bool inner_ttc;
|
||||
struct mlx5_flow_destination tunnel_dests[MLX5_NUM_TUNNEL_TT];
|
||||
};
|
||||
|
||||
void mlx5e_set_ttc_params(struct mlx5e_priv *priv,
|
||||
struct ttc_params *ttc_params, bool tunnel);
|
||||
|
||||
int mlx5_create_ttc_table(struct mlx5_core_dev *dev, struct ttc_params *params,
|
||||
struct mlx5_ttc_table *ttc);
|
||||
void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc);
|
||||
|
||||
void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
|
||||
int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type,
|
||||
struct mlx5_flow_destination *new_dest);
|
||||
struct mlx5_flow_destination
|
||||
mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc,
|
||||
enum mlx5_traffic_types type);
|
||||
int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc,
|
||||
enum mlx5_traffic_types type);
|
||||
|
||||
void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv);
|
||||
void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
|
||||
@@ -268,7 +193,6 @@ void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
|
||||
int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
|
||||
void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
|
||||
|
||||
u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
|
||||
int mlx5e_add_vlan_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);
|
||||
void mlx5e_remove_vlan_trap(struct mlx5e_priv *priv);
|
||||
int mlx5e_add_mac_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
|
||||
/* Copyright (c) 2020 Mellanox Technologies. */
|
||||
|
||||
#ifndef __ML5_FS_TTC_H__
|
||||
#define __ML5_FS_TTC_H__
|
||||
|
||||
#include <linux/mlx5/fs.h>
|
||||
|
||||
enum mlx5_traffic_types {
|
||||
MLX5_TT_IPV4_TCP,
|
||||
MLX5_TT_IPV6_TCP,
|
||||
MLX5_TT_IPV4_UDP,
|
||||
MLX5_TT_IPV6_UDP,
|
||||
MLX5_TT_IPV4_IPSEC_AH,
|
||||
MLX5_TT_IPV6_IPSEC_AH,
|
||||
MLX5_TT_IPV4_IPSEC_ESP,
|
||||
MLX5_TT_IPV6_IPSEC_ESP,
|
||||
MLX5_TT_IPV4,
|
||||
MLX5_TT_IPV6,
|
||||
MLX5_TT_ANY,
|
||||
MLX5_NUM_TT,
|
||||
MLX5_NUM_INDIR_TIRS = MLX5_TT_ANY,
|
||||
};
|
||||
|
||||
enum mlx5_tunnel_types {
|
||||
MLX5_TT_IPV4_GRE,
|
||||
MLX5_TT_IPV6_GRE,
|
||||
MLX5_TT_IPV4_IPIP,
|
||||
MLX5_TT_IPV6_IPIP,
|
||||
MLX5_TT_IPV4_IPV6,
|
||||
MLX5_TT_IPV6_IPV6,
|
||||
MLX5_NUM_TUNNEL_TT,
|
||||
};
|
||||
|
||||
struct mlx5_ttc_rule {
|
||||
struct mlx5_flow_handle *rule;
|
||||
struct mlx5_flow_destination default_dest;
|
||||
};
|
||||
|
||||
/* L3/L4 traffic type classifier */
|
||||
struct mlx5_ttc_table {
|
||||
int num_groups;
|
||||
struct mlx5_flow_table *t;
|
||||
struct mlx5_flow_group **g;
|
||||
struct mlx5_ttc_rule rules[MLX5_NUM_TT];
|
||||
struct mlx5_flow_handle *tunnel_rules[MLX5_NUM_TUNNEL_TT];
|
||||
};
|
||||
|
||||
struct ttc_params {
|
||||
struct mlx5_flow_namespace *ns;
|
||||
struct mlx5_flow_table_attr ft_attr;
|
||||
struct mlx5_flow_destination dests[MLX5_NUM_TT];
|
||||
bool inner_ttc;
|
||||
struct mlx5_flow_destination tunnel_dests[MLX5_NUM_TUNNEL_TT];
|
||||
};
|
||||
|
||||
int mlx5_create_ttc_table(struct mlx5_core_dev *dev, struct ttc_params *params,
|
||||
struct mlx5_ttc_table *ttc);
|
||||
void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc);
|
||||
|
||||
int mlx5_create_inner_ttc_table(struct mlx5_core_dev *dev,
|
||||
struct ttc_params *params,
|
||||
struct mlx5_ttc_table *ttc);
|
||||
void mlx5_destroy_inner_ttc_table(struct mlx5_ttc_table *ttc);
|
||||
|
||||
int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type,
|
||||
struct mlx5_flow_destination *new_dest);
|
||||
struct mlx5_flow_destination
|
||||
mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc,
|
||||
enum mlx5_traffic_types type);
|
||||
int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc,
|
||||
enum mlx5_traffic_types type);
|
||||
|
||||
bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
|
||||
u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
|
||||
|
||||
#endif /* __MLX5_FS_TTC_H__ */
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#define MLX5_FS_DEFAULT_FLOW_TAG 0x0
|
||||
|
||||
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
|
||||
|
||||
enum {
|
||||
MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16,
|
||||
MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17,
|
||||
|
||||
Reference in New Issue
Block a user