Skip to content

Commit 8ef1dc4

Browse files
committed
Merge tag 'mlx5-updates-2022-03-10' of git://git.kernel.org/pub/scm/linux/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 <[email protected]>
2 parents 63f13b2 + 970adfb commit 8ef1dc4

File tree

33 files changed

+700
-69
lines changed

33 files changed

+700
-69
lines changed

drivers/net/ethernet/mellanox/mlx4/en_tx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include <linux/tcp.h>
4343
#include <linux/ip.h>
4444
#include <linux/ipv6.h>
45-
#include <linux/moduleparam.h>
4645
#include <linux/indirect_call_wrapper.h>
4746

4847
#include "mlx4_en.h"

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en/tc/act/act.o en/tc/act/drop.o en/tc/a
5555
en/tc/act/ct.o en/tc/act/sample.o en/tc/act/ptype.o \
5656
en/tc/act/redirect_ingress.o
5757

58-
mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o
58+
ifneq ($(CONFIG_MLX5_TC_CT),)
59+
mlx5_core-y += en/tc_ct.o en/tc/ct_fs_dmfs.o
60+
mlx5_core-$(CONFIG_MLX5_SW_STEERING) += en/tc/ct_fs_smfs.o
61+
endif
62+
5963
mlx5_core-$(CONFIG_MLX5_TC_SAMPLE) += en/tc/sample.o
6064

6165
#
@@ -106,7 +110,7 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
106110
steering/dr_ste_v2.o \
107111
steering/dr_cmd.o steering/dr_fw.o \
108112
steering/dr_action.o steering/fs_dr.o \
109-
steering/dr_dbg.o
113+
steering/dr_dbg.o lib/smfs.o
110114
#
111115
# SF device
112116
#

drivers/net/ethernet/mellanox/mlx5/core/alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev,
183183
u32 db_per_page = PAGE_SIZE / cache_line_size();
184184
struct mlx5_db_pgdir *pgdir;
185185

186-
pgdir = kzalloc(sizeof(*pgdir), GFP_KERNEL);
186+
pgdir = kzalloc_node(sizeof(*pgdir), GFP_KERNEL, node);
187187
if (!pgdir)
188188
return NULL;
189189

