Skip to content

Commit

Permalink
Merge tag 'mlx5-updates-2022-03-10' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…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
David S. Miller committed Mar 11, 2022
2 parents 63f13b2 + 970adfb commit 8ef1dc4
Show file tree
Hide file tree
Showing 33 changed files with 700 additions and 69 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/mellanox/mlx4/en_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <linux/tcp.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/moduleparam.h>
#include <linux/indirect_call_wrapper.h>

#include "mlx4_en.h"
Expand Down
8 changes: 6 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en/tc/act/act.o en/tc/act/drop.o en/tc/a
en/tc/act/ct.o en/tc/act/sample.o en/tc/act/ptype.o \
en/tc/act/redirect_ingress.o

mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o
ifneq ($(CONFIG_MLX5_TC_CT),)
mlx5_core-y += en/tc_ct.o en/tc/ct_fs_dmfs.o
mlx5_core-$(CONFIG_MLX5_SW_STEERING) += en/tc/ct_fs_smfs.o
endif

mlx5_core-$(CONFIG_MLX5_TC_SAMPLE) += en/tc/sample.o

#
Expand Down Expand Up @@ -106,7 +110,7 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
steering/dr_ste_v2.o \
steering/dr_cmd.o steering/dr_fw.o \
steering/dr_action.o steering/fs_dr.o \
steering/dr_dbg.o
steering/dr_dbg.o lib/smfs.o
#
# SF device
#
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev,
u32 db_per_page = PAGE_SIZE / cache_line_size();
struct mlx5_db_pgdir *pgdir;

pgdir = kzalloc(sizeof(*pgdir), GFP_KERNEL);
pgdir = kzalloc_node(sizeof(*pgdir), GFP_KERNEL, node);
if (!pgdir)
return NULL;

pgdir->bitmap = bitmap_zalloc(db_per_page, GFP_KERNEL);
pgdir->bitmap = bitmap_zalloc_node(db_per_page, GFP_KERNEL, node);
if (!pgdir->bitmap) {
kfree(pgdir);
return NULL;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/

#include <linux/highmem.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hardirq.h>
#include <linux/mlx5/driver.h>
#include <rdma/ib_verbs.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* SOFTWARE.
*/

#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/mlx5/qp.h>
#include <linux/mlx5/cq.h>
Expand Down
49 changes: 49 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs.h
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 drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c
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;
}
Loading

0 comments on commit 8ef1dc4

Please sign in to comment.