diff mbox

[rdma-core,2/2] bnxt_re/lib: increament psn in case of 0 length packets

Message ID 1510218658-16710-3-git-send-email-devesh.sharma@broadcom.com (mailing list archive)
State Superseded
Headers show

Commit Message

Devesh Sharma Nov. 9, 2017, 9:10 a.m. UTC
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@broadcom.com>
---
 providers/bnxt_re/verbs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Leon Romanovsky Nov. 9, 2017, 9:51 a.m. UTC | #1
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@broadcom.com>
> ---
>  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
>
Devesh Sharma Nov. 9, 2017, 11:05 a.m. UTC | #2
Yes, sending a rev, sent out wrong version.

On Thu, Nov 9, 2017 at 3:21 PM, Leon Romanovsky <leon@kernel.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@broadcom.com>
>> ---
>>  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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;