mlx5 misc updates 2021-05-26
Subsystems (5)
From: Saeed Mahameed <[email protected]>
Hi Dave and Jakub,
This series provides misc updates.v1->v2:
- Drop SF related patches, Will handle Parav's comments internally and will repost in a later series.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit 59c56342459a483d5e563ed8b5fdb77ab7622a73:
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue (2021-05-26 18:33:01 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-05-26
for you to fetch changes up to 8613641063617c1dfc731b403b3ee4935ef15f87:
net/mlx5: Fix lag port remapping logic (2021-05-27 11:54:39 -0700)
----------------------------------------------------------------
mlx5-updates-2021-05-26
Misc update for mlx5 driver,
1) Clean up patches for lag and SF
2) Reserve bit 31 in steering register C1 for IPSec offload usage
3) Move steering tables pool logic into the steering core and increase the maximum table size to 2G entries when software steering is enabled.
----------------------------------------------------------------
Eli Cohen (3):
net/mlx5: Remove unnecessary spin lock protection net/mlx5: Use boolean arithmetic to evaluate roce_lag net/mlx5: Fix lag port remapping logic
Huy Nguyen (2):
net/mlx5e: TC: Reserved bit 31 of REG_C1 for IPsec offload net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet
Paul Blakey (7):
net/mlx5: CT: Avoid reusing modify header context for natted entries net/mlx5e: TC: Use bit counts for register mapping net/mlx5: Add case for FS_FT_NIC_TX FT in MLX5_CAP_FLOWTABLE_TYPE net/mlx5: Move table size calculation to steering cmd layer net/mlx5: Move chains ft pool to be used by all firmware steering net/mlx5: DR, Set max table size to 2G entries
net/mlx5: Cap the maximum flow group size to 16M entries
Roi Dayan (1):
net/mlx5e: CT, Remove newline from ct_dbg call
Tariq Toukan (1):
net/mlx5e: RX, Remove unnecessary check in RX CQE compression handling
Yevgeny Kliteynik (1):
net/mlx5: DR, Remove unused field of send_ring struct
drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 58 +++++++++---- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h | 23 +++--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 86 +++++++++++++------- drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 8 +- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 29 +++++-- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 40 ++++++--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + .../net/ethernet/mellanox/mlx5/core/fs_ft_pool.c | 83 +++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/fs_ft_pool.h | 21 +++++ drivers/net/ethernet/mellanox/mlx5/core/lag.c | 28 ++++--- .../ethernet/mellanox/mlx5/core/lib/fs_chains.c | 94 ++-------------------- .../mellanox/mlx5/core/steering/dr_types.h | 1 - .../ethernet/mellanox/mlx5/core/steering/fs_dr.c | 6 +- include/linux/mlx5/driver.h | 2 + include/linux/mlx5/eswitch.h | 17 ++-- 19 files changed, 318 insertions(+), 193 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h
PATCH v2 1/15 net/mlx5e: CT, Remove newline from ct_dbg call
From: Roi Dayan <[email protected]>
ct_dbg() already adds a newline.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +1 -1
@@ -918,7 +918,7 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv, }if (rev_entry &&refcount_inc_not_zero (&rev_entry->counter->refcount)) { -ct_dbg ("Using shared counter entry=0x%p rev=0x%p\n" , entry, rev_entry); +ct_dbg ("Using shared counter entry=0x%p rev=0x%p" , entry, rev_entry); shared_counter = rev_entry->counter;spin_unlock_bh (&ct_priv->ht_lock);
Signature · 1 line
2.31.1
Re: [net-next V2 01/15] net/mlx5e: CT, Remove newline from ct_dbg call
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 8 lines · On Thu, 27 May 2021 11:56:10 -0700 you wrote:
From: Roi Dayan <[email protected]>
ct_dbg()already adds a newline.Signed-off-by Roi Dayan <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>[...]
Here is the summary with links:
- [net-next,V2,01/15] net/mlx5e: CT, Remove newline from ct_dbg call
https://git.kernel.org/netdev/net-next/c/74097a0dcd1e - [net-next,V2,02/15] net/mlx5: CT: Avoid reusing modify header context for natted entries https://git.kernel.org/netdev/net-next/c/7fac5c2eced3 - [net-next,V2,03/15] net/mlx5e: TC: Use bit counts for register mapping https://git.kernel.org/netdev/net-next/c/ed2fe7ba7b9f - [net-next,V2,04/15] net/mlx5e: TC: Reserved bit 31 of REG_C1 for IPsec offload https://git.kernel.org/netdev/net-next/c/b973cf32453f - [net-next,V2,05/15] net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet https://git.kernel.org/netdev/net-next/c/c07274ab1ab2 - [net-next,V2,06/15] net/mlx5e: RX, Remove unnecessary check in RX CQE compression handling https://git.kernel.org/netdev/net-next/c/2ef9c7c613cf - [net-next,V2,07/15] net/mlx5: DR, Remove unused field of send_ring struct https://git.kernel.org/netdev/net-next/c/b72ce870f57e - [net-next,V2,08/15] net/mlx5: Add case for FS_FT_NIC_TX FT in MLX5_CAP_FLOWTABLE_TYPE https://git.kernel.org/netdev/net-next/c/e01b58e9d5c4 - [net-next,V2,09/15] net/mlx5: Move table size calculation to steering cmd layer https://git.kernel.org/netdev/net-next/c/04745afb2ae3 - [net-next,V2,10/15] net/mlx5: Move chains ft pool to be used by all firmware steering https://git.kernel.org/netdev/net-next/c/4a98544d1827 - [net-next,V2,11/15] net/mlx5: DR, Set max table size to 2G entries https://git.kernel.org/netdev/net-next/c/9e117998409c - [net-next,V2,12/15] net/mlx5: Cap the maximum flow group size to 16M entries https://git.kernel.org/netdev/net-next/c/71513c05a97f - [net-next,V2,13/15] net/mlx5: Remove unnecessary spin lock protection https://git.kernel.org/netdev/net-next/c/a546432f2f04 - [net-next,V2,14/15] net/mlx5: Use boolean arithmetic to evaluate roce_lag https://git.kernel.org/netdev/net-next/c/2b1476752521 - [net-next,V2,15/15] net/mlx5: Fix lag port remapping logic https://git.kernel.org/netdev/net-next/c/861364106361
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH v2 2/15 net/mlx5: CT: Avoid reusing modify header context for natted entries
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
Currently the driver is designed to reuse header modify context entries. Natted entries will always have a unique modify header, as such the modify header hashtable lookup is introducing an overhead. When the hashtable size exceeded 200k entries the tested insertion rate dropped from ~10k entries/sec to ~300 entries/sec.
Don't use the re-use mechanism when creating modify headers for natted tuples.
--- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +38 -12
@@ -150,6 +150,11 @@ struct mlx5_ct_entry {unsigned long flags; }; +static void +mlx5_tc_ct_entry_destroy_mod_hdr (struct mlx5_tc_ct_priv *ct_priv, +struct mlx5_flow_attr *attr, +struct mlx5e_mod_hdr_handle *mh); +static const struct rhashtable_params cts_ht_params = { .head_offset = offsetof(struct mlx5_ct_entry , node), .key_offset = offsetof(struct mlx5_ct_entry , cookie),
@@ -458,8 +463,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv,ct_dbg ("Deleting ct entry rule in zone %d" , entry->tuple.zone);mlx5_tc_rule_delete (netdev_priv (ct_priv->netdev), zone_rule->rule, attr); -mlx5e_mod_hdr_detach (ct_priv->dev, - ct_priv->mod_hdr_tbl, zone_rule->mh); +mlx5_tc_ct_entry_destroy_mod_hdr (ct_priv, zone_rule->attr, zone_rule->mh);mlx5_put_label_mapping (ct_priv, attr->ct_attr.ct_labels_id);kfree (attr); }
@@ -686,15 +690,27 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,if (err) goto err_mapping; - *mh =mlx5e_mod_hdr_attach (ct_priv->dev, - ct_priv->mod_hdr_tbl, - ct_priv->ns_type, - &mod_acts); -if (IS_ERR (*mh)) { - err =PTR_ERR (*mh); - goto err_mapping; +if (nat) { + attr->modify_hdr =mlx5_modify_header_alloc (ct_priv->dev, ct_priv->ns_type, + mod_acts.num_actions, + mod_acts.actions); +if (IS_ERR (attr->modify_hdr)) { + err =PTR_ERR (attr->modify_hdr); + goto err_mapping; + } + + *mh =NULL ; + }else { + *mh =mlx5e_mod_hdr_attach (ct_priv->dev, + ct_priv->mod_hdr_tbl, + ct_priv->ns_type, + &mod_acts); +if (IS_ERR (*mh)) { + err =PTR_ERR (*mh); + goto err_mapping; + } + attr->modify_hdr =mlx5e_mod_hdr_get (*mh); } - attr->modify_hdr =mlx5e_mod_hdr_get (*mh);dealloc_mod_hdr_actions (&mod_acts);return 0 ;
@@ -705,6 +721,17 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,return err; } +static void +mlx5_tc_ct_entry_destroy_mod_hdr (struct mlx5_tc_ct_priv *ct_priv, +struct mlx5_flow_attr *attr, +struct mlx5e_mod_hdr_handle *mh) +{ +if (mh) +mlx5e_mod_hdr_detach (ct_priv->dev, ct_priv->mod_hdr_tbl, mh); +else +mlx5_modify_header_dealloc (ct_priv->dev, attr->modify_hdr); +} + static int mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, struct flow_rule *flow_rule,
@@ -767,8 +794,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,return 0 ; err_rule: -mlx5e_mod_hdr_detach (ct_priv->dev, - ct_priv->mod_hdr_tbl, zone_rule->mh); +mlx5_tc_ct_entry_destroy_mod_hdr (ct_priv, zone_rule->attr, zone_rule->mh);mlx5_put_label_mapping (ct_priv, attr->ct_attr.ct_labels_id); err_mod_hdr:kfree (attr);
Signature · 1 line
2.31.1
PATCH v2 3/15 net/mlx5e: TC: Use bit counts for register mapping
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
To prepare for next patch where we will use a non-byte aligned mapping, change all byte counts in register mapping to bits.
--- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 6 +- .../ethernet/mellanox/mlx5/core/en/tc_ct.h | 23 +++-- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 86 ++++++++++++------- .../net/ethernet/mellanox/mlx5/core/en_tc.h | 6 +- .../mellanox/mlx5/core/lib/fs_chains.c | 5 +- 5 files changed, 77 insertions(+), 49 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +3 -3
@@ -23,7 +23,7 @@#include "en_tc.h" #include "en_rep.h" -#define MLX5_CT_ZONE_BITS (mlx5e_tc_attr_to_reg_mappings[ZONE_TO_REG].mlen * 8) +#define MLX5_CT_ZONE_BITS (mlx5e_tc_attr_to_reg_mappings[ZONE_TO_REG].mlen)#define MLX5_CT_ZONE_MASK GENMASK(MLX5_CT_ZONE_BITS - 1, 0)#define MLX5_CT_STATE_ESTABLISHED_BIT BIT(1)#define MLX5_CT_STATE_TRK_BIT BIT(2)
@@ -32,11 +32,11 @@#define MLX5_CT_STATE_RELATED_BIT BIT(5)#define MLX5_CT_STATE_INVALID_BIT BIT(6) -#define MLX5_FTE_ID_BITS (mlx5e_tc_attr_to_reg_mappings[FTEID_TO_REG].mlen * 8) +#define MLX5_FTE_ID_BITS (mlx5e_tc_attr_to_reg_mappings[FTEID_TO_REG].mlen)#define MLX5_FTE_ID_MAX GENMASK(MLX5_FTE_ID_BITS - 1, 0)#define MLX5_FTE_ID_MASK MLX5_FTE_ID_MAX -#define MLX5_CT_LABELS_BITS (mlx5e_tc_attr_to_reg_mappings[LABELS_TO_REG].mlen * 8) +#define MLX5_CT_LABELS_BITS (mlx5e_tc_attr_to_reg_mappings[LABELS_TO_REG].mlen)#define MLX5_CT_LABELS_MASK GENMASK(MLX5_CT_LABELS_BITS - 1, 0) #define ct_dbg(fmt, args...)\
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +11 -12
@@ -33,15 +33,15 @@ struct mlx5_ct_attr {#define zone_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_2,\ .moffset = 0,\ - .mlen = 2,\ + .mlen = 16,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ - misc_parameters_2.metadata_reg_c_2) + 2,\ + misc_parameters_2.metadata_reg_c_2),\ }#define ctstate_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_2,\ - .moffset = 2,\ - .mlen = 2,\ + .moffset = 16,\ + .mlen = 16,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ misc_parameters_2.metadata_reg_c_2),\ }
@@ -49,7 +49,7 @@ struct mlx5_ct_attr {#define mark_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_3,\ .moffset = 0,\ - .mlen = 4,\ + .mlen = 32,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ misc_parameters_2.metadata_reg_c_3),\ }
@@ -57,7 +57,7 @@ struct mlx5_ct_attr {#define labels_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_4,\ .moffset = 0,\ - .mlen = 4,\ + .mlen = 32,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ misc_parameters_2.metadata_reg_c_4),\ }
@@ -65,7 +65,7 @@ struct mlx5_ct_attr {#define fteid_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_5,\ .moffset = 0,\ - .mlen = 4,\ + .mlen = 32,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ misc_parameters_2.metadata_reg_c_5),\ }
@@ -73,20 +73,19 @@ struct mlx5_ct_attr {#define zone_restore_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_1,\ .moffset = 0,\ - .mlen = (ESW_ZONE_ID_BITS / 8),\ + .mlen = ESW_ZONE_ID_BITS,\ .soffset = MLX5_BYTE_OFF(fte_match_param,\ - misc_parameters_2.metadata_reg_c_1) + 3,\ + misc_parameters_2.metadata_reg_c_1),\ }#define nic_zone_restore_to_reg_ct {\ .mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_B,\ - .moffset = 2,\ - .mlen = (ESW_ZONE_ID_BITS / 8),\ + .moffset = 16,\ + .mlen = ESW_ZONE_ID_BITS,\ }#define REG_MAPPING_MLEN (reg) (mlx5e_tc_attr_to_reg_mappings[reg].mlen)#define REG_MAPPING_MOFFSET (reg) (mlx5e_tc_attr_to_reg_mappings[reg].moffset) -#define REG_MAPPING_SHIFT (reg) (REG_MAPPING_MOFFSET(reg) * 8)#if IS_ENABLED (CONFIG_MLX5_TC_CT )
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +57 -29
160 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +3 -3
@@ -198,10 +198,10 @@ enum mlx5e_tc_attr_to_reg {struct mlx5e_tc_attr_to_reg_mapping {int mfield;/* rewrite field */ -int moffset;/* offset of mfield */ -int mlen;/* bytes to rewrite/match */ +int moffset;/* bit offset of mfield */ +int mlen;/* bits to rewrite/match */ -int soffset;/* offset of spec for match */ +int soffset;/* byte offset of spec for match */ };extern struct mlx5e_tc_attr_to_reg_mapping mlx5e_tc_attr_to_reg_mappings[];
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +3 -2
@@ -336,9 +336,10 @@ create_chain_restore(struct fs_chain *chain)MLX5_SET (set_action_in, modact, field, mlx5e_tc_attr_to_reg_mappings[chain_to_reg].mfield);MLX5_SET (set_action_in, modact, offset, - mlx5e_tc_attr_to_reg_mappings[chain_to_reg].moffset *8 ); + mlx5e_tc_attr_to_reg_mappings[chain_to_reg].moffset);MLX5_SET (set_action_in, modact, length, - mlx5e_tc_attr_to_reg_mappings[chain_to_reg].mlen *8 ); + mlx5e_tc_attr_to_reg_mappings[chain_to_reg].mlen ==32 ? +0 : mlx5e_tc_attr_to_reg_mappings[chain_to_reg].mlen);MLX5_SET (set_action_in, modact, data, chain->id); mod_hdr =mlx5_modify_header_alloc (chains->dev, chains->ns,1 , modact);
Signature · 1 line
2.31.1
PATCH v2 4/15 net/mlx5e: TC: Reserved bit 31 of REG_C1 for IPsec offload
In reply to Saeed MahameedFrom: Huy Nguyen <[email protected]>
Currently ASAP features fully utilize all the bits of the CQE's flow tag and ft_metadata field. The flow tag field cannot be used because the flow table tagging in FTE does not allow partial write.
We agree to reserve bit 31 of CQE's ft_metadata for IPsec to avoid ASAP CT from dropping IPsec offloaded packet
Here is the new bit layout of REG_C1. Tunnel option id is reduced to 11 bits:
< IPSEC MARKER (1) | ESW_TUN_ID(12) | ESW_TUN_OPTS(11) | ESW_ZONE_ID(8) >
--- .../net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 2 +- include/linux/mlx5/eswitch.h | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +1 -1
@@ -617,7 +617,7 @@ static bool mlx5e_restore_skb(struct sk_buff *skb, u32 chain, u32 reg_c1, struct mlx5e_tc_update_priv *tc_priv) {struct mlx5e_priv *priv =netdev_priv (skb->dev); -u32 tunnel_id = reg_c1 >>ESW_TUN_OFFSET ; +u32 tunnel_id = (reg_c1 >>ESW_TUN_OFFSET ) &TUNNEL_ID_MASK ;if (chain) {struct mlx5_rep_uplink_priv *uplink_priv;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +1 -1
@@ -129,7 +129,7 @@ struct tunnel_match_enc_opts {*/ #define TUNNEL_INFO_BITS 12#define TUNNEL_INFO_BITS_MASK GENMASK(TUNNEL_INFO_BITS - 1, 0) -#define ENC_OPTS_BITS 12 +#define ENC_OPTS_BITS 11#define ENC_OPTS_BITS_MASK GENMASK(ENC_OPTS_BITS - 1, 0)#define TUNNEL_ID_BITS (TUNNEL_INFO_BITS + ENC_OPTS_BITS)#define TUNNEL_ID_MASK GENMASK(TUNNEL_ID_BITS - 1, 0)
include/linux/mlx5/eswitch.h +10 -7
@@ -98,10 +98,11 @@ u32 mlx5_eswitch_get_vport_metadata_for_set(struct mlx5_eswitch *esw, u16 vport_num);/* Reg C1 usage: -* Reg C1 = < ESW_TUN_ID(12) | ESW_TUN_OPTS(12) | ESW_ZONE_ID(8) > +* Reg C1 = < Reserved(1) | ESW_TUN_ID(12) | ESW_TUN_OPTS(11) | ESW_ZONE_ID(8) > * -* Highest 12 bits of reg c1 is the encapsulation tunnel id, next 12 bits is -* encapsulation tunnel options, and the lowest 8 bits are used for zone id. +* Highest bit is reserved for other offloads as marker bit, next 12 bits of reg c1 +* is the encapsulation tunnel id, next 11 bits is encapsulation tunnel options, +* and the lowest 8 bits are used for zone id. * * Zone id is used to restore CT flow when packet misses on chain. *
@@ -109,16 +110,18 @@ u32 mlx5_eswitch_get_vport_metadata_for_set(struct mlx5_eswitch *esw,* on miss and to support inner header rewrite by means of implicit chain 0 * flows. */ +#define ESW_RESERVED_BITS 1#define ESW_ZONE_ID_BITS 8 -#define ESW_TUN_OPTS_BITS 12 +#define ESW_TUN_OPTS_BITS 11#define ESW_TUN_ID_BITS 12#define ESW_TUN_OPTS_OFFSET ESW_ZONE_ID_BITS#define ESW_TUN_OFFSET ESW_TUN_OPTS_OFFSET#define ESW_ZONE_ID_MASK GENMASK(ESW_ZONE_ID_BITS - 1, 0) -#define ESW_TUN_OPTS_MASK GENMASK(32 - ESW_TUN_ID_BITS - 1, ESW_TUN_OPTS_OFFSET) -#define ESW_TUN_MASK GENMASK(31, ESW_TUN_OFFSET) +#define ESW_TUN_OPTS_MASK GENMASK(31 - ESW_TUN_ID_BITS - ESW_RESERVED_BITS, ESW_TUN_OPTS_OFFSET) +#define ESW_TUN_MASK GENMASK(31 - ESW_RESERVED_BITS, ESW_TUN_OFFSET)#define ESW_TUN_ID_SLOW_TABLE_GOTO_VPORT 0/* 0 is not a valid tunnel id */ -#define ESW_TUN_OPTS_SLOW_TABLE_GOTO_VPORT 0xFFF/* 0xFFF is a reserved mapping */ +/* 0x7FF is a reserved mapping */ +#define ESW_TUN_OPTS_SLOW_TABLE_GOTO_VPORT GENMASK(ESW_TUN_OPTS_BITS - 1, 0)#define ESW_TUN_SLOW_TABLE_GOTO_VPORT ((ESW_TUN_ID_SLOW_TABLE_GOTO_VPORT << ESW_TUN_OPTS_BITS) | \ ESW_TUN_OPTS_SLOW_TABLE_GOTO_VPORT)#define ESW_TUN_SLOW_TABLE_GOTO_VPORT_MARK ESW_TUN_OPTS_MASK
Signature · 1 line
2.31.1
PATCH v2 5/15 net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet
In reply to Saeed MahameedFrom: Huy Nguyen <[email protected]>
rep_tc copy REG_C1 to REG_B. IPsec crypto utilizes the whole REG_B register with BIT31 as IPsec marker. rep_tc_update_skb drops IPsec because it thought REG_B contains bad value.
In previous patch, BIT 31 of REG_C1 is reserved for IPsec. Skip the rep_tc_update_skb if BIT31 of REG_B is set.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 -2
@@ -1310,7 +1310,8 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)if (rep->vlan &&skb_vlan_tag_present (skb))skb_vlan_pop (skb); -if (!mlx5e_rep_tc_update_skb (cqe, skb, &tc_priv)) { +if (unlikely (!mlx5_ipsec_is_rx_flow (cqe) && + !mlx5e_rep_tc_update_skb (cqe, skb, &tc_priv))) {dev_kfree_skb_any (skb); goto free_wqe; }
@@ -1367,7 +1368,8 @@ static void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq, struct mlx5_cqe64mlx5e_complete_rx_cqe (rq, cqe, cqe_bcnt, skb); -if (!mlx5e_rep_tc_update_skb (cqe, skb, &tc_priv)) { +if (unlikely (!mlx5_ipsec_is_rx_flow (cqe) && + !mlx5e_rep_tc_update_skb (cqe, skb, &tc_priv))) {dev_kfree_skb_any (skb); goto mpwrq_cqe_out; }
Signature · 1 line
2.31.1
PATCH v2 6/15 net/mlx5e: RX, Remove unnecessary check in RX CQE compression handling
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
There are two reasons for exiting mlx5e_decompress_cqes_cont():
1. The compression session is completed (cqd.left == 0).
2. The budget is exhausted (work_done == budget).
If after calling mlx5e_decompress_cqes_cont() we have cqd.left > 0, it necessarily implies that budget is exhausted.
The first part of the complex condition is covered by the second, hence we remove it here.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -1
@@ -1560,7 +1560,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)if (rq->cqd.left) { work_done +=mlx5e_decompress_cqes_cont (rq, cqwq,0 , budget); -if (rq->cqd.left || work_done >= budget) +if (work_done >= budget) goto out; }
Signature · 1 line
2.31.1
PATCH v2 7/15 net/mlx5: DR, Remove unused field of send_ring struct
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Remove unused field of struct mlx5dr_send_ring
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +0 -1
@@ -1252,7 +1252,6 @@ struct mlx5dr_send_ring {u32 tx_head;void *buf;u32 buf_size; -struct ib_wc wc[MAX_SEND_CQE ];u8 sync_buff[MIN_READ_SYNC ];struct mlx5dr_mr *sync_mr;spinlock_t lock;/* Protect the data path of the send ring */
Signature · 1 line
2.31.1
PATCH v2 8/15 net/mlx5: Add case for FS_FT_NIC_TX FT in MLX5_CAP_FLOWTABLE_TYPE
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
Commit 16f1c5bb3ed7 ("net/mlx5: Check device capability for maximum flow counters") added MLX5_CAP_FLOWTABLE_TYPE but forgot to account for FS_FT_NIC_TX case in the expression.
Although the expression will return 1 for this case instead of the actual cap, there isn't currently no known side affects of missing this case.
Add the FS_FT_NIC_TX case.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +1 -0
@@ -331,6 +331,7 @@ void mlx5_fs_ingress_acls_cleanup(struct mlx5_core_dev *dev);#define MLX5_CAP_FLOWTABLE_TYPE (mdev, cap, type) ( \ (type == FS_FT_NIC_RX) ? MLX5_CAP_FLOWTABLE_NIC_RX(mdev, cap) : \ + (type == FS_FT_NIC_TX) ? MLX5_CAP_FLOWTABLE_NIC_TX(mdev, cap) : \ (type == FS_FT_ESW_EGRESS_ACL) ? MLX5_CAP_ESW_EGRESS_ACL(mdev, cap) : \ (type == FS_FT_ESW_INGRESS_ACL) ? MLX5_CAP_ESW_INGRESS_ACL(mdev, cap) : \ (type == FS_FT_FDB) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \
Signature · 1 line
2.31.1
PATCH v2 9/15 net/mlx5: Move table size calculation to steering cmd layer
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
Currently the table size is calculated by the fs_core layer. However, each steering cmd instance has a different allocation logic. FW steering uses a predefined pools of multiple sizes. SW steering doesn't have a pool, and can allocate any size of tables.
Move the table size calculation to the steering cmd layer as a pre-step for moving fs_chains pool logic globally to firmware steering, and increasing table sizes for software steering. In addition, change the size parameter to absolute size to allow the special zero value to mean "get next available maximum size".
--- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 10 ++++++++-- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 8 ++------ .../net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 6 ++++-- 4 files changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +8 -2
@@ -49,9 +49,11 @@ static int mlx5_cmd_stub_update_root_ft(struct mlx5_flow_root_namespace *ns,static int mlx5_cmd_stub_create_flow_table (struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, -unsigned int log_size, +unsigned int size,struct mlx5_flow_table *next_ft) { + ft->max_fte = size ?roundup_pow_of_two (size) :1 ; +return 0 ; }
@@ -181,7 +183,7 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,static int mlx5_cmd_create_flow_table (struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, -unsigned int log_size, +unsigned int size,struct mlx5_flow_table *next_ft) {int en_encap = !!(ft->flags &MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT );
@@ -190,8 +192,12 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,u32 out[MLX5_ST_SZ_DW (create_flow_table_out)] = {};u32 in[MLX5_ST_SZ_DW (create_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev; +unsigned int log_size =0 ;int err; + log_size = size ?ilog2 (roundup_pow_of_two (size)) :0 ; + ft->max_fte =1 << log_size; +MLX5_SET (create_flow_table_in, in, opcode,MLX5_CMD_OP_CREATE_FLOW_TABLE );
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +1 -1
@@ -38,7 +38,7 @@struct mlx5_flow_cmds {int (*create_flow_table)(struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, -unsigned int log_size, +unsigned int size,struct mlx5_flow_table *next_ft);int (*destroy_flow_table)(struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft);
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +2 -6
@@ -752,7 +752,7 @@ static struct mlx5_flow_group *alloc_insert_flow_group(struct mlx5_flow_table *freturn fg; } -static struct mlx5_flow_table *alloc_flow_table (int level,u16 vport,int max_fte, +static struct mlx5_flow_table *alloc_flow_table (int level,u16 vport,enum fs_flow_table_type table_type,enum fs_flow_table_op_mod op_mod,u32 flags)
@@ -775,7 +775,6 @@ static struct mlx5_flow_table *alloc_flow_table(int level, u16 vport, int max_ft ft->op_mod = op_mod; ft->type = table_type; ft->vport = vport; - ft->max_fte = max_fte; ft->flags = flags;INIT_LIST_HEAD (&ft->fwd_rules);mutex_init (&ft->lock);
@@ -1070,7 +1069,6 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespastruct mlx5_flow_table *next_ft;struct fs_prio *fs_prio =NULL ;struct mlx5_flow_table *ft; -int log_table_sz;int err;if (!root) {
@@ -1101,7 +1099,6 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa*/ ft =alloc_flow_table (ft_attr->level, vport, - ft_attr->max_fte ?roundup_pow_of_two (ft_attr->max_fte) :0 , root->table_type, op_mod, ft_attr->flags);if (IS_ERR (ft)) {
@@ -1110,12 +1107,11 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa }tree_init_node (&ft->node, del_hw_flow_table, del_sw_flow_table); - log_table_sz = ft->max_fte ?ilog2 (ft->max_fte) :0 ; next_ft = unmanaged ? ft_attr->next_ft :find_next_chained_ft (fs_prio); ft->def_miss_action = ns->def_miss_action; ft->ns = ns; - err = root->cmds->create_flow_table (root, ft, log_table_sz, next_ft); + err = root->cmds->create_flow_table (root, ft, ft_attr->max_fte, next_ft);if (err) goto free_ft;
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +4 -2
@@ -62,7 +62,7 @@ static int set_miss_action(struct mlx5_flow_root_namespace *ns,static int mlx5_cmd_dr_create_flow_table (struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, -unsigned int log_size, +unsigned int size,struct mlx5_flow_table *next_ft) {struct mlx5dr_table *tbl;
@@ -71,7 +71,7 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns,if (mlx5_dr_is_fw_table (ft->flags))return mlx5_fs_cmd_get_fw_cmds ()->create_flow_table (ns, ft, - log_size, + size, next_ft); flags = ft->flags;/* turn off encap/decap if not supported for sw-str by fw */
@@ -97,6 +97,8 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns, } } + ft->max_fte = size ?roundup_pow_of_two (size) :1 ; +return 0 ; }
Signature · 1 line
2.31.1
PATCH v2 10/15 net/mlx5: Move chains ft pool to be used by all firmware steering
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
Firmware FT pool is per device, but the software tracking of this pool only services fs_chains users, and if another layer takes a flow table, the pool will not be updated, and fs_chains will fail creating a flow table, with no recovery till the flow table is returned.
Move FT pool to be global per device, and stored at the cmd level, so all layers can use it.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 25 ++++-- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 27 ++++-- .../ethernet/mellanox/mlx5/core/fs_ft_pool.c | 83 +++++++++++++++++ .../ethernet/mellanox/mlx5/core/fs_ft_pool.h | 21 +++++ .../mellanox/mlx5/core/lib/fs_chains.c | 89 ++----------------- include/linux/mlx5/driver.h | 2 + 7 files changed, 151 insertions(+), 98 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -14,7 +14,7 @@ obj-$(CONFIG_MLX5_CORE) += mlx5_core.o 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 rl.o lag.o dev.o events.o wq.o lib/gid.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 \ diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \ fw_reset.o qos.o
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +19 -6
@@ -36,6 +36,7 @@#include "fs_core.h" #include "fs_cmd.h" +#include "fs_ft_pool.h" #include "mlx5_core.h" #include "eswitch.h"
@@ -192,18 +193,20 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,u32 out[MLX5_ST_SZ_DW (create_flow_table_out)] = {};u32 in[MLX5_ST_SZ_DW (create_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev; -unsigned int log_size =0 ;int err; - log_size = size ?ilog2 (roundup_pow_of_two (size)) :0 ; - ft->max_fte =1 << log_size; +if (size !=POOL_NEXT_SIZE ) + size =roundup_pow_of_two (size); + size =mlx5_ft_pool_get_avail_sz (dev, ft->type, size); +if (!size) +return -ENOSPC ;MLX5_SET (create_flow_table_in, in, opcode,MLX5_CMD_OP_CREATE_FLOW_TABLE );MLX5_SET (create_flow_table_in, in, table_type, ft->type);MLX5_SET (create_flow_table_in, in, flow_table_context.level, ft->level); -MLX5_SET (create_flow_table_in, in, flow_table_context.log_size, log_size); +MLX5_SET (create_flow_table_in, in, flow_table_context.log_size, size ?ilog2 (size) :0 );MLX5_SET (create_flow_table_in, in, vport_number, ft->vport);MLX5_SET (create_flow_table_in, in, other_vport, !!(ft->flags &MLX5_FLOW_TABLE_OTHER_VPORT ));
@@ -240,9 +243,14 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns, } err =mlx5_cmd_exec_inout (dev, create_flow_table, in, out); -if (!err) +if (!err) { ft->id =MLX5_GET (create_flow_table_out, out, table_id); + ft->max_fte = size; + }else { +mlx5_ft_pool_put_sz (ns->dev, size); + } +return err; }
@@ -251,6 +259,7 @@ static int mlx5_cmd_destroy_flow_table(struct mlx5_flow_root_namespace *ns, {u32 in[MLX5_ST_SZ_DW (destroy_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev; +int err;MLX5_SET (destroy_flow_table_in, in, opcode,MLX5_CMD_OP_DESTROY_FLOW_TABLE );
@@ -260,7 +269,11 @@ static int mlx5_cmd_destroy_flow_table(struct mlx5_flow_root_namespace *ns,MLX5_SET (destroy_flow_table_in, in, other_vport, !!(ft->flags &MLX5_FLOW_TABLE_OTHER_VPORT )); -return mlx5_cmd_exec_in (dev, destroy_flow_table, in); + err =mlx5_cmd_exec_in (dev, destroy_flow_table, in); +if (!err) +mlx5_ft_pool_put_sz (ns->dev, ft->max_fte); + +return err; } static int mlx5_cmd_modify_flow_table(struct mlx5_flow_root_namespace *ns,
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +20 -7
@@ -38,6 +38,7 @@#include "mlx5_core.h" #include "fs_core.h" #include "fs_cmd.h" +#include "fs_ft_pool.h" #include "diag/fs_tracepoint.h" #include "accel/ipsec.h" #include "fpga/ipsec.h"
@@ -1166,6 +1167,8 @@ mlx5_create_lag_demux_flow_table(struct mlx5_flow_namespace *ns, ft_attr.level = level; ft_attr.prio = prio; + ft_attr.max_fte =1 ; +return __mlx5_create_flow_table (ns, &ft_attr,FS_FT_OP_MOD_LAG_DEMUX ,0 ); }EXPORT_SYMBOL (mlx5_create_lag_demux_flow_table);
@@ -1175,19 +1178,20 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, struct mlx5_flow_table_attr *ft_attr) {int num_reserved_entries = ft_attr->autogroup.num_reserved_entries; -int autogroups_max_fte = ft_attr->max_fte - num_reserved_entries;int max_num_groups = ft_attr->autogroup.max_num_groups;struct mlx5_flow_table *ft; - -if (max_num_groups > autogroups_max_fte) -return ERR_PTR (-EINVAL ); -if (num_reserved_entries > ft_attr->max_fte) -return ERR_PTR (-EINVAL ); +int autogroups_max_fte; ft =mlx5_create_flow_table (ns, ft_attr);if (IS_ERR (ft))return ft; + autogroups_max_fte = ft->max_fte - num_reserved_entries; +if (max_num_groups > autogroups_max_fte) + goto err_validate; +if (num_reserved_entries > ft->max_fte) + goto err_validate; + ft->autogroup.active = true; ft->autogroup.required_groups = max_num_groups; ft->autogroup.max_fte = autogroups_max_fte;
@@ -1195,6 +1199,10 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, ft->autogroup.group_size = autogroups_max_fte / (max_num_groups +1 );return ft; + +err_validate: +mlx5_destroy_flow_table (ft); +return ERR_PTR (-ENOSPC ); }EXPORT_SYMBOL (mlx5_create_auto_grouped_flow_table);
@@ -2588,6 +2596,7 @@ void mlx5_cleanup_fs(struct mlx5_core_dev *dev)mlx5_cleanup_fc_stats (dev);kmem_cache_destroy (steering->ftes_cache);kmem_cache_destroy (steering->fgs_cache); +mlx5_ft_pool_destroy (dev);kfree (steering); }
@@ -2938,9 +2947,13 @@ int mlx5_init_fs(struct mlx5_core_dev *dev)if (err)return err; + err =mlx5_ft_pool_init (dev); +if (err) +return err; + steering =kzalloc (sizeof (*steering),GFP_KERNEL );if (!steering) -return -ENOMEM ; + goto err; steering->dev = dev; dev->priv.steering = steering;
drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c new file +83 -0
83 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2021 Mellanox Technologies. */ + +#ifndef __MLX5_FS_FT_POOL_H__ +#define __MLX5_FS_FT_POOL_H__ + +#include <linux/mlx5/driver.h> +#include "fs_core.h" + +#define POOL_NEXT_SIZE 0 + +int mlx5_ft_pool_init (struct mlx5_core_dev *dev); +void mlx5_ft_pool_destroy (struct mlx5_core_dev *dev); + +int +mlx5_ft_pool_get_avail_sz (struct mlx5_core_dev *dev,enum fs_flow_table_type table_type, +int desired_size); +void +mlx5_ft_pool_put_sz (struct mlx5_core_dev *dev,int sz); + +#endif /* __MLX5_FS_FT_POOL_H__ */
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +5 -84
159 lines not on this page · raw message
include/linux/mlx5/driver.h +2 -0
@@ -550,6 +550,7 @@ struct mlx5_adev {int idx; }; +struct mlx5_ft_pool ;struct mlx5_priv {/* IRQ table valid only for real pci devices PF or VF */ struct mlx5_irq_table *irq_table;
@@ -602,6 +603,7 @@ struct mlx5_priv {struct mlx5_core_roce roce;struct mlx5_fc_stats fc_stats;struct mlx5_rl_table rl_table; +struct mlx5_ft_pool *ft_pool;struct mlx5_bfreg_data bfregs;struct mlx5_uars_page *uar;
Signature · 1 line
2.31.1
PATCH v2 11/15 net/mlx5: DR, Set max table size to 2G entries
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
SW steering has no table size limitations.
However, fs_core API is size aware.
Set SW steering tables to the maximum possible table size (INT_MAX).
--- drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +1 -1
@@ -97,7 +97,7 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns, } } - ft->max_fte = size ?roundup_pow_of_two (size) :1 ; + ft->max_fte =INT_MAX ;return 0 ; }
Signature · 1 line
2.31.1
PATCH v2 12/15 net/mlx5: Cap the maximum flow group size to 16M entries
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
The maximum number of large flow groups applies to both small and large tables. For very large tables (such as the 2G SW steering tables) this may create a small number of flow groups each with an unrealistic entries domain (> 16M).
Set the maximum number of large flow groups to at least what user requested, but with a maximum per group size of 16M entries. For software steering, if user requested less than 128 large flow groups, it will gives us about 128 16M groups in a 2G entries tables.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +5 -0
@@ -1173,6 +1173,7 @@ mlx5_create_lag_demux_flow_table(struct mlx5_flow_namespace *ns, }EXPORT_SYMBOL (mlx5_create_lag_demux_flow_table); +#define MAX_FLOW_GROUP_SIZE BIT(24)struct mlx5_flow_table *mlx5_create_auto_grouped_flow_table (struct mlx5_flow_namespace *ns,struct mlx5_flow_table_attr *ft_attr)
@@ -1192,6 +1193,10 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,if (num_reserved_entries > ft->max_fte) goto err_validate; +/* Align the number of groups according to the largest group size */ +if (autogroups_max_fte / (max_num_groups +1 ) >MAX_FLOW_GROUP_SIZE ) + max_num_groups = (autogroups_max_fte /MAX_FLOW_GROUP_SIZE ) -1 ; + ft->autogroup.active = true; ft->autogroup.required_groups = max_num_groups; ft->autogroup.max_fte = autogroups_max_fte;
Signature · 1 line
2.31.1
PATCH v2 13/15 net/mlx5: Remove unnecessary spin lock protection
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
Taking lag_lock to access ldev->tracker is meaningless in the context of do_bond() and mlx5_lag_netdev_event().
--- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag.c +0 -4
@@ -280,9 +280,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)if (!mlx5_lag_is_ready (ldev))return ; -spin_lock (&lag_lock); tracker = ldev->tracker; -spin_unlock (&lag_lock); do_bond = tracker.is_bonded &&mlx5_lag_check_prereq (ldev);
@@ -481,9 +479,7 @@ static int mlx5_lag_netdev_event(struct notifier_block *this,break ; } -spin_lock (&lag_lock); ldev->tracker = tracker; -spin_unlock (&lag_lock);if (changed)mlx5_queue_bond_work (ldev,0 );
Signature · 1 line
2.31.1
PATCH v2 14/15 net/mlx5: Use boolean arithmetic to evaluate roce_lag
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
Avoid mixing boolean and bit arithmetic when evaluating validity of roce_lag.
--- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag.c +3 -2
@@ -289,8 +289,9 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) !mlx5_sriov_is_enabled (dev1);#ifdef CONFIG_MLX5_ESWITCH - roce_lag &= dev0->priv.eswitch->mode ==MLX5_ESWITCH_NONE && - dev1->priv.eswitch->mode ==MLX5_ESWITCH_NONE ; + roce_lag = roce_lag && + dev0->priv.eswitch->mode ==MLX5_ESWITCH_NONE && + dev1->priv.eswitch->mode ==MLX5_ESWITCH_NONE ;#endif if (roce_lag)
Signature · 1 line
2.31.1
PATCH v2 15/15 net/mlx5: Fix lag port remapping logic
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
Fix the logic so that if both ports netdevices are enabled or disabled, use the trivial mapping without swapping.
If only one of the netdevice's tx is enabled, use it to remap traffic to that port.
--- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag.c +13 -6
@@ -118,17 +118,24 @@ static bool __mlx5_lag_is_sriov(struct mlx5_lag *ldev)static void mlx5_infer_tx_affinity_mapping (struct lag_tracker *tracker,u8 *port1,u8 *port2) { +bool p1en; +bool p2en; + + p1en = tracker->netdev_state[MLX5_LAG_P1 ].tx_enabled && + tracker->netdev_state[MLX5_LAG_P1 ].link_up; + + p2en = tracker->netdev_state[MLX5_LAG_P2 ].tx_enabled && + tracker->netdev_state[MLX5_LAG_P2 ].link_up; + *port1 =1 ; *port2 =2 ; -if (!tracker->netdev_state[MLX5_LAG_P1 ].tx_enabled || - !tracker->netdev_state[MLX5_LAG_P1 ].link_up) { - *port1 =2 ; +if ((!p1en && !p2en) || (p1en && p2en))return ; - } -if (!tracker->netdev_state[MLX5_LAG_P2 ].tx_enabled || - !tracker->netdev_state[MLX5_LAG_P2 ].link_up) +if (p1en) *port2 =1 ; +else + *port1 =2 ; } void mlx5_modify_lag(struct mlx5_lag *ldev,
Signature · 1 line
2.31.1