i40iw: Fixes in i40iw for 4.15
v2 cover i40iw: Fixes in i40iw for 4.15
The following patches are for the 4.15 kernel.
Change Log
v1-v2:
Updated comments for "i40iw: Allocate a sdbuf per CQP WQE" Removed "i40iw: Change accelerated flag to bool" from series
Chien Tin Tung (2):
i40iw: Use sqsize to initialize cqp_requests elements
i40iw: Allocate a sdbuf per CQP WQE
Henry Orosco (1):
i40iw: Notify user of established connection after QP in RTS
Mustafa Ismail (3):
i40iw: Do not free sqbuf when event is I40IW_TIMER_TYPE_CLOSE
i40iw: Correct ARP index mask
i40iw: Reinitialize add_sd_cnt
Tatyana Nikolova (1):
i40iw: Move MPA request event for loopback after connect
drivers/infiniband/hw/i40iw/i40iw_cm.c | 28 +++++++++++++--------- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 41 ++++++++++++++++++++++---------- drivers/infiniband/hw/i40iw/i40iw_d.h | 6 +++-- drivers/infiniband/hw/i40iw/i40iw_main.c | 3 ++- 4 files changed, 51 insertions(+), 27 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): 20171121184502.14056-1-henry.orosco-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH v2 1/7 i40iw: Use sqsize to initialize cqp_requests elements
From: Chien Tin Tung <[email protected]>
Use sqsize instead of I40IW_CQP_SW_SQSIZE_2048 to initialize cqp_requests elements in the for-loop as sqsize is used to allocate memory for cqp_requests.
--- drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_main.c +1 -1
@@ -607,7 +607,7 @@ static enum i40iw_status_code i40iw_create_cqp(struct i40iw_device *iwdev)INIT_LIST_HEAD (&cqp->cqp_avail_reqs);INIT_LIST_HEAD (&cqp->cqp_pending_reqs);/* init the waitq of the cqp_requests and add them to the list */ -for (i =0 ; i <I40IW_CQP_SW_SQSIZE_2048 ; i++) { +for (i =0 ; i < sqsize; i++) {init_waitqueue_head (&cqp->cqp_requests[i].waitq);list_add_tail (&cqp->cqp_requests[i].list, &cqp->cqp_avail_reqs); }
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 v2 2/7 i40iw: Allocate a sdbuf per CQP WQE
In reply to a message not in the archiveFrom: Chien Tin Tung <[email protected]>
Currently there is only one sdbuf per Control QP (CQP) for programming Segment Descriptor (SD). If multiple SD work requests are posted simultaneously, the sdbuf is reused by all WQEs and new WQEs can corrupt previous WQEs sdbuf leading to incorrect SD programming.
Fix this by allocating one sdbuf per CQP SQ WQE. When an SD command is posted, it will use the corresponding sdbuf for the WQE.
--- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 41 ++++++++++++++++++++++---------- drivers/infiniband/hw/i40iw/i40iw_d.h | 4 +++- 2 files changed, 31 insertions(+), 14 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +28 -13
@@ -513,7 +513,7 @@ static enum i40iw_status_code i40iw_sc_cqp_create(struct i40iw_sc_cqp *cqp, ret_code =i40iw_allocate_dma_mem (cqp->dev->hw, &cqp->sdbuf, -128 , +I40IW_UPDATE_SD_BUF_SIZE * cqp->sq_size,I40IW_SD_BUF_ALIGNMENT );if (ret_code)
@@ -596,14 +596,14 @@ void i40iw_sc_cqp_post_sq(struct i40iw_sc_cqp *cqp) }/** -* i40iw_sc_cqp_get_next_send_wqe - get next wqe on cqp sq -* @cqp: struct for cqp hw -* @wqe_idx: we index of cqp ring +* i40iw_sc_cqp_get_next_send_wqe_idx - get next WQE on CQP SQ and pass back the index +* @cqp: pointer to CQP structure +* @scratch: private data for CQP WQE +* @wqe_idx: WQE index for next WQE on CQP SQ */ -u64 *i40iw_sc_cqp_get_next_send_wqe (struct i40iw_sc_cqp *cqp,u64 scratch) +static u64 *i40iw_sc_cqp_get_next_send_wqe_idx (struct i40iw_sc_cqp *cqp,u64 scratch,u32 *wqe_idx) {u64 *wqe =NULL ; -u32 wqe_idx;enum i40iw_status_code ret_code;if (I40IW_RING_FULL_ERR (cqp->sq_ring)) {
@@ -616,21 +616,33 @@ u64 *i40iw_sc_cqp_get_next_send_wqe(struct i40iw_sc_cqp *cqp, u64 scratch) cqp->sq_ring.size);return NULL ; } -I40IW_ATOMIC_RING_MOVE_HEAD (cqp->sq_ring, wqe_idx, ret_code); +I40IW_ATOMIC_RING_MOVE_HEAD (cqp->sq_ring, *wqe_idx, ret_code); cqp->dev->cqp_cmd_stats[OP_REQUESTED_COMMANDS ]++;if (ret_code)return NULL ; -if (!wqe_idx) +if (!*wqe_idx) cqp->polarity = !cqp->polarity; - wqe = cqp->sq_base[wqe_idx].elem; - cqp->scratch_array[wqe_idx] = scratch; + wqe = cqp->sq_base[*wqe_idx].elem; + cqp->scratch_array[*wqe_idx] = scratch;I40IW_CQP_INIT_WQE (wqe);return wqe; }/** +* i40iw_sc_cqp_get_next_send_wqe - get next wqe on cqp sq +* @cqp: struct for cqp hw +* @scratch: private data for CQP WQE +*/ +u64 *i40iw_sc_cqp_get_next_send_wqe (struct i40iw_sc_cqp *cqp,u64 scratch) +{ +u32 wqe_idx; + +return i40iw_sc_cqp_get_next_send_wqe_idx (cqp, scratch, &wqe_idx); +} + +/** * i40iw_sc_cqp_destroy - destroy cqp during close * @cqp: struct for cqp hw */
@@ -3587,8 +3599,10 @@ static enum i40iw_status_code cqp_sds_wqe_fill(struct i40iw_sc_cqp *cqp,u64 *wqe;int mem_entries, wqe_entries;struct i40iw_dma_mem *sdbuf = &cqp->sdbuf; +u64 offset; +u32 wqe_idx; - wqe =i40iw_sc_cqp_get_next_send_wqe (cqp, scratch); + wqe =i40iw_sc_cqp_get_next_send_wqe_idx (cqp, scratch, &wqe_idx);if (!wqe)return I40IW_ERR_RING_FULL ;
@@ -3601,8 +3615,9 @@ static enum i40iw_status_code cqp_sds_wqe_fill(struct i40iw_sc_cqp *cqp,LS_64 (mem_entries,I40IW_CQPSQ_UPESD_ENTRY_COUNT );if (mem_entries) { -memcpy (sdbuf->va, &info->entry[3 ], (mem_entries <<4 )); - data = sdbuf->pa; + offset = wqe_idx *I40IW_UPDATE_SD_BUF_SIZE ; +memcpy ((char *)sdbuf->va + offset, &info->entry[3 ], mem_entries <<4 ); + data = (u64 )sdbuf->pa + offset; }else { data =0 ; }
drivers/infiniband/hw/i40iw/i40iw_d.h +3 -1
@@ -1526,7 +1526,7 @@ enum i40iw_alignment {I40IW_AEQ_ALIGNMENT =0x100 ,I40IW_CEQ_ALIGNMENT =0x100 ,I40IW_CQ0_ALIGNMENT =0x100 , - I40IW_SD_BUF_ALIGNMENT = 0x100 + I40IW_SD_BUF_ALIGNMENT = 0x80 };#define I40IW_WQE_SIZE_64 64
@@ -1534,6 +1534,8 @@ enum i40iw_alignment {#define I40IW_QP_WQE_MIN_SIZE 32#define I40IW_QP_WQE_MAX_SIZE 128 +#define I40IW_UPDATE_SD_BUF_SIZE 128 +#define I40IW_CQE_QTYPE_RQ 0#define I40IW_CQE_QTYPE_SQ 1
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 v2 3/7 i40iw: Do not free sqbuf when event is I40IW_TIMER_TYPE_CLOSE
In reply to a message not in the archiveFrom: Mustafa Ismail <[email protected]>
When the event type is I40IW_TIMER_TYPE_CLOSE, there is no sqbuf and it should not be freed as one in i40iw_schedule_cm_timer().
--- drivers/infiniband/hw/i40iw/i40iw_cm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_cm.c +3 -3
@@ -1043,7 +1043,7 @@ static int i40iw_parse_mpa(struct i40iw_cm_node *cm_node, u8 *buffer, u32 *type,* i40iw_schedule_cm_timer * @@cm_node: connection's node * @sqbuf: buffer to send -* @type: if it es send ot close +* @type: if it is send or close * @send_retrans: if rexmits to be done * @close_when_complete: is cm_node to be removed *
@@ -1067,7 +1067,8 @@ int i40iw_schedule_cm_timer(struct i40iw_cm_node *cm_node, new_send =kzalloc (sizeof (*new_send),GFP_ATOMIC );if (!new_send) { -i40iw_free_sqbuf (vsi, (void *)sqbuf); +if (type !=I40IW_TIMER_TYPE_CLOSE ) +i40iw_free_sqbuf (vsi, (void *)sqbuf);return -ENOMEM ; } new_send->retrycount =I40IW_DEFAULT_RETRYS ;
@@ -1082,7 +1083,6 @@ int i40iw_schedule_cm_timer(struct i40iw_cm_node *cm_node, new_send->timetosend += (HZ /10 );if (cm_node->close_entry) {kfree (new_send); -i40iw_free_sqbuf (vsi, (void *)sqbuf);i40iw_pr_err ("already close entry\n" );return -EINVAL ; }
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 v2 4/7 i40iw: Correct ARP index mask
In reply to a message not in the archiveFrom: Mustafa Ismail <[email protected]>
ARP Index is 16 bits wide not 12 bits. Adjust
the mask for the full 16 bits.
--- drivers/infiniband/hw/i40iw/i40iw_d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_d.h +1 -1
@@ -1114,7 +1114,7 @@#define I40IWQPC_VLANTAG_MASK (0xffffULL << I40IWQPC_VLANTAG_SHIFT)#define I40IWQPC_ARPIDX_SHIFT 48 -#define I40IWQPC_ARPIDX_MASK (0xfffULL << I40IWQPC_ARPIDX_SHIFT) +#define I40IWQPC_ARPIDX_MASK (0xffffULL << I40IWQPC_ARPIDX_SHIFT)#define I40IWQPC_FLOWLABEL_SHIFT 0#define I40IWQPC_FLOWLABEL_MASK (0xfffffUL << I40IWQPC_FLOWLABEL_SHIFT)
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 v2 5/7 i40iw: Reinitialize add_sd_cnt
In reply to a message not in the archiveFrom: Mustafa Ismail <[email protected]>
add_sd_cnt in info structure passed to i40iw_create_hmc_obj_type must be 0 and since it is modified during the call, it must be reset in the loop.
--- drivers/infiniband/hw/i40iw/i40iw_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/i40iw/i40iw_main.c +1 -0
@@ -483,6 +483,7 @@ static enum i40iw_status_code i40iw_create_hmc_objs(struct i40iw_device *iwdev,for (i =0 ; i <IW_HMC_OBJ_TYPE_NUM ; i++) { info.rsrc_type = iw_hmc_obj_types[i]; info.count = dev->hmc_info->hmc_obj[info.rsrc_type].cnt; + info.add_sd_cnt =0 ; status =i40iw_create_hmc_obj_type (dev, &info);if (status) { i40iw_pr_err("create obj type %d status = %d\n",
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 v2 6/7 i40iw: Move MPA request event for loopback after connect
In reply to a message not in the archiveFrom: Tatyana Nikolova <[email protected]>
For loopback, MPA request event is generated when cm_node is initialized, which allows applications to act on the connect request before i40iw_connect() has completed. In some cases, the reject flow executes in parallel with the connect flow and doesn't delete an APBVT entry, because the apbvt_set variable is still not set by the connect flow. Move the MPA request event to the end of i40iw_connect() to notify application for a connect request, after connect has completed.
--- drivers/infiniband/hw/i40iw/i40iw_cm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_cm.c +5 -2
@@ -2947,8 +2947,6 @@ static struct i40iw_cm_node *i40iw_create_cm_node( loopback_remotenode->tcp_cntxt.snd_wnd = cm_node->tcp_cntxt.rcv_wnd; cm_node->tcp_cntxt.snd_wscale = loopback_remotenode->tcp_cntxt.rcv_wscale; loopback_remotenode->tcp_cntxt.snd_wscale = cm_node->tcp_cntxt.rcv_wscale; - loopback_remotenode->state =I40IW_CM_STATE_MPAREQ_RCVD ; -i40iw_create_event (loopback_remotenode,I40IW_CM_EVENT_MPA_REQ ); }return cm_node; }
@@ -3864,6 +3862,11 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) goto err; } +if (cm_node->loopbackpartner) { + cm_node->loopbackpartner->state =I40IW_CM_STATE_MPAREQ_RCVD ; +i40iw_create_event (cm_node->loopbackpartner,I40IW_CM_EVENT_MPA_REQ ); + } + i40iw_debug(cm_node->dev, I40IW_DEBUG_CM, "Api - connect(): port=0x%04x, cm_node=%p, cm_id = %p.\n",
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 v2 7/7 i40iw: Notify user of established connection after QP in RTS
In reply to a message not in the archiveEstablished CM event is sent prior to modifying QP to RTS state. This can result in application closing the connection before the QP is actually in RTS state. Move sending of established CM event to after modify QP to RTS.
--- drivers/infiniband/hw/i40iw/i40iw_cm.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_cm.c +9 -6
@@ -3687,11 +3687,15 @@ int i40iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) cm_id->add_ref (cm_id);i40iw_add_ref (&iwqp->ibqp); -i40iw_send_cm_event (cm_node, cm_id,IW_CM_EVENT_ESTABLISHED ,0 ); - attr.qp_state =IB_QPS_RTS ; cm_node->qhash_set = false;i40iw_modify_qp (&iwqp->ibqp, &attr,IB_QP_STATE ,NULL ); + + cm_node->accelerated =1 ; + status =i40iw_send_cm_event (cm_node, cm_id,IW_CM_EVENT_ESTABLISHED ,0 ); +if (status) +i40iw_debug (dev,I40IW_DEBUG_CM ,"error sending cm event - ESTABLISHED\n" ); +if (cm_node->loopbackpartner) { cm_node->loopbackpartner->pdata.size = conn_param->private_data_len;
@@ -3702,7 +3706,6 @@ int i40iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)i40iw_create_event (cm_node->loopbackpartner,I40IW_CM_EVENT_CONNECTED ); } - cm_node->accelerated =1 ;if (cm_node->accept_pend) {atomic_dec (&cm_node->listener->pend_accepts_cnt); cm_node->accept_pend =0 ;
@@ -4047,9 +4050,6 @@ static void i40iw_cm_event_connected(struct i40iw_cm_event *event) dev->iw_priv_qp_ops->qp_send_rtt (&iwqp->sc_qp, read0);if (iwqp->page)kunmap (iwqp->page); - status =i40iw_send_cm_event (cm_node, cm_id,IW_CM_EVENT_CONNECT_REPLY ,0 ); -if (status) -i40iw_pr_err ("send cm event\n" );memset (&attr,0 ,sizeof (attr)); attr.qp_state =IB_QPS_RTS ;
@@ -4057,6 +4057,9 @@ static void i40iw_cm_event_connected(struct i40iw_cm_event *event)i40iw_modify_qp (&iwqp->ibqp, &attr,IB_QP_STATE ,NULL ); cm_node->accelerated =1 ; + status =i40iw_send_cm_event (cm_node, cm_id,IW_CM_EVENT_CONNECT_REPLY ,0 ); +if (status) +i40iw_debug (dev,I40IW_DEBUG_CM ,"error sending cm event - CONNECT_REPLY\n" );return ;
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 1 line · Henry Orosco
The following patches are for the 4.15 kernel.
These all seem reasonable to me, but again, can you revise the commit messages so they are acceptable for -rc?
Linus did not entirely like the commit messages last cycle, so please lets all try harder to be clear, think of writing your commit messages in terms of:
- What is the bug this is fixing? How does the user perceive the bug?
- How did this work before? Did it?
Many of these messages are just describing what the patch is doing, without providing context why it is an acceptable change for RC.
Eg here:
Use sqsize instead of I40IW_CQP_SW_SQSIZE_2048 to initialize cqp_requests elements in the for-loop as sqsize is used to allocate memory for cqp_requests.
That obviously desribes what the patch does, and I can learn the same thing by reading the patch, but it does not help anyone understand what the bug is, how the bug presents to the user, or if it this patch should be in -rc.
Jason
--
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): 20171121185217.GI29826-VPRAkNaXOzVWk0Htik3J/[email protected]
Quoted 22 lines · Jason Gunthorpe
Quoted 1 line · Henry Orosco
The following patches are for the 4.15 kernel.
These all seem reasonable to me, but again, can you revise the commit messages so they are acceptable for -rc?
Linus did not entirely like the commit messages last cycle, so please lets all try harder to be clear, think of writing your commit messages in terms of:
- What is the bug this is fixing? How does the user perceive the bug?
- How did this work before? Did it?Many of these messages are just describing what the patch is doing, without providing context why it is an acceptable change for RC.
Eg here:
Use sqsize instead of
I40IW_CQP_SW_SQSIZE_2048to initializecqp_requestselements in the for-loop as sqsize is used to allocate memory forcqp_requests.
Quoted 6 lines
That obviously desribes what the patch does, and I can learn the same thing by reading the patch, but it does not help anyone understand what the bug is, how the bug presents to the user, or if it this patch should be in -rc.
Jason
Sorry, I incorrectly labeled
"i40iw: Use sqsize to initialize cqp_requests elements" as a bug fix. This will be deferred to for-next.
Additionally, the author is needed to re-evaluate the commit description for following patch "i40iw: Reinitialize add_sd_cnt", but is currently out this week. It will be removed from this patch series and sent later.
I will send a new series shortly.
Quoted 4 lines
--
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
--
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
Jason Gunthorpe
AppliedQuoted 20 lines · Henry Orosco
The following patches are for the 4.15 kernel.
Change Log
v1-v2:
Updated comments for "i40iw: Allocate a sdbuf per CQP WQE" Removed "i40iw: Change accelerated flag to bool" from seriesChien Tin Tung (2):
i40iw: Use sqsize to initializecqp_requestselements
i40iw: Allocate a sdbuf per CQP WQEHenry Orosco (1):
i40iw: Notify user of established connection after QP in RTSMustafa Ismail (3):
i40iw: Do not free sqbuf when event isI40IW_TIMER_TYPE_CLOSE
i40iw: Correct ARP index mask
i40iw: Reinitializeadd_sd_cnt
Quoted 8 lines
Tatyana Nikolova (1):
i40iw: Move MPA request event for loopback after connectdrivers/infiniband/hw/i40iw/i40iw_cm.c | 28 +++++++++++++--------- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 41 ++++++++++++++++++++++---------- drivers/infiniband/hw/i40iw/i40iw_d.h | 6 +++-- drivers/infiniband/hw/i40iw/i40iw_main.c | 3 ++- 4 files changed, 51 insertions(+), 27 deletions(-)
Applied to for-rc, Thanks
Jason
--
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