mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
net/mlx5: Add new chain for netfilter flow table offload
Netfilter tables (nftables) implements a software datapath that comes after tc ingress datapath. The datapath supports offloading such rules via the flow table offload API. This API is currently only used by NFT and it doesn't provide the global priority in regards to tc offload, so we assume offloading such rules must come after tc. It does provide a flow table priority parameter, so we need to provide some supported priority range. For that, split fastpath prio to two, flow table offload and tc offload, with one dedicated priority chain for flow table offload. Next patch will re-use the multi chain API to access this chain by allowing access to this chain by the fdb_sub_namespace. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
439e843f1f
commit
975b992fdd
@ -44,7 +44,12 @@
|
|||||||
#include "lib/mpfs.h"
|
#include "lib/mpfs.h"
|
||||||
|
|
||||||
#define FDB_TC_MAX_CHAIN 3
|
#define FDB_TC_MAX_CHAIN 3
|
||||||
#define FDB_TC_SLOW_PATH_CHAIN (FDB_TC_MAX_CHAIN + 1)
|
#define FDB_FT_CHAIN (FDB_TC_MAX_CHAIN + 1)
|
||||||
|
#define FDB_TC_SLOW_PATH_CHAIN (FDB_FT_CHAIN + 1)
|
||||||
|
|
||||||
|
/* The index of the last real chain (FT) + 1 as chain zero is valid as well */
|
||||||
|
#define FDB_NUM_CHAINS (FDB_FT_CHAIN + 1)
|
||||||
|
|
||||||
#define FDB_TC_MAX_PRIO 16
|
#define FDB_TC_MAX_PRIO 16
|
||||||
#define FDB_TC_LEVELS_PER_PRIO 2
|
#define FDB_TC_LEVELS_PER_PRIO 2
|
||||||
|
|
||||||
@ -173,7 +178,7 @@ struct mlx5_eswitch_fdb {
|
|||||||
struct {
|
struct {
|
||||||
struct mlx5_flow_table *fdb;
|
struct mlx5_flow_table *fdb;
|
||||||
u32 num_rules;
|
u32 num_rules;
|
||||||
} fdb_prio[FDB_TC_MAX_CHAIN + 1][FDB_TC_MAX_PRIO + 1][FDB_TC_LEVELS_PER_PRIO];
|
} fdb_prio[FDB_NUM_CHAINS][FDB_TC_MAX_PRIO + 1][FDB_TC_LEVELS_PER_PRIO];
|
||||||
/* Protects fdb_prio table */
|
/* Protects fdb_prio table */
|
||||||
struct mutex fdb_prio_lock;
|
struct mutex fdb_prio_lock;
|
||||||
|
|
||||||
|
@ -2624,16 +2624,19 @@ static int create_fdb_chains(struct mlx5_flow_steering *steering,
|
|||||||
|
|
||||||
static int create_fdb_fast_path(struct mlx5_flow_steering *steering)
|
static int create_fdb_fast_path(struct mlx5_flow_steering *steering)
|
||||||
{
|
{
|
||||||
const int total_chains = FDB_TC_MAX_CHAIN + 1;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
steering->fdb_sub_ns = kcalloc(total_chains,
|
steering->fdb_sub_ns = kcalloc(FDB_NUM_CHAINS,
|
||||||
sizeof(*steering->fdb_sub_ns),
|
sizeof(*steering->fdb_sub_ns),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!steering->fdb_sub_ns)
|
if (!steering->fdb_sub_ns)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
err = create_fdb_chains(steering, FDB_FAST_PATH, FDB_TC_MAX_CHAIN + 1);
|
err = create_fdb_chains(steering, FDB_TC_OFFLOAD, FDB_TC_MAX_CHAIN + 1);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = create_fdb_chains(steering, FDB_FT_OFFLOAD, 1);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ enum mlx5_flow_namespace_type {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
FDB_BYPASS_PATH,
|
FDB_BYPASS_PATH,
|
||||||
FDB_FAST_PATH,
|
FDB_TC_OFFLOAD,
|
||||||
|
FDB_FT_OFFLOAD,
|
||||||
FDB_SLOW_PATH,
|
FDB_SLOW_PATH,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user