-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'mlx5-updates-2022-03-10' of git://git.kernel.org/pub/scm/l…
…inux/kernel/git/saeed/linux Saeed Mahameed says: ==================== mlx5-updates-2022-03-10 1) Leon removes useless includes from both mlx5 and mlx4 2) Tariq adds node awareness to some object allocations 3) Gal Cleanups and improvements to EEPROM query 4) Paul adds Software steering to Connection Tracking, to speed up CT Rules insertion. Paul Blakey Says: ================= To improve insertion rate, this series allows for using software steering API directly instead of going through the fs_core layer. This can be done for CT because it doesn't need fs_core layer extra facilities, such as autogroups, FTE IDs and modifications (which require a copy of the flow key/mask). Skipping fs_core layer also allows to create the software steering objects (dr_* objects) ahead of time and re-use them for multiple rules, whereas software steering under fs_core creates them on the fly and discards them. This in turn increased insertion rate. The series first introduces a lightweight CT flow steering provider with the first implementations using fs_core layer, and moves CT to use it. The next patches implement a provider using software steering directly, bypassing fs_core, and uses it if software steering is available. ================= ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
33 changed files
with
700 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */ | ||
|
||
#ifndef __MLX5_EN_TC_CT_FS_H__ | ||
#define __MLX5_EN_TC_CT_FS_H__ | ||
|
||
struct mlx5_ct_fs { | ||
const struct net_device *netdev; | ||
struct mlx5_core_dev *dev; | ||
|
||
/* private data */ | ||
void *priv_data[]; | ||
}; | ||
|
||
struct mlx5_ct_fs_rule { | ||
}; | ||
|
||
struct mlx5_ct_fs_ops { | ||
int (*init)(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct, | ||
struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct); | ||
void (*destroy)(struct mlx5_ct_fs *fs); | ||
|
||
struct mlx5_ct_fs_rule * (*ct_rule_add)(struct mlx5_ct_fs *fs, | ||
struct mlx5_flow_spec *spec, | ||
struct mlx5_flow_attr *attr, | ||
struct flow_rule *flow_rule); | ||
void (*ct_rule_del)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule); | ||
|
||
size_t priv_size; | ||
}; | ||
|
||
static inline void *mlx5_ct_fs_priv(struct mlx5_ct_fs *fs) | ||
{ | ||
return &fs->priv_data; | ||
} | ||
|
||
struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void); | ||
|
||
#if IS_ENABLED(CONFIG_MLX5_SW_STEERING) | ||
struct mlx5_ct_fs_ops *mlx5_ct_fs_smfs_ops_get(void); | ||
#else | ||
static inline struct mlx5_ct_fs_ops * | ||
mlx5_ct_fs_smfs_ops_get(void) | ||
{ | ||
return NULL; | ||
} | ||
#endif /* IS_ENABLED(CONFIG_MLX5_SW_STEERING) */ | ||
|
||
#endif /* __MLX5_EN_TC_CT_FS_H__ */ |
79 changes: 79 additions & 0 deletions
79
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB | ||
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */ | ||
|
||
#include "en_tc.h" | ||
#include "en/tc_ct.h" | ||
#include "en/tc/ct_fs.h" | ||
|
||
#define ct_dbg(fmt, args...)\ | ||
netdev_dbg(fs->netdev, "ct_fs_dmfs debug: " fmt "\n", ##args) | ||
|
||
struct mlx5_ct_fs_dmfs_rule { | ||
struct mlx5_ct_fs_rule fs_rule; | ||
struct mlx5_flow_handle *rule; | ||
struct mlx5_flow_attr *attr; | ||
}; | ||
|
||
static int | ||
mlx5_ct_fs_dmfs_init(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct, | ||
struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct) | ||
{ | ||
return 0; | ||
} | ||
|
||
static void | ||
mlx5_ct_fs_dmfs_destroy(struct mlx5_ct_fs *fs) | ||
{ | ||
} | ||
|
||
static struct mlx5_ct_fs_rule * | ||
mlx5_ct_fs_dmfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec, | ||
struct mlx5_flow_attr *attr, struct flow_rule *flow_rule) | ||
{ | ||
struct mlx5e_priv *priv = netdev_priv(fs->netdev); | ||
struct mlx5_ct_fs_dmfs_rule *dmfs_rule; | ||
int err; | ||
|
||
dmfs_rule = kzalloc(sizeof(*dmfs_rule), GFP_KERNEL); | ||
if (!dmfs_rule) | ||
return ERR_PTR(-ENOMEM); | ||
|
||
dmfs_rule->rule = mlx5_tc_rule_insert(priv, spec, attr); | ||
if (IS_ERR(dmfs_rule->rule)) { | ||
err = PTR_ERR(dmfs_rule->rule); | ||
ct_dbg("Failed to add ct entry fs rule"); | ||
goto err_insert; | ||
} | ||
|
||
dmfs_rule->attr = attr; | ||
|
||
return &dmfs_rule->fs_rule; | ||
|
||
err_insert: | ||
kfree(dmfs_rule); | ||
return ERR_PTR(err); | ||
} | ||
|
||
static void | ||
mlx5_ct_fs_dmfs_ct_rule_del(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule) | ||
{ | ||
struct mlx5_ct_fs_dmfs_rule *dmfs_rule = container_of(fs_rule, | ||
struct mlx5_ct_fs_dmfs_rule, | ||
fs_rule); | ||
|
||
mlx5_tc_rule_delete(netdev_priv(fs->netdev), dmfs_rule->rule, dmfs_rule->attr); | ||
kfree(dmfs_rule); | ||
} | ||
|
||
static struct mlx5_ct_fs_ops dmfs_ops = { | ||
.ct_rule_add = mlx5_ct_fs_dmfs_ct_rule_add, | ||
.ct_rule_del = mlx5_ct_fs_dmfs_ct_rule_del, | ||
|
||
.init = mlx5_ct_fs_dmfs_init, | ||
.destroy = mlx5_ct_fs_dmfs_destroy, | ||
}; | ||
|
||
struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void) | ||
{ | ||
return &dmfs_ops; | ||
} |
Oops, something went wrong.