i40iw: Fixes for i40iw
cover i40iw: Fixes for i40iw
The following patch series has fixes for the i40iw driver.
Henry Orosco (2):
i40iw: Add missing memory barrier
i40iw: Update list correctly
Mustafa Ismail (2):
i40iw: Fix order of cleanup in close
i40iw: Do not poll CCQ after it is destroyed
Shiraz Saleem (4):
i40iw: Utilize iwdev->reset during PCI function reset
i40iw: Release cm_id ref on PCI function reset
i40iw: Free QP resources on CQP destroy QP failure
i40iw: Avoid memory leak of CQP request objects
drivers/infiniband/hw/i40iw/i40iw.h | 1 + drivers/infiniband/hw/i40iw/i40iw_cm.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 2 ++ drivers/infiniband/hw/i40iw/i40iw_main.c | 60 +++++++++++++++---------------- drivers/infiniband/hw/i40iw/i40iw_puda.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_utils.c | 60 +++++++++++++++++++++++++++++-- 6 files changed, 99 insertions(+), 34 deletions(-)
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170623210402.19988-1-henry.orosco-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/8 i40iw: Fix order of cleanup in close
From: Mustafa Ismail <[email protected]>
The order for calling i40iw_destroy_pble_pool is incorrect. Also, add PBLE_CHUNK_MEM init state to track pble pool creation and destruction.
--- drivers/infiniband/hw/i40iw/i40iw_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_main.c +4 -3
@@ -1474,6 +1474,9 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)unregister_inet6addr_notifier (&i40iw_inetaddr6_notifier); }/* fallthrough */ +case PBLE_CHUNK_MEM : +i40iw_destroy_pble_pool (dev, iwdev->pble_rsrc); +/* fallthrough */ case CEQ_CREATED :i40iw_dele_ceqs (iwdev, reset);/* fallthrough */
@@ -1489,9 +1492,6 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)case CCQ_CREATED :i40iw_destroy_ccq (iwdev, reset);/* fallthrough */ -case PBLE_CHUNK_MEM : -i40iw_destroy_pble_pool (dev, iwdev->pble_rsrc); -/* fallthrough */ case HMC_OBJS_CREATED :i40iw_del_hmc_objects (dev, dev->hmc_info, true, reset);/* fallthrough */
@@ -1670,6 +1670,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client) status =i40iw_hmc_init_pble (&iwdev->sc_dev, iwdev->pble_rsrc);if (status)break ; + iwdev->init_state =PBLE_CHUNK_MEM ; iwdev->virtchnl_wq =alloc_ordered_workqueue ("iwvch" ,WQ_MEM_RECLAIM );i40iw_register_notifiers (); iwdev->init_state =INET_NOTIFIER ;
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/8 i40iw: Do not poll CCQ after it is destroyed
In reply to a message not in the archiveFrom: Mustafa Ismail <[email protected]>
Control Queue Pair (CQP) OPs, in this case - Update SDs, cannot poll the Control Completion Queue (CCQ) after CCQ is destroyed. Instead, poll via registers.
--- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +2 -0
@@ -1970,6 +1970,8 @@ static enum i40iw_status_code i40iw_sc_ccq_destroy(struct i40iw_sc_cq *ccq, ret_code =i40iw_cqp_poll_registers (cqp, tail,1000 ); } + cqp->process_cqp_sds = i40iw_update_sds_noccq; +return ret_code; }
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/8 i40iw: Utilize iwdev->reset during PCI function reset
In reply to a message not in the archiveFrom: Shiraz Saleem <[email protected]>
Utilize iwdev->reset on a PCI function reset notification instead of passing in reset flag for resource clean-up.
--- drivers/infiniband/hw/i40iw/i40iw_main.c | 51 +++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_main.c +24 -27
@@ -274,13 +274,12 @@ static void i40iw_disable_irq(struct i40iw_sc_dev *dev,/** * i40iw_destroy_aeq - destroy aeq * @iwdev: iwarp device -* @reset: true if called before reset * * Issue a destroy aeq request and * free the resources associated with the aeq * The function is called during driver unload */ -static void i40iw_destroy_aeq (struct i40iw_device *iwdev,bool reset) +static void i40iw_destroy_aeq (struct i40iw_device *iwdev) {enum i40iw_status_code status =I40IW_ERR_NOT_READY ;struct i40iw_sc_dev *dev = &iwdev->sc_dev;
@@ -288,7 +287,7 @@ static void i40iw_destroy_aeq(struct i40iw_device *iwdev, bool reset)if (!iwdev->msix_shared)i40iw_disable_irq (dev, iwdev->iw_msixtbl, (void *)iwdev); -if (reset) +if (iwdev->reset) goto exit;if (!dev->aeq_ops->aeq_destroy (&aeq->sc_aeq,0 ,1 ))
@@ -304,19 +303,17 @@ static void i40iw_destroy_aeq(struct i40iw_device *iwdev, bool reset)* i40iw_destroy_ceq - destroy ceq * @iwdev: iwarp device * @iwceq: ceq to be destroyed -* @reset: true if called before reset * * Issue a destroy ceq request and * free the resources associated with the ceq */ static void i40iw_destroy_ceq (struct i40iw_device *iwdev, -struct i40iw_ceq *iwceq, -bool reset) +struct i40iw_ceq *iwceq) {enum i40iw_status_code status;struct i40iw_sc_dev *dev = &iwdev->sc_dev; -if (reset) +if (iwdev->reset) goto exit; status = dev->ceq_ops->ceq_destroy (&iwceq->sc_ceq,0 ,1 );
@@ -335,12 +332,11 @@ static void i40iw_destroy_ceq(struct i40iw_device *iwdev,/** * i40iw_dele_ceqs - destroy all ceq's * @iwdev: iwarp device -* @reset: true if called before reset * * Go through all of the device ceq's and for each ceq * disable the ceq interrupt and destroy the ceq */ -static void i40iw_dele_ceqs (struct i40iw_device *iwdev,bool reset) +static void i40iw_dele_ceqs (struct i40iw_device *iwdev) {u32 i =0 ;struct i40iw_sc_dev *dev = &iwdev->sc_dev;
@@ -349,32 +345,31 @@ static void i40iw_dele_ceqs(struct i40iw_device *iwdev, bool reset)if (iwdev->msix_shared) {i40iw_disable_irq (dev, msix_vec, (void *)iwdev); -i40iw_destroy_ceq (iwdev, iwceq, reset); +i40iw_destroy_ceq (iwdev, iwceq); iwceq++; i++; }for (msix_vec++; i < iwdev->ceqs_count; i++, msix_vec++, iwceq++) {i40iw_disable_irq (dev, msix_vec, (void *)iwceq); -i40iw_destroy_ceq (iwdev, iwceq, reset); +i40iw_destroy_ceq (iwdev, iwceq); } }/** * i40iw_destroy_ccq - destroy control cq * @iwdev: iwarp device -* @reset: true if called before reset * * Issue destroy ccq request and * free the resources associated with the ccq */ -static void i40iw_destroy_ccq (struct i40iw_device *iwdev,bool reset) +static void i40iw_destroy_ccq (struct i40iw_device *iwdev) {struct i40iw_sc_dev *dev = &iwdev->sc_dev;struct i40iw_ccq *ccq = &iwdev->ccq;enum i40iw_status_code status =0 ; -if (!reset) +if (!iwdev->reset) status = dev->ccq_ops->ccq_destroy (dev->ccq,0 , true);if (status)i40iw_pr_err ("ccq destroy failed %d\n" , status);
@@ -810,7 +805,7 @@ static enum i40iw_status_code i40iw_setup_ceqs(struct i40iw_device *iwdev, iwceq->msix_idx = msix_vec->idx; status =i40iw_configure_ceq_vector (iwdev, iwceq, ceq_id, msix_vec);if (status) { -i40iw_destroy_ceq (iwdev, iwceq, false); +i40iw_destroy_ceq (iwdev, iwceq);break ; }i40iw_enable_intr (&iwdev->sc_dev, msix_vec->idx);
@@ -912,7 +907,7 @@ static enum i40iw_status_code i40iw_setup_aeq(struct i40iw_device *iwdev) status =i40iw_configure_aeq_vector (iwdev);if (status) { -i40iw_destroy_aeq (iwdev, false); +i40iw_destroy_aeq (iwdev);return status; }
@@ -1442,12 +1437,11 @@ static enum i40iw_status_code i40iw_save_msix_info(struct i40iw_device *iwdev,/** * i40iw_deinit_device - clean up the device resources * @iwdev: iwarp device -* @reset: true if called before reset * * Destroy the ib device interface, remove the mac ip entry and ipv4/ipv6 addresses, * destroy the device queues and free the pble and the hmc objects */ -static void i40iw_deinit_device (struct i40iw_device *iwdev,bool reset) +static void i40iw_deinit_device (struct i40iw_device *iwdev) {struct i40e_info *ldev = iwdev->ldev;
@@ -1464,7 +1458,7 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)i40iw_destroy_rdma_device (iwdev->iwibdev);/* fallthrough */ case IP_ADDR_REGISTERED : -if (!reset) +if (!iwdev->reset)i40iw_del_macip_entry (iwdev, (u8 )iwdev->mac_ip_table_idx);/* fallthrough */ case INET_NOTIFIER :
@@ -1478,22 +1472,22 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)i40iw_destroy_pble_pool (dev, iwdev->pble_rsrc);/* fallthrough */ case CEQ_CREATED : -i40iw_dele_ceqs (iwdev, reset); +i40iw_dele_ceqs (iwdev);/* fallthrough */ case AEQ_CREATED : -i40iw_destroy_aeq (iwdev, reset); +i40iw_destroy_aeq (iwdev);/* fallthrough */ case IEQ_CREATED : -i40iw_puda_dele_resources (&iwdev->vsi,I40IW_PUDA_RSRC_TYPE_IEQ , reset); +i40iw_puda_dele_resources (&iwdev->vsi,I40IW_PUDA_RSRC_TYPE_IEQ , iwdev->reset);/* fallthrough */ case ILQ_CREATED : -i40iw_puda_dele_resources (&iwdev->vsi,I40IW_PUDA_RSRC_TYPE_ILQ , reset); +i40iw_puda_dele_resources (&iwdev->vsi,I40IW_PUDA_RSRC_TYPE_ILQ , iwdev->reset);/* fallthrough */ case CCQ_CREATED : -i40iw_destroy_ccq (iwdev, reset); +i40iw_destroy_ccq (iwdev);/* fallthrough */ case HMC_OBJS_CREATED : -i40iw_del_hmc_objects (dev, dev->hmc_info, true, reset); +i40iw_del_hmc_objects (dev, dev->hmc_info, true, iwdev->reset);/* fallthrough */ case CQP_CREATED :i40iw_destroy_cqp (iwdev, true);
@@ -1694,7 +1688,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client) }while (0 );i40iw_pr_err ("status = %d last completion = %d\n" , status, iwdev->init_state); -i40iw_deinit_device (iwdev, false); +i40iw_deinit_device (iwdev);return -ERESTART ; }
@@ -1775,9 +1769,12 @@ static void i40iw_close(struct i40e_info *ldev, struct i40e_client *client, bool iwdev = &hdl->device; iwdev->closing = true; +if (reset) + iwdev->reset = true; +i40iw_cm_disconnect_all (iwdev);destroy_workqueue (iwdev->virtchnl_wq); -i40iw_deinit_device (iwdev, reset); +i40iw_deinit_device (iwdev); }/**
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/8 i40iw: Release cm_id ref on PCI function reset
In reply to a message not in the archiveFrom: Shiraz Saleem <[email protected]>
On PCI function reset, cm_id reference is not released which causes an application hang, as it waits on the cm_id to be released on rdma_destroy.
To fix this, call i40iw_cm_disconn during a PCI function reset to clean-up resources and release cm_id reference.
--- drivers/infiniband/hw/i40iw/i40iw_cm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_cm.c +4 -1
@@ -3487,7 +3487,8 @@ static void i40iw_cm_disconn_true(struct i40iw_qp *iwqp)if (((original_hw_tcp_state ==I40IW_TCP_STATE_CLOSED ) || (original_hw_tcp_state ==I40IW_TCP_STATE_TIME_WAIT ) || (last_ae ==I40IW_AE_RDMAP_ROE_BAD_LLP_CLOSE ) || - (last_ae ==I40IW_AE_LLP_CONNECTION_RESET ))) { + (last_ae ==I40IW_AE_LLP_CONNECTION_RESET ) || + iwdev->reset)) { issue_close =1 ; iwqp->cm_id =NULL ;if (!iwqp->flush_issued) {
@@ -4265,6 +4266,8 @@ void i40iw_cm_disconnect_all(struct i40iw_device *iwdev) cm_node = container_of(list_node, struct i40iw_cm_node, connected_entry); attr.qp_state =IB_QPS_ERR ;i40iw_modify_qp (&cm_node->iwqp->ibqp, &attr,IB_QP_STATE ,NULL ); +if (iwdev->reset) +i40iw_cm_disconn (cm_node->iwqp);i40iw_rem_ref_cm_node (cm_node); } }
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/8 i40iw: Free QP resources on CQP destroy QP failure
In reply to a message not in the archiveFrom: Shiraz Saleem <[email protected]>
Current flow leaves software QP structures in memory if Control Queue Pair (CQP) destroy QP OP fails. To fix this, free QP resources on fail of CQP destroy QP OP.
--- drivers/infiniband/hw/i40iw/i40iw_utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_utils.c +6 -2
@@ -546,8 +546,12 @@ void i40iw_rem_ref(struct ib_qp *ibqp) cqp_info->in.u.qp_destroy.scratch = (uintptr_t )cqp_request; cqp_info->in.u.qp_destroy.remove_hash_idx = true; status =i40iw_handle_cqp_op (iwdev, cqp_request); -if (status) -i40iw_pr_err ("CQP-OP Destroy QP fail" ); +if (!status) +return ; + +i40iw_rem_pdusecount (iwqp->iwpd, iwdev); +i40iw_free_qp_resources (iwdev, iwqp, qp_num); +i40iw_rem_devusecount (iwdev); }/**
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/8 i40iw: Add missing memory barrier
In reply to a message not in the archiveAdd missing write memory barrier before writing the header containing valid bit to the WQE in i40iw_puda_send.
--- drivers/infiniband/hw/i40iw/i40iw_puda.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/i40iw/i40iw_puda.c +3 -0
@@ -408,6 +408,9 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp,set_64bit_val (wqe,0 , info->paddr);set_64bit_val (wqe,8 ,LS_64 (info->len,I40IWQPSQ_FRAG_LEN ));set_64bit_val (wqe,16 , header[0 ]); + +/* Ensure all data is written before writing valid bit */ +wmb ();set_64bit_val (wqe,24 , header[1 ]);i40iw_debug_buf (qp->dev,I40IW_DEBUG_PUDA ,"PUDA SEND WQE" , wqe,32 );
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/8 i40iw: Update list correctly
In reply to a message not in the archiveTo avoid infinite loop, in i40iw_ieq_handle_exception, update plist inside while loop.
--- drivers/infiniband/hw/i40iw/i40iw_puda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -1
@@ -1414,10 +1414,10 @@ static void i40iw_ieq_handle_exception(struct i40iw_puda_rsrc *ieq,if (!list_empty (rxlist)) { tmpbuf = (struct i40iw_puda_buf *)rxlist->next; - plist = &tmpbuf->list;while ((struct list_head *)tmpbuf != rxlist) {if ((int )(buf->seqnum - tmpbuf->seqnum) <0 )break ; + plist = &tmpbuf->list; tmpbuf = (struct i40iw_puda_buf *)plist->next; }/* Insert buf before tmpbuf */
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/8 i40iw: Avoid memory leak of CQP request objects
In reply to a message not in the archiveFrom: Shiraz Saleem <[email protected]>
Control Queue Pair (CQP) request objects, which have not received a completion upon interface close, remain in memory.
To fix this, identify and free all pending CQP request objects during destroy CQP OP.
--- drivers/infiniband/hw/i40iw/i40iw.h | 1 + drivers/infiniband/hw/i40iw/i40iw_main.c | 2 ++ drivers/infiniband/hw/i40iw/i40iw_utils.c | 52 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+)
drivers/infiniband/hw/i40iw/i40iw.h +1 -0
@@ -527,6 +527,7 @@ enum i40iw_status_code i40iw_add_mac_addr(struct i40iw_device *iwdev,int i40iw_modify_qp (struct ib_qp *,struct ib_qp_attr *,int ,struct ib_udata *);void i40iw_cq_wq_destroy (struct i40iw_device *iwdev,struct i40iw_sc_cq *cq); +void i40iw_cleanup_pending_cqp_op (struct i40iw_device *iwdev);void i40iw_rem_pdusecount (struct i40iw_pd *iwpd,struct i40iw_device *iwdev);void i40iw_add_pdusecount (struct i40iw_pd *iwpd);void i40iw_rem_devusecount (struct i40iw_device *iwdev);
drivers/infiniband/hw/i40iw/i40iw_main.c +2 -0
@@ -243,6 +243,8 @@ static void i40iw_destroy_cqp(struct i40iw_device *iwdev, bool free_hwcqp)if (free_hwcqp) dev->cqp_ops->cqp_destroy (dev->cqp); +i40iw_cleanup_pending_cqp_op (iwdev); +i40iw_free_dma_mem (dev->hw, &cqp->sq);kfree (cqp->scratch_array); iwdev->cqp.scratch_array =NULL ;
drivers/infiniband/hw/i40iw/i40iw_utils.c +52 -0
70 lines not on this page · raw message
Signature · 6 lines
2.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Henry Orosco
The following patch series has fixes for the i40iw driver.
Henry Orosco (2):
i40iw: Add missing memory barrier
i40iw: Update list correctlyMustafa Ismail (2):
i40iw: Fix order of cleanup in close
i40iw: Do not poll CCQ after it is destroyedShiraz Saleem (4):
i40iw: Utilizeiwdev->resetduring PCI function reset
i40iw: Releasecm_idref on PCI function reset
i40iw: Free QP resources on CQP destroy QP failure
i40iw: Avoid memory leak of CQP request objects
Quoted 8 lines
drivers/infiniband/hw/i40iw/i40iw.h | 1 + drivers/infiniband/hw/i40iw/i40iw_cm.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 2 ++ drivers/infiniband/hw/i40iw/i40iw_main.c | 60 +++++++++++++++---------------- drivers/infiniband/hw/i40iw/i40iw_puda.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_utils.c | 60 +++++++++++++++++++++++++++++-- 6 files changed, 99 insertions(+), 34 deletions(-)
This series was accepted into 4.13-rc, thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD