Skip to content

Commit ba46c96

Browse files
committed
Merge tag 'mlx5-fixes-2023-05-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-fixes-2023-05-22 This series provides bug fixes for the mlx5 driver. Please pull and let me know if there is any problem. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 04910d8 + 1da438c commit ba46c96

File tree

17 files changed

+176
-59
lines changed

17 files changed

+176
-59
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,9 +1920,10 @@ static void mlx5_cmd_err_trace(struct mlx5_core_dev *dev, u16 opcode, u16 op_mod
19201920
static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
19211921
u32 syndrome, int err)
19221922
{
1923+
const char *namep = mlx5_command_str(opcode);
19231924
struct mlx5_cmd_stats *stats;
19241925

1925-
if (!err)
1926+
if (!err || !(strcmp(namep, "unknown command opcode")))
19261927
return;
19271928

19281929
stats = &dev->cmd.stats[opcode];

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ static bool mlx5e_ptp_poll_ts_cq(struct mlx5e_cq *cq, int budget)
175175
/* ensure cq space is freed before enabling more cqes */
176176
wmb();
177177

178+
mlx5e_txqsq_wake(&ptpsq->txqsq);
179+
178180
return work_done == budget;
179181
}
180182

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,11 +1369,13 @@ static void mlx5e_invalidate_encap(struct mlx5e_priv *priv,
13691369
struct mlx5e_tc_flow *flow;
13701370

13711371
list_for_each_entry(flow, encap_flows, tmp_list) {
1372-
struct mlx5_flow_attr *attr = flow->attr;
13731372
struct mlx5_esw_flow_attr *esw_attr;
1373+
struct mlx5_flow_attr *attr;
13741374

13751375
if (!mlx5e_is_offloaded_flow(flow))
13761376
continue;
1377+
1378+
attr = mlx5e_tc_get_encap_attr(flow);
13771379
esw_attr = attr->esw_attr;
13781380

13791381
if (flow_flag_test(flow, SLOW))

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ static inline u16 mlx5e_txqsq_get_next_pi(struct mlx5e_txqsq *sq, u16 size)
193193
return pi;
194194
}
195195

196+
void mlx5e_txqsq_wake(struct mlx5e_txqsq *sq);
197+
196198
static inline u16 mlx5e_shampo_get_cqe_header_index(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
197199
{
198200
return be16_to_cpu(cqe->shampo.header_entry_index) & (rq->mpwqe.shampo->hd_per_wq - 1);

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

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,11 +1665,9 @@ bool mlx5e_tc_is_vf_tunnel(struct net_device *out_dev, struct net_device *route_
16651665
int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *route_dev, u16 *vport)
16661666
{
16671667
struct mlx5e_priv *out_priv, *route_priv;
1668-
struct mlx5_devcom *devcom = NULL;
16691668
struct mlx5_core_dev *route_mdev;
16701669
struct mlx5_eswitch *esw;
16711670
u16 vhca_id;
1672-
int err;
16731671

16741672
out_priv = netdev_priv(out_dev);
16751673
esw = out_priv->mdev->priv.eswitch;
@@ -1678,6 +1676,9 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
16781676

16791677
vhca_id = MLX5_CAP_GEN(route_mdev, vhca_id);
16801678
if (mlx5_lag_is_active(out_priv->mdev)) {
1679+
struct mlx5_devcom *devcom;
1680+
int err;
1681+
16811682
/* In lag case we may get devices from different eswitch instances.
16821683
* If we failed to get vport num, it means, mostly, that we on the wrong
16831684
* eswitch.
@@ -1686,16 +1687,16 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
16861687
if (err != -ENOENT)
16871688
return err;
16881689

1690+
rcu_read_lock();
16891691
devcom = out_priv->mdev->priv.devcom;
1690-
esw = mlx5_devcom_get_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
1691-
if (!esw)
1692-
return -ENODEV;
1692+
esw = mlx5_devcom_get_peer_data_rcu(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
1693+
err = esw ? mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport) : -ENODEV;
1694+
rcu_read_unlock();
1695+
1696+
return err;
16931697
}
16941698

1695-
err = mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
1696-
if (devcom)
1697-
mlx5_devcom_release_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
1698-
return err;
1699+
return mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
16991700
}
17001701

17011702
static int
@@ -5301,6 +5302,8 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
53015302
goto err_action_counter;
53025303
}
53035304

5305+
mlx5_esw_offloads_devcom_init(esw);
5306+
53045307
return 0;
53055308

53065309
err_action_counter:
@@ -5329,7 +5332,7 @@ void mlx5e_tc_esw_cleanup(struct mlx5_rep_uplink_priv *uplink_priv)
53295332
priv = netdev_priv(rpriv->netdev);
53305333
esw = priv->mdev->priv.eswitch;
53315334

5332-
mlx5e_tc_clean_fdb_peer_flows(esw);
5335+
mlx5_esw_offloads_devcom_cleanup(esw);
53335336

53345337
mlx5e_tc_tun_cleanup(uplink_priv->encap);
53355338

@@ -5643,22 +5646,43 @@ bool mlx5e_tc_update_skb_nic(struct mlx5_cqe64 *cqe, struct sk_buff *skb)
56435646
0, NULL);
56445647
}
56455648

5649+
static struct mapping_ctx *
5650+
mlx5e_get_priv_obj_mapping(struct mlx5e_priv *priv)
5651+
{
5652+
struct mlx5e_tc_table *tc;
5653+
struct mlx5_eswitch *esw;
5654+
struct mapping_ctx *ctx;
5655+
5656+
if (is_mdev_switchdev_mode(priv->mdev)) {
5657+
esw = priv->mdev->priv.eswitch;
5658+
ctx = esw->offloads.reg_c0_obj_pool;
5659+
} else {
5660+
tc = mlx5e_fs_get_tc(priv->fs);
5661+
ctx = tc->mapping;
5662+
}
5663+
5664+
return ctx;
5665+
}
5666+
56465667
int mlx5e_tc_action_miss_mapping_get(struct mlx5e_priv *priv, struct mlx5_flow_attr *attr,
56475668
u64 act_miss_cookie, u32 *act_miss_mapping)
56485669
{
5649-
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
56505670
struct mlx5_mapped_obj mapped_obj = {};
5671+
struct mlx5_eswitch *esw;
56515672
struct mapping_ctx *ctx;
56525673
int err;
56535674

5654-
ctx = esw->offloads.reg_c0_obj_pool;
5655-
5675+
ctx = mlx5e_get_priv_obj_mapping(priv);
56565676
mapped_obj.type = MLX5_MAPPED_OBJ_ACT_MISS;
56575677
mapped_obj.act_miss_cookie = act_miss_cookie;
56585678
err = mapping_add(ctx, &mapped_obj, act_miss_mapping);
56595679
if (err)
56605680
return err;
56615681

5682+
if (!is_mdev_switchdev_mode(priv->mdev))
5683+
return 0;
5684+
5685+
esw = priv->mdev->priv.eswitch;
56625686
attr->act_id_restore_rule = esw_add_restore_rule(esw, *act_miss_mapping);
56635687
if (IS_ERR(attr->act_id_restore_rule))
56645688
goto err_rule;
@@ -5673,10 +5697,9 @@ int mlx5e_tc_action_miss_mapping_get(struct mlx5e_priv *priv, struct mlx5_flow_a
56735697
void mlx5e_tc_action_miss_mapping_put(struct mlx5e_priv *priv, struct mlx5_flow_attr *attr,
56745698
u32 act_miss_mapping)
56755699
{
5676-
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
5677-
struct mapping_ctx *ctx;
5700+
struct mapping_ctx *ctx = mlx5e_get_priv_obj_mapping(priv);
56785701

5679-
ctx = esw->offloads.reg_c0_obj_pool;
5680-
mlx5_del_flow_rules(attr->act_id_restore_rule);
5702+
if (is_mdev_switchdev_mode(priv->mdev))
5703+
mlx5_del_flow_rules(attr->act_id_restore_rule);
56815704
mapping_remove(ctx, act_miss_mapping);
56825705
}

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,17 @@ static void mlx5e_tx_wi_consume_fifo_skbs(struct mlx5e_txqsq *sq, struct mlx5e_t
762762
}
763763
}
764764

765+
void mlx5e_txqsq_wake(struct mlx5e_txqsq *sq)
766+
{
767+
if (netif_tx_queue_stopped(sq->txq) &&
768+
mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room) &&
769+
mlx5e_ptpsq_fifo_has_room(sq) &&
770+
!test_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
771+
netif_tx_wake_queue(sq->txq);
772+
sq->stats->wake++;
773+
}
774+
}
775+
765776
bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
766777
{
767778
struct mlx5e_sq_stats *stats;
@@ -861,13 +872,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
861872

862873
netdev_tx_completed_queue(sq->txq, npkts, nbytes);
863874

864-
if (netif_tx_queue_stopped(sq->txq) &&
865-
mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room) &&
866-
mlx5e_ptpsq_fifo_has_room(sq) &&
867-
!test_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
868-
netif_tx_wake_queue(sq->txq);
869-
stats->wake++;
870-
}
875+
mlx5e_txqsq_wake(sq);
871876

872877
return (i == MLX5E_TX_CQ_POLL_BUDGET);
873878
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev)
11041104
struct mlx5_eq_table *table = dev->priv.eq_table;
11051105

11061106
mutex_lock(&table->lock); /* sync with create/destroy_async_eq */
1107-
mlx5_irq_table_destroy(dev);
1107+
mlx5_irq_table_free_irqs(dev);
11081108
mutex_unlock(&table->lock);
11091109
}
11101110

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ struct mlx5_eswitch {
342342
u32 large_group_num;
343343
} params;
344344
struct blocking_notifier_head n_head;
345+
bool paired[MLX5_MAX_PORTS];
345346
};
346347

347348
void esw_offloads_disable(struct mlx5_eswitch *esw);
@@ -369,6 +370,8 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs);
369370
void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw, bool clear_vf);
370371
void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw);
371372
void mlx5_eswitch_disable(struct mlx5_eswitch *esw);
373+
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw);
374+
void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw);
372375
int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
373376
u16 vport, const u8 *mac);
374377
int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
@@ -767,6 +770,8 @@ static inline void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) {}
767770
static inline int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs) { return 0; }
768771
static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw, bool clear_vf) {}
769772
static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw) {}
773+
static inline void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw) {}
774+
static inline void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw) {}
770775
static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; }
771776
static inline
772777
int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { return 0; }

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,9 @@ static int mlx5_esw_offloads_devcom_event(int event,
27422742
mlx5_eswitch_vport_match_metadata_enabled(peer_esw))
27432743
break;
27442744

2745+
if (esw->paired[mlx5_get_dev_index(peer_esw->dev)])
2746+
break;
2747+
27452748
err = mlx5_esw_offloads_set_ns_peer(esw, peer_esw, true);
27462749
if (err)
27472750
goto err_out;
@@ -2753,14 +2756,18 @@ static int mlx5_esw_offloads_devcom_event(int event,
27532756
if (err)
27542757
goto err_pair;
27552758

2759+
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = true;
2760+
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = true;
27562761
mlx5_devcom_set_paired(devcom, MLX5_DEVCOM_ESW_OFFLOADS, true);
27572762
break;
27582763

27592764
case ESW_OFFLOADS_DEVCOM_UNPAIR:
2760-
if (!mlx5_devcom_is_paired(devcom, MLX5_DEVCOM_ESW_OFFLOADS))
2765+
if (!esw->paired[mlx5_get_dev_index(peer_esw->dev)])
27612766
break;
27622767

27632768
mlx5_devcom_set_paired(devcom, MLX5_DEVCOM_ESW_OFFLOADS, false);
2769+
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = false;
2770+
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = false;
27642771
mlx5_esw_offloads_unpair(peer_esw);
27652772
mlx5_esw_offloads_unpair(esw);
27662773
mlx5_esw_offloads_set_ns_peer(esw, peer_esw, false);
@@ -2779,7 +2786,7 @@ static int mlx5_esw_offloads_devcom_event(int event,
27792786
return err;
27802787
}
27812788

2782-
static void esw_offloads_devcom_init(struct mlx5_eswitch *esw)
2789+
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw)
27832790
{
27842791
struct mlx5_devcom *devcom = esw->dev->priv.devcom;
27852792

@@ -2802,7 +2809,7 @@ static void esw_offloads_devcom_init(struct mlx5_eswitch *esw)
28022809
ESW_OFFLOADS_DEVCOM_PAIR, esw);
28032810
}
28042811

2805-
static void esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)
2812+
void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)
28062813
{
28072814
struct mlx5_devcom *devcom = esw->dev->priv.devcom;
28082815

@@ -3250,8 +3257,6 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
32503257
if (err)
32513258
goto err_vports;
32523259

3253-
esw_offloads_devcom_init(esw);
3254-
32553260
return 0;
32563261

32573262
err_vports:
@@ -3292,7 +3297,6 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,
32923297

32933298
void esw_offloads_disable(struct mlx5_eswitch *esw)
32943299
{
3295-
esw_offloads_devcom_cleanup(esw);
32963300
mlx5_eswitch_disable_pf_vf_vports(esw);
32973301
esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
32983302
esw_set_passing_vport_metadata(esw, false);

0 commit comments

Comments
 (0)