Skip to content

Commit 5064561

Browse files
committed
Merge tag 'mlx5-fixes-2023-02-24' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahemeed says: ==================== mlx5 fixes 2023-02-24 V1->V2: - Toss away arguably non-fixes patches This series provides bug fixes for mlx5 driver. Please pull and let me know if there is any problem. ====================
2 parents 25ff6f8 + d28a06d commit 5064561

File tree

10 files changed

+40
-8
lines changed

10 files changed

+40
-8
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,8 @@ void mlx5_ec_cleanup(struct mlx5_core_dev *dev)
9898
err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_HOST_PF]);
9999
if (err)
100100
mlx5_core_warn(dev, "Timeout reclaiming external host PF pages err(%d)\n", err);
101+
102+
err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF]);
103+
if (err)
104+
mlx5_core_warn(dev, "Timeout reclaiming external host VFs pages err(%d)\n", err);
101105
}

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,19 @@ static bool mlx5e_ptp_ts_cqe_drop(struct mlx5e_ptpsq *ptpsq, u16 skb_cc, u16 skb
8686
return (ptpsq->ts_cqe_ctr_mask && (skb_cc != skb_id));
8787
}
8888

89-
static void mlx5e_ptp_skb_fifo_ts_cqe_resync(struct mlx5e_ptpsq *ptpsq, u16 skb_cc, u16 skb_id)
89+
static bool mlx5e_ptp_ts_cqe_ooo(struct mlx5e_ptpsq *ptpsq, u16 skb_id)
90+
{
91+
u16 skb_cc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_cc);
92+
u16 skb_pc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_pc);
93+
94+
if (PTP_WQE_CTR2IDX(skb_id - skb_cc) >= PTP_WQE_CTR2IDX(skb_pc - skb_cc))
95+
return true;
96+
97+
return false;
98+
}
99+
100+
static void mlx5e_ptp_skb_fifo_ts_cqe_resync(struct mlx5e_ptpsq *ptpsq, u16 skb_cc,
101+
u16 skb_id, int budget)
90102
{
91103
struct skb_shared_hwtstamps hwts = {};
92104
struct sk_buff *skb;
@@ -98,6 +110,7 @@ static void mlx5e_ptp_skb_fifo_ts_cqe_resync(struct mlx5e_ptpsq *ptpsq, u16 skb_
98110
hwts.hwtstamp = mlx5e_skb_cb_get_hwts(skb)->cqe_hwtstamp;
99111
skb_tstamp_tx(skb, &hwts);
100112
ptpsq->cq_stats->resync_cqe++;
113+
napi_consume_skb(skb, budget);
101114
skb_cc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_cc);
102115
}
103116
}
@@ -118,8 +131,14 @@ static void mlx5e_ptp_handle_ts_cqe(struct mlx5e_ptpsq *ptpsq,
118131
goto out;
119132
}
120133

121-
if (mlx5e_ptp_ts_cqe_drop(ptpsq, skb_cc, skb_id))
122-
mlx5e_ptp_skb_fifo_ts_cqe_resync(ptpsq, skb_cc, skb_id);
134+
if (mlx5e_ptp_ts_cqe_drop(ptpsq, skb_cc, skb_id)) {
135+
if (mlx5e_ptp_ts_cqe_ooo(ptpsq, skb_id)) {
136+
/* already handled by a previous resync */
137+
ptpsq->cq_stats->ooo_cqe_drop++;
138+
return;
139+
}
140+
mlx5e_ptp_skb_fifo_ts_cqe_resync(ptpsq, skb_cc, skb_id, budget);
141+
}
123142

124143
skb = mlx5e_skb_fifo_pop(&ptpsq->skb_fifo);
125144
hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, get_cqe_ts(cqe));

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,7 @@ void mlx5e_rep_tc_receive(struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq,
710710
else
711711
napi_gro_receive(rq->cq.napi, skb);
712712

713-
if (tc_priv.fwd_dev)
714-
dev_put(tc_priv.fwd_dev);
713+
dev_put(tc_priv.fwd_dev);
715714

716715
return;
717716

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mlx5e_tc_act_stats_create(void)
3737
int err;
3838

3939
handle = kvzalloc(sizeof(*handle), GFP_KERNEL);
40-
if (IS_ERR(handle))
40+
if (!handle)
4141
return ERR_PTR(-ENOMEM);
4242

4343
err = rhashtable_init(&handle->ht, &act_counters_ht_params);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq);
8686
static inline bool
8787
mlx5e_skb_fifo_has_room(struct mlx5e_skb_fifo *fifo)
8888
{
89-
return (*fifo->pc - *fifo->cc) < fifo->mask;
89+
return (u16)(*fifo->pc - *fifo->cc) < fifo->mask;
9090
}
9191

9292
static inline bool
@@ -302,6 +302,8 @@ void mlx5e_skb_fifo_push(struct mlx5e_skb_fifo *fifo, struct sk_buff *skb)
302302
static inline
303303
struct sk_buff *mlx5e_skb_fifo_pop(struct mlx5e_skb_fifo *fifo)
304304
{
305+
WARN_ON_ONCE(*fifo->pc == *fifo->cc);
306+
305307
return *mlx5e_skb_fifo_get(fifo, (*fifo->cc)++);
306308
}
307309

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,7 @@ static const struct counter_desc ptp_cq_stats_desc[] = {
21382138
{ MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, abort_abs_diff_ns) },
21392139
{ MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, resync_cqe) },
21402140
{ MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, resync_event) },
2141+
{ MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, ooo_cqe_drop) },
21412142
};
21422143

21432144
static const struct counter_desc ptp_rq_stats_desc[] = {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ struct mlx5e_ptp_cq_stats {
461461
u64 abort_abs_diff_ns;
462462
u64 resync_cqe;
463463
u64 resync_event;
464+
u64 ooo_cqe_drop;
464465
};
465466

466467
struct mlx5e_rep_stats {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,8 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
869869
dest.vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
870870
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
871871

872-
if (rep->vport == MLX5_VPORT_UPLINK)
872+
if (MLX5_CAP_ESW_FLOWTABLE(on_esw->dev, flow_source) &&
873+
rep->vport == MLX5_VPORT_UPLINK)
873874
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT;
874875

875876
flow_rule = mlx5_add_flow_rules(mlx5_eswitch_get_slow_fdb(on_esw),

drivers/net/ethernet/mellanox/mlx5/core/lib/geneve.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ int mlx5_geneve_tlv_option_add(struct mlx5_geneve *geneve, struct geneve_opt *op
105105
geneve->opt_type = opt->type;
106106
geneve->obj_id = res;
107107
geneve->refcount++;
108+
res = 0;
108109
}
109110

110111
unlock:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ mlx5_device_disable_sriov(struct mlx5_core_dev *dev, int num_vfs, bool clear_vf)
147147

148148
mlx5_eswitch_disable_sriov(dev->priv.eswitch, clear_vf);
149149

150+
/* For ECPFs, skip waiting for host VF pages until ECPF is destroyed */
151+
if (mlx5_core_is_ecpf(dev))
152+
return;
153+
150154
if (mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF]))
151155
mlx5_core_warn(dev, "timeout reclaiming VFs pages\n");
152156
}

0 commit comments

Comments
 (0)