190-
pgdir->bitmap = bitmap_zalloc(db_per_page, GFP_KERNEL);
190+
pgdir->bitmap = bitmap_zalloc_node(db_per_page, GFP_KERNEL, node);
191191
if (!pgdir->bitmap) {
192192
kfree(pgdir);
193193
return NULL;

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
*/
3232

3333
#include <linux/highmem.h>
34-
#include <linux/module.h>
3534
#include <linux/errno.h>
3635
#include <linux/pci.h>
3736
#include <linux/dma-mapping.h>

drivers/net/ethernet/mellanox/mlx5/core/cq.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
*/
3232

3333
#include <linux/kernel.h>
34-
#include <linux/module.h>
3534
#include <linux/hardirq.h>
3635
#include <linux/mlx5/driver.h>
3736
#include <rdma/ib_verbs.h>

drivers/net/ethernet/mellanox/mlx5/core/debugfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* SOFTWARE.
3131
*/
3232

33-
#include <linux/module.h>
3433
#include <linux/debugfs.h>
3534
#include <linux/mlx5/qp.h>
3635
#include <linux/mlx5/cq.h>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2+
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3+
4+
#ifndef __MLX5_EN_TC_CT_FS_H__
5+
#define __MLX5_EN_TC_CT_FS_H__
6+
7+
struct mlx5_ct_fs {
8+
const struct net_device *netdev;
9+
struct mlx5_core_dev *dev;
10+
11+
/* private data */
12+
void *priv_data[];
13+
};
14+
15+
struct mlx5_ct_fs_rule {
16+
};
17+
18+
struct mlx5_ct_fs_ops {
19+
int (*init)(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct,
20+
struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct);
21+
void (*destroy)(struct mlx5_ct_fs *fs);
22+
23+
struct mlx5_ct_fs_rule * (*ct_rule_add)(struct mlx5_ct_fs *fs,
24+
struct mlx5_flow_spec *spec,
25+
struct mlx5_flow_attr *attr,
26+
struct flow_rule *flow_rule);
27+
void (*ct_rule_del)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule);
28+
29+
size_t priv_size;
30+
};
31+
32+
static inline void *mlx5_ct_fs_priv(struct mlx5_ct_fs *fs)
33+
{
34+
return &fs->priv_data;
35+
}
36+
37+
struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void);
38+
39+
#if IS_ENABLED(CONFIG_MLX5_SW_STEERING)
40+
struct mlx5_ct_fs_ops *mlx5_ct_fs_smfs_ops_get(void);
41+
#else
42+
static inline struct mlx5_ct_fs_ops *
43+
mlx5_ct_fs_smfs_ops_get(void)
44+
{
45+
return NULL;
46+
}
47+
#endif /* IS_ENABLED(CONFIG_MLX5_SW_STEERING) */
48+
49+
#endif /* __MLX5_EN_TC_CT_FS_H__ */
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2+
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3+
4+
#include "en_tc.h"
5+
#include "en/tc_ct.h"
6+
#include "en/tc/ct_fs.h"
7+
8+
#define ct_dbg(fmt, args...)\
9+
netdev_dbg(fs->netdev, "ct_fs_dmfs debug: " fmt "\n", ##args)
10+
11+
struct mlx5_ct_fs_dmfs_rule {
12+
struct mlx5_ct_fs_rule fs_rule;
13+
struct mlx5_flow_handle *rule;
14+
struct mlx5_flow_attr *attr;
15+
};
16+
17+
static int
18+
mlx5_ct_fs_dmfs_init(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct,
19+
struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct)
20+
{
21+
return 0;
22+
}
23+
24+
static void
25+
mlx5_ct_fs_dmfs_destroy(struct mlx5_ct_fs *fs)
26+
{
27+
}
28+
29+
static struct mlx5_ct_fs_rule *
30+
mlx5_ct_fs_dmfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec,
31+
struct mlx5_flow_attr *attr, struct flow_rule *flow_rule)
32+
{
33+
struct mlx5e_priv *priv = netdev_priv(fs->netdev);
34+
struct mlx5_ct_fs_dmfs_rule *dmfs_rule;
35+
int err;
36+
37+
dmfs_rule = kzalloc(sizeof(*dmfs_rule), GFP_KERNEL);
38+
if (!dmfs_rule)
39+
return ERR_PTR(-ENOMEM);
40+
41+
dmfs_rule->rule = mlx5_tc_rule_insert(priv, spec, attr);
42+
if (IS_ERR(dmfs_rule->rule)) {
43+
err = PTR_ERR(dmfs_rule->rule);
44+
ct_dbg("Failed to add ct entry fs rule");
45+
goto err_insert;
46+
}
47+
48+
dmfs_rule->attr = attr;
49+
50+
return &dmfs_rule->fs_rule;
51+
52+
err_insert:
53+
kfree(dmfs_rule);
54+
return ERR_PTR(err);
55+
}
56+
57+
static void
58+
mlx5_ct_fs_dmfs_ct_rule_del(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule)
59+
{
60+
struct mlx5_ct_fs_dmfs_rule *dmfs_rule = container_of(fs_rule,
61+
struct mlx5_ct_fs_dmfs_rule,
62+
fs_rule);
63+
64+
mlx5_tc_rule_delete(netdev_priv(fs->netdev), dmfs_rule->rule, dmfs_rule->attr);
65+
kfree(dmfs_rule);
66+
}
67+
68+
static struct mlx5_ct_fs_ops dmfs_ops = {
69+
.ct_rule_add = mlx5_ct_fs_dmfs_ct_rule_add,
70+
.ct_rule_del = mlx5_ct_fs_dmfs_ct_rule_del,
71+
72+
.init = mlx5_ct_fs_dmfs_init,
73+
.destroy = mlx5_ct_fs_dmfs_destroy,
74+
};
75+
76+
struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void)
77+
{
78+
return &dmfs_ops;
79+
}

0 commit comments

Comments
 (0)