public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/2] libbnxt_re bug fixes
@ 2017-11-09  9:10 Devesh Sharma
       [not found] ` <1510218658-16710-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Devesh Sharma @ 2017-11-09  9:10 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	Devesh Sharma

This patch series contains important bug fixes.
Patch 1 address the memory barrier changes Jason
asked while reviewing a similar change in bnxt_re
driver.

Patch 2 is another fix found during internal testing.

Devesh Sharma (2):
  bnxt_re/lib: fix the memory barrier call during poll-cq
  bnxt_re/lib: increament psn in case of 0 length packets

 providers/bnxt_re/main.h  | 8 ++++++--
 providers/bnxt_re/verbs.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq
       [not found] ` <1510218658-16710-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
@ 2017-11-09  9:10   ` Devesh Sharma
  2017-11-09  9:10   ` [PATCH rdma-core 2/2] bnxt_re/lib: increament psn in case of 0 length packets Devesh Sharma
  1 sibling, 0 replies; 5+ messages in thread
From: Devesh Sharma @ 2017-11-09  9:10 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	Devesh Sharma

Putting a read barrier before issuing a read on valid bit
is incorrect. When checking for the validity of CQE in the
CQ buffer the code must wait for the read-barrier to finish
after issuing a read operaion on CQE valid bit.

Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
 providers/bnxt_re/main.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/providers/bnxt_re/main.h b/providers/bnxt_re/main.h
index 9688fec..82c8948 100644
--- a/providers/bnxt_re/main.h
+++ b/providers/bnxt_re/main.h
@@ -366,9 +366,13 @@ static inline uint8_t bnxt_re_to_ibv_wc_status(uint8_t bnxt_wcst,
 static inline uint8_t bnxt_re_is_cqe_valid(struct bnxt_re_cq *cq,
 					   struct bnxt_re_bcqe *hdr)
 {
+	uint8_t valid = 0;
+
+	valid = ((le32toh(hdr->flg_st_typ_ph) &
+		  BNXT_RE_BCQE_PH_MASK) == cq->phase);
 	udma_from_device_barrier();
-	return ((le32toh(hdr->flg_st_typ_ph) &
-		 BNXT_RE_BCQE_PH_MASK) == cq->phase);
+
+	return valid;
 }
 
 static inline void bnxt_re_change_cq_phase(struct bnxt_re_cq *cq)
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH rdma-core 2/2] bnxt_re/lib: increament psn in case of 0 length packets
       [not found] ` <1510218658-16710-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  2017-11-09  9:10   ` [PATCH rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq Devesh Sharma
@ 2017-11-09  9:10   ` Devesh Sharma
       [not found]     ` <1510218658-16710-3-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Devesh Sharma @ 2017-11-09  9:10 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	Devesh Sharma

If application posts a 0 length packte, post send routine
is skipping to increament the psn number. This will cause
PSN number to go out of sync and evantually connection would
terminate due to sequence error.

post_send routine must increament the psn number by 1 even
for zero length packets.

Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
 providers/bnxt_re/verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c
index 4d9b044..9d4e02b 100644
--- a/providers/bnxt_re/verbs.c
+++ b/providers/bnxt_re/verbs.c
@@ -1048,6 +1048,8 @@ static void bnxt_re_fill_psns(struct bnxt_re_qp *qp, struct bnxt_re_psns *psns,
 		pkt_cnt = (len / qp->mtu);
 		if (len % qp->mtu)
 			pkt_cnt++;
+		if (len == 0)
+			pkt_cnt = 1;
 		nxt_psn = ((qp->sq_psn + pkt_cnt) & BNXT_RE_PSNS_NPSN_MASK);
 		psns->flg_npsn = htole32(nxt_psn);
 		qp->sq_psn = nxt_psn;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-core 2/2] bnxt_re/lib: increament psn in case of 0 length packets
       [not found]     ` <1510218658-16710-3-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
@ 2017-11-09  9:51       ` Leon Romanovsky
       [not found]         ` <20171109095138.GE18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2017-11-09  9:51 UTC (permalink / raw)
  To: Devesh Sharma
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

On Thu, Nov 09, 2017 at 04:10:58AM -0500, Devesh Sharma wrote:
> If application posts a 0 length packte, post send routine
> is skipping to increament the psn number. This will cause
> PSN number to go out of sync and evantually connection would
> terminate due to sequence error.
>
> post_send routine must increament the psn number by 1 even
> for zero length packets.

s/increament/increment in all places.

Thanks

>
> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
>  providers/bnxt_re/verbs.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c
> index 4d9b044..9d4e02b 100644
> --- a/providers/bnxt_re/verbs.c
> +++ b/providers/bnxt_re/verbs.c
> @@ -1048,6 +1048,8 @@ static void bnxt_re_fill_psns(struct bnxt_re_qp *qp, struct bnxt_re_psns *psns,
>  		pkt_cnt = (len / qp->mtu);
>  		if (len % qp->mtu)
>  			pkt_cnt++;
> +		if (len == 0)
> +			pkt_cnt = 1;
>  		nxt_psn = ((qp->sq_psn + pkt_cnt) & BNXT_RE_PSNS_NPSN_MASK);
>  		psns->flg_npsn = htole32(nxt_psn);
>  		qp->sq_psn = nxt_psn;
> --
> 1.8.3.1
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-core 2/2] bnxt_re/lib: increament psn in case of 0 length packets
       [not found]         ` <20171109095138.GE18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-11-09 11:05           ` Devesh Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Devesh Sharma @ 2017-11-09 11:05 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma, Doug Ledford

Yes, sending a rev, sent out wrong version.

On Thu, Nov 9, 2017 at 3:21 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Thu, Nov 09, 2017 at 04:10:58AM -0500, Devesh Sharma wrote:
>> If application posts a 0 length packte, post send routine
>> is skipping to increament the psn number. This will cause
>> PSN number to go out of sync and evantually connection would
>> terminate due to sequence error.
>>
>> post_send routine must increament the psn number by 1 even
>> for zero length packets.
>
> s/increament/increment in all places.
>
> Thanks
>
>>
>> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
>> ---
>>  providers/bnxt_re/verbs.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c
>> index 4d9b044..9d4e02b 100644
>> --- a/providers/bnxt_re/verbs.c
>> +++ b/providers/bnxt_re/verbs.c
>> @@ -1048,6 +1048,8 @@ static void bnxt_re_fill_psns(struct bnxt_re_qp *qp, struct bnxt_re_psns *psns,
>>               pkt_cnt = (len / qp->mtu);
>>               if (len % qp->mtu)
>>                       pkt_cnt++;
>> +             if (len == 0)
>> +                     pkt_cnt = 1;
>>               nxt_psn = ((qp->sq_psn + pkt_cnt) & BNXT_RE_PSNS_NPSN_MASK);
>>               psns->flg_npsn = htole32(nxt_psn);
>>               qp->sq_psn = nxt_psn;
>> --
>> 1.8.3.1
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-09 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-09  9:10 [PATCH rdma-core 0/2] libbnxt_re bug fixes Devesh Sharma
     [not found] ` <1510218658-16710-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-11-09  9:10   ` [PATCH rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq Devesh Sharma
2017-11-09  9:10   ` [PATCH rdma-core 2/2] bnxt_re/lib: increament psn in case of 0 length packets Devesh Sharma
     [not found]     ` <1510218658-16710-3-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-11-09  9:51       ` Leon Romanovsky
     [not found]         ` <20171109095138.GE18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-09 11:05           ` Devesh Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox