Skip to content

Commit 6e79bd2

Browse files
committed
Merge tag 'mlx5-fixes-2023-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5 fixes 2023-04-19 This series provides bug fixes to mlx5 driver. * tag 'mlx5-fixes-2023-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: Revert "net/mlx5e: Don't use termination table when redundant" net/mlx5e: Nullify table pointer when failing to create net/mlx5: Use recovery timeout on sync reset flow Revert "net/mlx5: Remove "recovery" arg from mlx5_load_one() function" net/mlx5e: Fix error flow in representor failing to add vport rx rule net/mlx5: Release tunnel device after tc update skb net/mlx5: E-switch, Don't destroy indirect table in split rule net/mlx5: E-switch, Create per vport table based on devlink encap mode net/mlx5e: Release the label when replacing existing ct entry net/mlx5e: Don't clone flow post action attributes second time ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 7ecebee + 081abca commit 6e79bd2

File tree

16 files changed

+40
-54
lines changed

16 files changed

+40
-54
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
202202
break;
203203
/* On fw_activate action, also driver is reloaded and reinit performed */
204204
*actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
205-
ret = mlx5_load_one_devl_locked(dev, false);
205+
ret = mlx5_load_one_devl_locked(dev, true);
206206
break;
207207
default:
208208
/* Unsupported action should not get to this function */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,5 +715,6 @@ void mlx5e_rep_tc_receive(struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq,
715715
return;
716716

717717
free_skb:
718+
dev_put(tc_priv.fwd_dev);
718719
dev_kfree_skb_any(skb);
719720
}

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,17 @@ mlx5e_tc_post_act_offload(struct mlx5e_post_act *post_act,
106106
}
107107

108108
struct mlx5e_post_act_handle *
109-
mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *attr)
109+
mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *post_attr)
110110
{
111-
u32 attr_sz = ns_to_attr_sz(post_act->ns_type);
112111
struct mlx5e_post_act_handle *handle;
113-
struct mlx5_flow_attr *post_attr;
114112
int err;
115113

116114
handle = kzalloc(sizeof(*handle), GFP_KERNEL);
117-
post_attr = mlx5_alloc_flow_attr(post_act->ns_type);
118-
if (!handle || !post_attr) {
119-
kfree(post_attr);
115+
if (!handle) {
120116
kfree(handle);
121117
return ERR_PTR(-ENOMEM);
122118
}
123119

124-
memcpy(post_attr, attr, attr_sz);
125120
post_attr->chain = 0;
126121
post_attr->prio = 0;
127122
post_attr->ft = post_act->ft;
@@ -145,7 +140,6 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *at
145140
return handle;
146141

147142
err_xarray:
148-
kfree(post_attr);
149143
kfree(handle);
150144
return ERR_PTR(err);
151145
}
@@ -164,7 +158,6 @@ mlx5e_tc_post_act_del(struct mlx5e_post_act *post_act, struct mlx5e_post_act_han
164158
if (!IS_ERR_OR_NULL(handle->rule))
165159
mlx5e_tc_post_act_unoffload(post_act, handle);
166160
xa_erase(&post_act->ids, handle->id);
167-
kfree(handle->attr);
168161
kfree(handle);
169162
}
170163

drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void
1919
mlx5e_tc_post_act_destroy(struct mlx5e_post_act *post_act);
2020

2121
struct mlx5e_post_act_handle *
22-
mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *attr);
22+
mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *post_attr);
2323

2424
void
2525
mlx5e_tc_post_act_del(struct mlx5e_post_act *post_act, struct mlx5e_post_act_handle *handle);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
#define MLX5_ESW_VPORT_TBL_SIZE_SAMPLE (64 * 1024)
1616

17-
static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_sample_ns = {
17+
static struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_sample_ns = {
1818
.max_fte = MLX5_ESW_VPORT_TBL_SIZE_SAMPLE,
1919
.max_num_groups = 0, /* default num of groups */
20-
.flags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT | MLX5_FLOW_TABLE_TUNNEL_EN_DECAP,
20+
.flags = 0,
2121
};
2222

2323
struct mlx5e_tc_psample {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
920920
zone_rule->rule = rule;
921921
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, old_attr, zone_rule->mh);
922922
zone_rule->mh = mh;
923+
mlx5_put_label_mapping(ct_priv, old_attr->ct_attr.ct_labels_id);
923924

924925
kfree(old_attr);
925926
kvfree(spec);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ static int mlx5e_create_promisc_table(struct mlx5e_flow_steering *fs)
783783
ft->t = mlx5_create_auto_grouped_flow_table(fs->ns, &ft_attr);
784784
if (IS_ERR(ft->t)) {
785785
err = PTR_ERR(ft->t);
786+
ft->t = NULL;
786787
fs_err(fs, "fail to create promisc table err=%d\n", err);
787788
return err;
788789
}
@@ -810,7 +811,7 @@ static void mlx5e_del_promisc_rule(struct mlx5e_flow_steering *fs)
810811

811812
static void mlx5e_destroy_promisc_table(struct mlx5e_flow_steering *fs)
812813
{
813-
if (WARN(!fs->promisc.ft.t, "Trying to remove non-existing promiscuous table"))
814+
if (!fs->promisc.ft.t)
814815
return;
815816
mlx5e_del_promisc_rule(fs);
816817
mlx5_destroy_flow_table(fs->promisc.ft.t);
@@ -1490,6 +1491,8 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
14901491

14911492
void mlx5e_fs_cleanup(struct mlx5e_flow_steering *fs)
14921493
{
1494+
if (!fs)
1495+
return;
14931496
debugfs_remove_recursive(fs->dfs_root);
14941497
mlx5e_fs_ethtool_free(fs);
14951498
mlx5e_fs_tc_free(fs);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5270,6 +5270,7 @@ static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
52705270
mlx5e_health_destroy_reporters(priv);
52715271
mlx5e_ktls_cleanup(priv);
52725272
mlx5e_fs_cleanup(priv->fs);
5273+
priv->fs = NULL;
52735274
}
52745275

52755276
static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
828828
static void mlx5e_cleanup_rep(struct mlx5e_priv *priv)
829829
{
830830
mlx5e_fs_cleanup(priv->fs);
831+
priv->fs = NULL;
831832
}
832833

833834
static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
@@ -994,6 +995,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
994995
priv->rx_res = NULL;
995996
err_free_fs:
996997
mlx5e_fs_cleanup(priv->fs);
998+
priv->fs = NULL;
997999
return err;
9981000
}
9991001

drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct mlx5_vport_key {
1111
u16 prio;
1212
u16 vport;
1313
u16 vhca_id;
14-
const struct esw_vport_tbl_namespace *vport_ns;
14+
struct esw_vport_tbl_namespace *vport_ns;
1515
} __packed;
1616

1717
struct mlx5_vport_table {
@@ -21,6 +21,14 @@ struct mlx5_vport_table {
2121
struct mlx5_vport_key key;
2222
};
2323

24+
static void
25+
esw_vport_tbl_init(struct mlx5_eswitch *esw, struct esw_vport_tbl_namespace *ns)
26+
{
27+
if (esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE)
28+
ns->flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
29+
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
30+
}
31+
2432
static struct mlx5_flow_table *
2533
esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns,
2634
const struct esw_vport_tbl_namespace *vport_ns)
@@ -80,6 +88,7 @@ mlx5_esw_vporttbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr
8088
u32 hkey;
8189

8290
mutex_lock(&esw->fdb_table.offloads.vports.lock);
91+
esw_vport_tbl_init(esw, attr->vport_ns);
8392
hkey = flow_attr_to_vport_key(esw, attr, &skey);
8493
e = esw_vport_tbl_lookup(esw, &skey, hkey);
8594
if (e) {
@@ -127,6 +136,7 @@ mlx5_esw_vporttbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr
127136
u32 hkey;
128137

129138
mutex_lock(&esw->fdb_table.offloads.vports.lock);
139+
esw_vport_tbl_init(esw, attr->vport_ns);
130140
hkey = flow_attr_to_vport_key(esw, attr, &key);
131141
e = esw_vport_tbl_lookup(esw, &key, hkey);
132142
if (!e || --e->num_rules)

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ struct mlx5_vport_tbl_attr {
674674
u32 chain;
675675
u16 prio;
676676
u16 vport;
677-
const struct esw_vport_tbl_namespace *vport_ns;
677+
struct esw_vport_tbl_namespace *vport_ns;
678678
};
679679

680680
struct mlx5_flow_table *

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
#define MLX5_ESW_FT_OFFLOADS_DROP_RULE (1)
7575

76-
static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = {
76+
static struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = {
7777
.max_fte = MLX5_ESW_VPORT_TBL_SIZE,
7878
.max_num_groups = MLX5_ESW_VPORT_TBL_NUM_GROUPS,
7979
.flags = 0,
@@ -760,7 +760,6 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
760760
kfree(dest);
761761
return rule;
762762
err_chain_src_rewrite:
763-
esw_put_dest_tables_loop(esw, attr, 0, i);
764763
mlx5_esw_vporttbl_put(esw, &fwd_attr);
765764
err_get_fwd:
766765
mlx5_chains_put_table(chains, attr->chain, attr->prio, 0);
@@ -803,7 +802,6 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
803802
if (fwd_rule) {
804803
mlx5_esw_vporttbl_put(esw, &fwd_attr);
805804
mlx5_chains_put_table(chains, attr->chain, attr->prio, 0);
806-
esw_put_dest_tables_loop(esw, attr, 0, esw_attr->split_count);
807805
} else {
808806
if (split)
809807
mlx5_esw_vporttbl_put(esw, &fwd_attr);

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

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,6 @@ static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw,
210210
return (port_mask & port_value) == MLX5_VPORT_UPLINK;
211211
}
212212

213-
static bool
214-
mlx5_eswitch_is_push_vlan_no_cap(struct mlx5_eswitch *esw,
215-
struct mlx5_flow_act *flow_act)
216-
{
217-
if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH &&
218-
!(mlx5_fs_get_capabilities(esw->dev, MLX5_FLOW_NAMESPACE_FDB) &
219-
MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX))
220-
return true;
221-
222-
return false;
223-
}
224-
225213
bool
226214
mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
227215
struct mlx5_flow_attr *attr,
@@ -237,7 +225,10 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
237225
(!mlx5_eswitch_offload_is_uplink_port(esw, spec) && !esw_attr->int_port))
238226
return false;
239227

240-
if (mlx5_eswitch_is_push_vlan_no_cap(esw, flow_act))
228+
/* push vlan on RX */
229+
if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH &&
230+
!(mlx5_fs_get_capabilities(esw->dev, MLX5_FLOW_NAMESPACE_FDB) &
231+
MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX))
241232
return true;
242233

243234
/* hairpin */
@@ -261,31 +252,19 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
261252
struct mlx5_flow_act term_tbl_act = {};
262253
struct mlx5_flow_handle *rule = NULL;
263254
bool term_table_created = false;
264-
bool is_push_vlan_on_rx;
265255
int num_vport_dests = 0;
266256
int i, curr_dest;
267257

268-
is_push_vlan_on_rx = mlx5_eswitch_is_push_vlan_no_cap(esw, flow_act);
269258
mlx5_eswitch_termtbl_actions_move(flow_act, &term_tbl_act);
270259
term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
271260

272261
for (i = 0; i < num_dest; i++) {
273262
struct mlx5_termtbl_handle *tt;
274-
bool hairpin = false;
275263

276264
/* only vport destinations can be terminated */
277265
if (dest[i].type != MLX5_FLOW_DESTINATION_TYPE_VPORT)
278266
continue;
279267

280-
if (attr->dests[num_vport_dests].rep &&
281-
attr->dests[num_vport_dests].rep->vport == MLX5_VPORT_UPLINK)
282-
hairpin = true;
283-
284-
if (!is_push_vlan_on_rx && !hairpin) {
285-
num_vport_dests++;
286-
continue;
287-
}
288-
289268
if (attr->dests[num_vport_dests].flags & MLX5_ESW_DEST_ENCAP) {
290269
term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
291270
term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat;
@@ -333,9 +312,6 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
333312
for (curr_dest = 0; curr_dest < num_vport_dests; curr_dest++) {
334313
struct mlx5_termtbl_handle *tt = attr->dests[curr_dest].termtbl;
335314

336-
if (!tt)
337-
continue;
338-
339315
attr->dests[curr_dest].termtbl = NULL;
340316

341317
/* search for the destination associated with the

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)
167167
if (mlx5_health_wait_pci_up(dev))
168168
mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
169169
else
170-
mlx5_load_one(dev);
170+
mlx5_load_one(dev, true);
171171
devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0,
172172
BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
173173
BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
@@ -499,7 +499,7 @@ int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev)
499499
err = fw_reset->ret;
500500
if (test_and_clear_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags)) {
501501
mlx5_unload_one_devl_locked(dev, false);
502-
mlx5_load_one_devl_locked(dev, false);
502+
mlx5_load_one_devl_locked(dev, true);
503503
}
504504
out:
505505
clear_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,13 +1509,13 @@ int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)
15091509
return err;
15101510
}
15111511

1512-
int mlx5_load_one(struct mlx5_core_dev *dev)
1512+
int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery)
15131513
{
15141514
struct devlink *devlink = priv_to_devlink(dev);
15151515
int ret;
15161516

15171517
devl_lock(devlink);
1518-
ret = mlx5_load_one_devl_locked(dev, false);
1518+
ret = mlx5_load_one_devl_locked(dev, recovery);
15191519
devl_unlock(devlink);
15201520
return ret;
15211521
}
@@ -1912,7 +1912,8 @@ static void mlx5_pci_resume(struct pci_dev *pdev)
19121912

19131913
mlx5_pci_trace(dev, "Enter, loading driver..\n");
19141914

1915-
err = mlx5_load_one(dev);
1915+
err = mlx5_load_one(dev, false);
1916+
19161917
if (!err)
19171918
devlink_health_reporter_state_update(dev->priv.health.fw_fatal_reporter,
19181919
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
@@ -2003,7 +2004,7 @@ static int mlx5_resume(struct pci_dev *pdev)
20032004
{
20042005
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
20052006

2006-
return mlx5_load_one(dev);
2007+
return mlx5_load_one(dev, false);
20072008
}
20082009

20092010
static const struct pci_device_id mlx5_core_pci_table[] = {

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ int mlx5_init_one(struct mlx5_core_dev *dev);
321321
void mlx5_uninit_one(struct mlx5_core_dev *dev);
322322
void mlx5_unload_one(struct mlx5_core_dev *dev, bool suspend);
323323
void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend);
324-
int mlx5_load_one(struct mlx5_core_dev *dev);
324+
int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery);
325325
int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery);
326326

327327
int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, u16 function_id,

0 commit comments

Comments
 (0)