Skip to content

Commit a460fc5

Browse files
committed
Merge tag 'mlx5-fixes-2020-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
mlx5-fixes-2020-04-20 Signed-off-by: David S. Miller <[email protected]>
2 parents 1c30fbc + dcdf4ce commit a460fc5

File tree

8 files changed

+40
-24
lines changed

8 files changed

+40
-24
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ config MLX5_CORE
77
tristate "Mellanox 5th generation network adapters (ConnectX series) core driver"
88
depends on PCI
99
select NET_DEVLINK
10-
imply PTP_1588_CLOCK
11-
imply VXLAN
12-
imply MLXFW
13-
imply PCI_HYPERV_INTERFACE
10+
depends on VXLAN || !VXLAN
11+
depends on MLXFW || !MLXFW
12+
depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
13+
depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
1414
default n
1515
---help---
1616
Core driver for low level functionality of the ConnectX-4 and

drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev)
935935
return NULL;
936936
}
937937

938-
tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
938+
tracer = kvzalloc(sizeof(*tracer), GFP_KERNEL);
939939
if (!tracer)
940940
return ERR_PTR(-ENOMEM);
941941

@@ -982,7 +982,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev)
982982
tracer->dev = NULL;
983983
destroy_workqueue(tracer->work_queue);
984984
free_tracer:
985-
kfree(tracer);
985+
kvfree(tracer);
986986
return ERR_PTR(err);
987987
}
988988

@@ -1061,7 +1061,7 @@ void mlx5_fw_tracer_destroy(struct mlx5_fw_tracer *tracer)
10611061
mlx5_fw_tracer_destroy_log_buf(tracer);
10621062
flush_workqueue(tracer->work_queue);
10631063
destroy_workqueue(tracer->work_queue);
1064-
kfree(tracer);
1064+
kvfree(tracer);
10651065
}
10661066

10671067
static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void *data)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ enum {
367367
MLX5E_SQ_STATE_AM,
368368
MLX5E_SQ_STATE_TLS,
369369
MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE,
370+
MLX5E_SQ_STATE_PENDING_XSK_TX,
370371
};
371372

372373
struct mlx5e_sq_wqe_info {
@@ -960,7 +961,7 @@ void mlx5e_page_release_dynamic(struct mlx5e_rq *rq,
960961
void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
961962
void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
962963
bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
963-
void mlx5e_poll_ico_cq(struct mlx5e_cq *cq);
964+
int mlx5e_poll_ico_cq(struct mlx5e_cq *cq);
964965
bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq);
965966
void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix);
966967
void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix);

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <net/flow_offload.h>
1313
#include <net/netfilter/nf_flow_table.h>
1414
#include <linux/workqueue.h>
15+
#include <linux/xarray.h>
1516

1617
#include "esw/chains.h"
1718
#include "en/tc_ct.h"
@@ -35,7 +36,7 @@ struct mlx5_tc_ct_priv {
3536
struct mlx5_eswitch *esw;
3637
const struct net_device *netdev;
3738
struct idr fte_ids;
38-
struct idr tuple_ids;
39+
struct xarray tuple_ids;
3940
struct rhashtable zone_ht;
4041
struct mlx5_flow_table *ct;
4142
struct mlx5_flow_table *ct_nat;
@@ -238,7 +239,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv,
238239

239240
mlx5_eswitch_del_offloaded_rule(esw, zone_rule->rule, attr);
240241
mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr);
241-
idr_remove(&ct_priv->tuple_ids, zone_rule->tupleid);
242+
xa_erase(&ct_priv->tuple_ids, zone_rule->tupleid);
242243
}
243244

244245
static void
@@ -483,7 +484,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
483484
struct mlx5_esw_flow_attr *attr = &zone_rule->attr;
484485
struct mlx5_eswitch *esw = ct_priv->esw;
485486
struct mlx5_flow_spec *spec = NULL;
486-
u32 tupleid = 1;
487+
u32 tupleid;
487488
int err;
488489

489490
zone_rule->nat = nat;
@@ -493,12 +494,12 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
493494
return -ENOMEM;
494495

495496
/* Get tuple unique id */
496-
err = idr_alloc_u32(&ct_priv->tuple_ids, zone_rule, &tupleid,
497-
TUPLE_ID_MAX, GFP_KERNEL);
497+
err = xa_alloc(&ct_priv->tuple_ids, &tupleid, zone_rule,
498+
XA_LIMIT(1, TUPLE_ID_MAX), GFP_KERNEL);
498499
if (err) {
499500
netdev_warn(ct_priv->netdev,
500501
"Failed to allocate tuple id, err: %d\n", err);
501-
goto err_idr_alloc;
502+
goto err_xa_alloc;
502503
}
503504
zone_rule->tupleid = tupleid;
504505

@@ -539,8 +540,8 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
539540
err_rule:
540541
mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr);
541542
err_mod_hdr:
542-
idr_remove(&ct_priv->tuple_ids, zone_rule->tupleid);
543-
err_idr_alloc:
543+
xa_erase(&ct_priv->tuple_ids, zone_rule->tupleid);
544+
err_xa_alloc:
544545
kfree(spec);
545546
return err;
546547
}
@@ -1299,7 +1300,7 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv)
12991300
}
13001301

13011302
idr_init(&ct_priv->fte_ids);
1302-
idr_init(&ct_priv->tuple_ids);
1303+
xa_init_flags(&ct_priv->tuple_ids, XA_FLAGS_ALLOC1);
13031304
mutex_init(&ct_priv->control_lock);
13041305
rhashtable_init(&ct_priv->zone_ht, &zone_params);
13051306

@@ -1334,7 +1335,7 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv)
13341335

13351336
rhashtable_destroy(&ct_priv->zone_ht);
13361337
mutex_destroy(&ct_priv->control_lock);
1337-
idr_destroy(&ct_priv->tuple_ids);
1338+
xa_destroy(&ct_priv->tuple_ids);
13381339
idr_destroy(&ct_priv->fte_ids);
13391340
kfree(ct_priv);
13401341

@@ -1352,7 +1353,7 @@ mlx5e_tc_ct_restore_flow(struct mlx5_rep_uplink_priv *uplink_priv,
13521353
if (!ct_priv || !tupleid)
13531354
return true;
13541355

1355-
zone_rule = idr_find(&ct_priv->tuple_ids, tupleid);
1356+
zone_rule = xa_load(&ct_priv->tuple_ids, tupleid);
13561357
if (!zone_rule)
13571358
return false;
13581359

drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ int mlx5e_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags)
3333
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &c->xskicosq.state)))
3434
return 0;
3535

36+
if (test_and_set_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state))
37+
return 0;
38+
3639
spin_lock(&c->xskicosq_lock);
3740
mlx5e_trigger_irq(&c->xskicosq);
3841
spin_unlock(&c->xskicosq_lock);

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3583,7 +3583,12 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
35833583
struct mlx5e_vport_stats *vstats = &priv->stats.vport;
35843584
struct mlx5e_pport_stats *pstats = &priv->stats.pport;
35853585

3586-
if (!mlx5e_monitor_counter_supported(priv)) {
3586+
/* In switchdev mode, monitor counters doesn't monitor
3587+
* rx/tx stats of 802_3. The update stats mechanism
3588+
* should keep the 802_3 layout counters updated
3589+
*/
3590+
if (!mlx5e_monitor_counter_supported(priv) ||
3591+
mlx5e_is_uplink_rep(priv)) {
35873592
/* update HW stats in background for next time */
35883593
mlx5e_queue_update_stats(priv);
35893594
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,19 +589,19 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
589589
return !!err;
590590
}
591591

592-
void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
592+
int mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
593593
{
594594
struct mlx5e_icosq *sq = container_of(cq, struct mlx5e_icosq, cq);
595595
struct mlx5_cqe64 *cqe;
596596
u16 sqcc;
597597
int i;
598598

599599
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
600-
return;
600+
return 0;
601601

602602
cqe = mlx5_cqwq_get_cqe(&cq->wq);
603603
if (likely(!cqe))
604-
return;
604+
return 0;
605605

606606
/* sq->cc must be updated only after mlx5_cqwq_update_db_record(),
607607
* otherwise a cq overrun may occur
@@ -650,6 +650,8 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
650650
sq->cc = sqcc;
651651

652652
mlx5_cqwq_update_db_record(&cq->wq);
653+
654+
return i;
653655
}
654656

655657
bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
152152
mlx5e_post_rx_wqes,
153153
rq);
154154
if (xsk_open) {
155-
mlx5e_poll_ico_cq(&c->xskicosq.cq);
155+
if (mlx5e_poll_ico_cq(&c->xskicosq.cq))
156+
/* Don't clear the flag if nothing was polled to prevent
157+
* queueing more WQEs and overflowing XSKICOSQ.
158+
*/
159+
clear_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state);
156160
busy |= mlx5e_poll_xdpsq_cq(&xsksq->cq);
157161
busy_xsk |= mlx5e_napi_xsk_post(xsksq, xskrq);
158162
}

0 commit comments

Comments
 (0)