Mellanox, mlx5 fixes 2020-03-24
Hi Dave,
This series introduces some fixes to mlx5 driver.
From Aya, Fixes to the RX error recovery flows
From Leon, Fix IB capability mask
Please pull and let me know if there is any problem.
For -stable v5.5
('net/mlx5_core: Set IB capability mask1 to fix ib_srpt connection failure')
For -stable v5.4
('net/mlx5e: Fix ICOSQ recovery flow with Striding RQ') ('net/mlx5e: Do not recover from a non-fatal syndrome') ('net/mlx5e: Fix missing reset of SW metadata in Striding RQ reset') ('net/mlx5e: Enhance ICOSQ WQE info fields')
The above patch ('net/mlx5e: Enhance ICOSQ WQE info fields') will fail to apply cleanly on v5.4 due to a trivial contextual conflict, but it is an important fix, do I need to do something about it or just assume Greg will know how to handle this ?
Thanks,
Saeed.
---
The following changes since commit 81573b18f26defe672a7d960f9af9ac2c97f324d:
selftests/net/forwarding: add Makefile to install tests (2020-03-23 21:55:30 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2020-03-24
for you to fetch changes up to 187a9830c921d92c4a9a8e2921ecc4b35a97532c:
net/mlx5e: Do not recover from a non-fatal syndrome (2020-03-24 14:43:07 -0700)
----------------------------------------------------------------
mlx5-fixes-2020-03-24
----------------------------------------------------------------
Aya Levin (4):
net/mlx5e: Enhance ICOSQ WQE info fields
net/mlx5e: Fix missing reset of SW metadata in Striding RQ reset net/mlx5e: Fix ICOSQ recovery flow with Striding RQ net/mlx5e: Do not recover from a non-fatal syndrome
Leon Romanovsky (1):
net/mlx5_core: Set IB capability mask1 to fix ib_srpt connection failure
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 ++ .../net/ethernet/mellanox/mlx5/core/en/health.h | 3 +-- .../ethernet/mellanox/mlx5/core/en/reporter_rx.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 6 +++-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 31 +++++++++++++++++----- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 ++++---- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/vport.c | 3 +++ 8 files changed, 41 insertions(+), 18 deletions(-)
PATCH 1/5 net/mlx5_core: Set IB capability mask1 to fix ib_srpt connection failure
From: Leon Romanovsky <[email protected]>
The cap_mask1 isn't protected by field_select and not listed among RW fields, but it is required to be written to properly initialize ports in IB virtualization mode.
--- drivers/net/ethernet/mellanox/mlx5/core/vport.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/vport.c +3 -0
@@ -1071,6 +1071,9 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,MLX5_SET64 (hca_vport_context, ctx, port_guid, req->port_guid);if (req->field_select &MLX5_HCA_VPORT_SEL_NODE_GUID )MLX5_SET64 (hca_vport_context, ctx, node_guid, req->node_guid); +MLX5_SET (hca_vport_context, ctx, cap_mask1, req->cap_mask1); +MLX5_SET (hca_vport_context, ctx, cap_mask1_field_select, + req->cap_mask1_perm); err =mlx5_cmd_exec (dev, in, in_sz, out,sizeof (out)); ex:kfree (in);
Signature · 1 line
2.25.1
PATCH 2/5 net/mlx5e: Enhance ICOSQ WQE info fields
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add number of WQEBBs (WQE's Basic Block) to WQE info struct. Set the number of WQEBBs on WQE post, and increment the consumer counter (cc) on completion.
In case of error completions, the cc was mistakenly not incremented, keeping a gap between cc and pc (producer counter). This failed the recovery flow on the ICOSQ from a CQE error which timed-out waiting for the cc and pc to meet.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 +++++------ drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 1 + 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -371,6 +371,7 @@ enum {struct mlx5e_sq_wqe_info {u8 opcode; +u8 num_wqebbs;/* Auxiliary data for different opcodes. */ union {
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +5 -6
@@ -477,6 +477,7 @@ static inline void mlx5e_fill_icosq_frag_edge(struct mlx5e_icosq *sq,/* fill sq frag edge with nops to avoid wqe wrapping two pages */ for (; wi < edge_wi; wi++) { wi->opcode =MLX5_OPCODE_NOP ; + wi->num_wqebbs =1 ;mlx5e_post_nop (wq, sq->sqn, &sq->pc); } }
@@ -525,6 +526,7 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) umr_wqe->uctrl.xlt_offset =cpu_to_be16 (xlt_offset); sq->db.ico_wqe[pi].opcode =MLX5_OPCODE_UMR ; + sq->db.ico_wqe[pi].num_wqebbs =MLX5E_UMR_WQEBBS ; sq->db.ico_wqe[pi].umr.rq = rq; sq->pc +=MLX5E_UMR_WQEBBS ;
@@ -621,6 +623,7 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) ci =mlx5_wq_cyc_ctr2ix (&sq->wq, sqcc); wi = &sq->db.ico_wqe[ci]; + sqcc += wi->num_wqebbs;if (last_wqe &&unlikely (get_cqe_opcode (cqe) !=MLX5_CQE_REQ )) { netdev_WARN_ONCE(cq->channel->netdev,
@@ -631,16 +634,12 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)break ; } -if (likely (wi->opcode ==MLX5_OPCODE_UMR )) { - sqcc +=MLX5E_UMR_WQEBBS ; +if (likely (wi->opcode ==MLX5_OPCODE_UMR )) wi->umr.rq->mpwqe.umr_completed++; - }else if (likely (wi->opcode ==MLX5_OPCODE_NOP )) { - sqcc++; - }else { +else if (unlikely (wi->opcode !=MLX5_OPCODE_NOP ))netdev_WARN_ONCE (cq->channel->netdev,"Bad OPCODE in ICOSQ WQE info: 0x%x\n" , wi->opcode); - } }while (!last_wqe);
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +1 -0
@@ -78,6 +78,7 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq)u16 pi =mlx5_wq_cyc_ctr2ix (wq, sq->pc); sq->db.ico_wqe[pi].opcode =MLX5_OPCODE_NOP ; + sq->db.ico_wqe[pi].num_wqebbs =1 ; nopwqe =mlx5e_post_nop (wq, sq->sqn, &sq->pc);mlx5e_notify_hw (wq, sq->pc, sq->uar_map, &nopwqe->ctrl); }
Signature · 1 line
2.25.1
PATCH 3/5 net/mlx5e: Fix missing reset of SW metadata in Striding RQ reset
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
When resetting the RQ (moving RQ state from RST to RDY), the driver resets the WQ's SW metadata.
In striding RQ mode, we maintain a field that reflects the actual expected WQ head (including in progress WQEs posted to the ICOSQ). It was mistakenly not reset together with the WQ. Fix this here.
--- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +4 -2
@@ -181,10 +181,12 @@ mlx5e_tx_dma_unmap(struct device *pdev, struct mlx5e_sq_dma *dma)static inline void mlx5e_rqwq_reset (struct mlx5e_rq *rq) { -if (rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) +if (rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) {mlx5_wq_ll_reset (&rq->mpwqe.wq); -else + rq->mpwqe.actual_wq_head =0 ; + }else {mlx5_wq_cyc_reset (&rq->wqe.wq); + } }/* SW parser related functions */
Signature · 1 line
2.25.1
PATCH 4/5 net/mlx5e: Fix ICOSQ recovery flow with Striding RQ
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
In striding RQ mode, the buffers of an RX WQE are first prepared and posted to the HW using a UMR WQEs via the ICOSQ. We maintain the state of these in-progress WQEs in the RQ SW struct.
In the flow of ICOSQ recovery, the corresponding RQ is not in error state, hence:
- The buffers of the in-progress WQEs must be released and the RQ metadata should reflect it.
- Existing RX WQEs in the RQ should not be affected.
For this, wrap the dealloc of the in-progress WQEs in a function, and use it in the ICOSQ recovery flow instead of mlx5e_free_rx_descs().
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../mellanox/mlx5/core/en/reporter_rx.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 31 ++++++++++++++----- 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -1060,6 +1060,7 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state);void mlx5e_activate_rq (struct mlx5e_rq *rq);void mlx5e_deactivate_rq (struct mlx5e_rq *rq);void mlx5e_free_rx_descs (struct mlx5e_rq *rq); +void mlx5e_free_rx_in_progress_descs (struct mlx5e_rq *rq);void mlx5e_activate_icosq (struct mlx5e_icosq *icosq);void mlx5e_deactivate_icosq (struct mlx5e_icosq *icosq);
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +1 -1
@@ -90,7 +90,7 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx) goto out;mlx5e_reset_icosq_cc_pc (icosq); -mlx5e_free_rx_descs (rq); +mlx5e_free_rx_in_progress_descs (rq);clear_bit (MLX5E_SQ_STATE_RECOVERING , &icosq->state);mlx5e_activate_icosq (icosq);mlx5e_activate_rq (rq);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +24 -7
@@ -813,6 +813,29 @@ int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time)return -ETIMEDOUT ; } +void mlx5e_free_rx_in_progress_descs (struct mlx5e_rq *rq) +{ +struct mlx5_wq_ll *wq; +u16 head; +int i; + +if (rq->wq_type !=MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) +return ; + + wq = &rq->mpwqe.wq; + head = wq->head; + +/* Outstanding UMR WQEs (in progress) start at wq->head */ +for (i =0 ; i < rq->mpwqe.umr_in_progress; i++) { + rq->dealloc_wqe (rq, head); + head =mlx5_wq_ll_get_wqe_next_ix (wq, head); + } + + rq->mpwqe.actual_wq_head = wq->head; + rq->mpwqe.umr_in_progress =0 ; + rq->mpwqe.umr_completed =0 ; +} +void mlx5e_free_rx_descs (struct mlx5e_rq *rq) {__be16 wqe_ix_be;
@@ -820,14 +843,8 @@ void mlx5e_free_rx_descs(struct mlx5e_rq *rq)if (rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) {struct mlx5_wq_ll *wq = &rq->mpwqe.wq; -u16 head = wq->head; -int i; -/* Outstanding UMR WQEs (in progress) start at wq->head */ -for (i =0 ; i < rq->mpwqe.umr_in_progress; i++) { - rq->dealloc_wqe (rq, head); - head =mlx5_wq_ll_get_wqe_next_ix (wq, head); - } +mlx5e_free_rx_in_progress_descs (rq);while (!mlx5_wq_ll_is_empty (wq)) {struct mlx5e_rx_wqe_ll *wqe;
Signature · 1 line
2.25.1
PATCH 5/5 net/mlx5e: Do not recover from a non-fatal syndrome
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
For non-fatal syndromes like LOCAL_LENGTH_ERR, recovery shouldn't be triggered. In these scenarios, the RQ is not actually in ERR state. This misleads the recovery flow which assumes that the RQ is really in error state and no more completions arrive, causing crashes on bad page state.
--- drivers/net/ethernet/mellanox/mlx5/core/en/health.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/health.h +1 -2
@@ -10,8 +10,7 @@static inline bool cqe_syndrome_needs_recover (u8 syndrome) { -return syndrome ==MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR || - syndrome ==MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR || +return syndrome ==MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR || syndrome ==MLX5_CQE_SYNDROME_LOCAL_PROT_ERR || syndrome ==MLX5_CQE_SYNDROME_WR_FLUSH_ERR ; }
Signature · 1 line
2.25.1
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Tue, 24 Mar 2020 14:52:52 -0700
Quoted 6 lines
This series introduces some fixes to mlx5 driver.
From Aya, Fixes to the RX error recovery flows
From Leon, Fix IB capability maskPlease pull and let me know if there is any problem.
Pulled.
Quoted 8 lines
For -stable v5.5
('net/mlx5_core: Set IB capability mask1 to fixib_srptconnection failure')For -stable v5.4
('net/mlx5e: Fix ICOSQ recovery flow with Striding RQ') ('net/mlx5e: Do not recover from a non-fatal syndrome') ('net/mlx5e: Fix missing reset of SW metadata in Striding RQ reset') ('net/mlx5e: Enhance ICOSQ WQE info fields')
Queued up.
Quoted 4 lines
The above patch ('net/mlx5e: Enhance ICOSQ WQE info fields') will fail to apply cleanly on v5.4 due to a trivial contextual conflict, but it is an important fix, do I need to do something about it or just assume Greg will know how to handle this ?
I'll do my best to backport it and ask for your help if necessary.
Thanks.