Skip to content

Commit af9207a

Browse files
committed
Merge tag 'mlx5-updates-2021-05-26' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== 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. * tag 'mlx5-updates-2021-05-26' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5: Fix lag port remapping logic net/mlx5: Use boolean arithmetic to evaluate roce_lag net/mlx5: Remove unnecessary spin lock protection net/mlx5: Cap the maximum flow group size to 16M entries net/mlx5: DR, Set max table size to 2G entries net/mlx5: Move chains ft pool to be used by all firmware steering net/mlx5: Move table size calculation to steering cmd layer net/mlx5: Add case for FS_FT_NIC_TX FT in MLX5_CAP_FLOWTABLE_TYPE net/mlx5: DR, Remove unused field of send_ring struct net/mlx5e: RX, Remove unnecessary check in RX CQE compression handling net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet net/mlx5e: TC: Reserved bit 31 of REG_C1 for IPsec offload net/mlx5e: TC: Use bit counts for register mapping net/mlx5: CT: Avoid reusing modify header context for natted entries net/mlx5e: CT, Remove newline from ct_dbg call ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents eefa531 + 8613641 commit af9207a

File tree

19 files changed

+318
-193
lines changed

19 files changed

+318
-193
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
1414
mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
1515
health.o mcg.o cq.o alloc.o port.o mr.o pd.o \
1616
transobj.o vport.o sriov.o fs_cmd.o fs_core.o pci_irq.o \
17-
fs_counters.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
17+
fs_counters.o fs_ft_pool.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
1818
lib/devcom.o lib/pci_vsc.o lib/dm.o diag/fs_tracepoint.o \
1919
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \
2020
fw_reset.o qos.o

drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ static bool mlx5e_restore_skb(struct sk_buff *skb, u32 chain, u32 reg_c1,
617617
struct mlx5e_tc_update_priv *tc_priv)
618618
{
619619
struct mlx5e_priv *priv = netdev_priv(skb->dev);
620-
u32 tunnel_id = reg_c1 >> ESW_TUN_OFFSET;
620+
u32 tunnel_id = (reg_c1 >> ESW_TUN_OFFSET) & TUNNEL_ID_MASK;
621621

622622
if (chain) {
623623
struct mlx5_rep_uplink_priv *uplink_priv;

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "en_tc.h"
2424
#include "en_rep.h"
2525

26-
#define MLX5_CT_ZONE_BITS (mlx5e_tc_attr_to_reg_mappings[ZONE_TO_REG].mlen * 8)
26+
#define MLX5_CT_ZONE_BITS (mlx5e_tc_attr_to_reg_mappings[ZONE_TO_REG].mlen)
2727
#define MLX5_CT_ZONE_MASK GENMASK(MLX5_CT_ZONE_BITS - 1, 0)
2828
#define MLX5_CT_STATE_ESTABLISHED_BIT BIT(1)
2929
#define MLX5_CT_STATE_TRK_BIT BIT(2)
@@ -32,11 +32,11 @@
3232
#define MLX5_CT_STATE_RELATED_BIT BIT(5)
3333
#define MLX5_CT_STATE_INVALID_BIT BIT(6)
3434

35-
#define MLX5_FTE_ID_BITS (mlx5e_tc_attr_to_reg_mappings[FTEID_TO_REG].mlen * 8)
35+
#define MLX5_FTE_ID_BITS (mlx5e_tc_attr_to_reg_mappings[FTEID_TO_REG].mlen)
3636
#define MLX5_FTE_ID_MAX GENMASK(MLX5_FTE_ID_BITS - 1, 0)
3737
#define MLX5_FTE_ID_MASK MLX5_FTE_ID_MAX
3838

39-
#define MLX5_CT_LABELS_BITS (mlx5e_tc_attr_to_reg_mappings[LABELS_TO_REG].mlen * 8)
39+
#define MLX5_CT_LABELS_BITS (mlx5e_tc_attr_to_reg_mappings[LABELS_TO_REG].mlen)
4040
#define MLX5_CT_LABELS_MASK GENMASK(MLX5_CT_LABELS_BITS - 1, 0)
4141

4242
#define ct_dbg(fmt, args...)\
@@ -150,6 +150,11 @@ struct mlx5_ct_entry {
150150
unsigned long flags;
151151
};
152152

153+
static void
154+
mlx5_tc_ct_entry_destroy_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
155+
struct mlx5_flow_attr *attr,
156+
struct mlx5e_mod_hdr_handle *mh);
157+
153158
static const struct rhashtable_params cts_ht_params = {
154159
.head_offset = offsetof(struct mlx5_ct_entry, node),
155160
.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,
458463
ct_dbg("Deleting ct entry rule in zone %d", entry->tuple.zone);
459464

460465
mlx5_tc_rule_delete(netdev_priv(ct_priv->netdev), zone_rule->rule, attr);
461-
mlx5e_mod_hdr_detach(ct_priv->dev,
462-
ct_priv->mod_hdr_tbl, zone_rule->mh);
466+
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, zone_rule->mh);
463467
mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
464468
kfree(attr);
465469
}
@@ -686,15 +690,27 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
686690
if (err)
687691
goto err_mapping;
688692

689-
*mh = mlx5e_mod_hdr_attach(ct_priv->dev,
690-
ct_priv->mod_hdr_tbl,
691-
ct_priv->ns_type,
692-
&mod_acts);
693-
if (IS_ERR(*mh)) {
694-
err = PTR_ERR(*mh);
695-
goto err_mapping;
693+
if (nat) {
694+
attr->modify_hdr = mlx5_modify_header_alloc(ct_priv->dev, ct_priv->ns_type,
695+
mod_acts.num_actions,
696+
mod_acts.actions);
697+
if (IS_ERR(attr->modify_hdr)) {
698+
err = PTR_ERR(attr->modify_hdr);
699+
goto err_mapping;
700+
}
701+
702+
*mh = NULL;
703+
} else {
704+
*mh = mlx5e_mod_hdr_attach(ct_priv->dev,
705+
ct_priv->mod_hdr_tbl,
706+
ct_priv->ns_type,
707+
&mod_acts);
708+
if (IS_ERR(*mh)) {
709+
err = PTR_ERR(*mh);
710+
goto err_mapping;
711+
}
712+
attr->modify_hdr = mlx5e_mod_hdr_get(*mh);
696713
}
697-
attr->modify_hdr = mlx5e_mod_hdr_get(*mh);
698714

699715
dealloc_mod_hdr_actions(&mod_acts);
700716
return 0;
@@ -705,6 +721,17 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
705721
return err;
706722
}
707723

724+
static void
725+
mlx5_tc_ct_entry_destroy_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
726+
struct mlx5_flow_attr *attr,
727+
struct mlx5e_mod_hdr_handle *mh)
728+
{
729+
if (mh)
730+
mlx5e_mod_hdr_detach(ct_priv->dev, ct_priv->mod_hdr_tbl, mh);
731+
else
732+
mlx5_modify_header_dealloc(ct_priv->dev, attr->modify_hdr);
733+
}
734+
708735
static int
709736
mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
710737
struct flow_rule *flow_rule,
@@ -767,8 +794,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
767794
return 0;
768795

769796
err_rule:
770-
mlx5e_mod_hdr_detach(ct_priv->dev,
771-
ct_priv->mod_hdr_tbl, zone_rule->mh);
797+
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, zone_rule->mh);
772798
mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
773799
err_mod_hdr:
774800
kfree(attr);
@@ -918,7 +944,7 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
918944
}
919945

920946
if (rev_entry && refcount_inc_not_zero(&rev_entry->counter->refcount)) {
921-
ct_dbg("Using shared counter entry=0x%p rev=0x%p\n", entry, rev_entry);
947+
ct_dbg("Using shared counter entry=0x%p rev=0x%p", entry, rev_entry);
922948
shared_counter = rev_entry->counter;
923949
spin_unlock_bh(&ct_priv->ht_lock);
924950

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,60 +33,59 @@ struct mlx5_ct_attr {
3333
#define zone_to_reg_ct {\
3434
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_2,\
3535
.moffset = 0,\
36-
.mlen = 2,\
36+
.mlen = 16,\
3737
.soffset = MLX5_BYTE_OFF(fte_match_param,\
38-
misc_parameters_2.metadata_reg_c_2) + 2,\
38+
misc_parameters_2.metadata_reg_c_2),\
3939
}
4040

4141
#define ctstate_to_reg_ct {\
4242
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_2,\
43-
.moffset = 2,\
44-
.mlen = 2,\
43+
.moffset = 16,\
44+
.mlen = 16,\
4545
.soffset = MLX5_BYTE_OFF(fte_match_param,\
4646
misc_parameters_2.metadata_reg_c_2),\
4747
}
4848

4949
#define mark_to_reg_ct {\
5050
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_3,\
5151
.moffset = 0,\
52-
.mlen = 4,\
52+
.mlen = 32,\
5353
.soffset = MLX5_BYTE_OFF(fte_match_param,\
5454
misc_parameters_2.metadata_reg_c_3),\
5555
}
5656

5757
#define labels_to_reg_ct {\
5858
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_4,\
5959
.moffset = 0,\
60-
.mlen = 4,\
60+
.mlen = 32,\
6161
.soffset = MLX5_BYTE_OFF(fte_match_param,\
6262
misc_parameters_2.metadata_reg_c_4),\
6363
}
6464

6565
#define fteid_to_reg_ct {\
6666
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_5,\
6767
.moffset = 0,\
68-
.mlen = 4,\
68+
.mlen = 32,\
6969
.soffset = MLX5_BYTE_OFF(fte_match_param,\
7070
misc_parameters_2.metadata_reg_c_5),\
7171
}
7272

7373
#define zone_restore_to_reg_ct {\
7474
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_C_1,\
7575
.moffset = 0,\
76-
.mlen = (ESW_ZONE_ID_BITS / 8),\
76+
.mlen = ESW_ZONE_ID_BITS,\
7777
.soffset = MLX5_BYTE_OFF(fte_match_param,\
78-
misc_parameters_2.metadata_reg_c_1) + 3,\
78+
misc_parameters_2.metadata_reg_c_1),\
7979
}
8080

8181
#define nic_zone_restore_to_reg_ct {\
8282
.mfield = MLX5_ACTION_IN_FIELD_METADATA_REG_B,\
83-
.moffset = 2,\
84-
.mlen = (ESW_ZONE_ID_BITS / 8),\
83+
.moffset = 16,\
84+
.mlen = ESW_ZONE_ID_BITS,\
8585
}
8686

8787
#define REG_MAPPING_MLEN(reg) (mlx5e_tc_attr_to_reg_mappings[reg].mlen)
8888
#define REG_MAPPING_MOFFSET(reg) (mlx5e_tc_attr_to_reg_mappings[reg].moffset)
89-
#define REG_MAPPING_SHIFT(reg) (REG_MAPPING_MOFFSET(reg) * 8)
9089

9190
#if IS_ENABLED(CONFIG_MLX5_TC_CT)
9291

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,8 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
13101310
if (rep->vlan && skb_vlan_tag_present(skb))
13111311
skb_vlan_pop(skb);
13121312

1313-
if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
1313+
if (unlikely(!mlx5_ipsec_is_rx_flow(cqe) &&
1314+
!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))) {
13141315
dev_kfree_skb_any(skb);
13151316
goto free_wqe;
13161317
}
@@ -1367,7 +1368,8 @@ static void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq, struct mlx5_cqe64
13671368

13681369
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
13691370

1370-
if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
1371+
if (unlikely(!mlx5_ipsec_is_rx_flow(cqe) &&
1372+
!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))) {
13711373
dev_kfree_skb_any(skb);
13721374
goto mpwrq_cqe_out;
13731375
}
@@ -1558,7 +1560,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
15581560

15591561
if (rq->cqd.left) {
15601562
work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget);
1561-
if (rq->cqd.left || work_done >= budget)
1563+
if (work_done >= budget)
15621564
goto out;
15631565
}
15641566

0 commit comments

Comments
 (0)