app/test-crypto-perf: fix invalid mbuf next operation
PATCH 1/1 app/test-crypto-perf: fix invalid mbuf next operation
In fill_multi_seg_mbuf(), when remaining_segments is 0, rte_mbuf m's next should pointer to NULL instead of a new rte_mbuf, that casues setting m->next as NULL out of the while loop to the invalid mbuf.
This commit fixes the invalid mbuf next operation.
--- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
app/test-crypto-perf/cperf_test_common.c +7 -5
@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,rte_mbuf_refcnt_set (m,1 ); next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--; + remaining_segments--; +if (remaining_segments >0 ) { + m->next = next_mbuf; + m = next_mbuf; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; } static void
Signature · 1 line
2.34.1
Hi Suanming,
Good catch. Please see inline.
Thanks,
Anoob
Quoted 29 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 9:24 AM
To: Ciara Power <[email protected]>
Cc: [email protected]
Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationExternal Email
----------------------------------------------------------------------
Infill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that casues settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>--- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_test_common.c +0
-0
perf/cperf_test_common.c
index932aab16df..ad2076dd2e100644
app/test-crypto-perf/cperf_test_common.c fill_multi_seg_mbuf(struct rte_mbuf *m, struct · line 78
Quoted 10 lines
app/test-crypto-perf/cperf_test_common.c +2
-3@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,rte_mbuf_refcnt_set (m,1 ); next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--; + remaining_segments--; +if (remaining_segments >0 ) {
[Anoob] Would it make sense to move assignment of next_mbuf also to here? That way, the checks will become self explanatory.
next_mbuf = (struct rte_mbuf *) ((uint8_t *) m +
mbuf_hdr_size + segment_sz);
Quoted 13 lines
app/test-crypto-perf/cperf_test_common.c +5
-2+ m->next = next_mbuf; + m = next_mbuf; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; }static void
--
2.34.1
Hi,
Quoted 52 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Wednesday, January 3, 2024 7:22 PM
To: Suanming Mou <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi Suanming,
Good catch. Please see inline.
Thanks,
AnoobQuoted 38 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 9:24 AM
To: Ciara Power <[email protected]>
Cc: [email protected]
Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationExternal Email
----------------------------------------------------------------------
Infill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that casues settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>--- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)(quoted diff) +0
-0b/app/test-crypto-
perf/cperf_test_common.cindex932aab16df..ad2076dd2e100644app/test-crypto-perf/cperf_test_common.c +0
-3@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,rte_mbuf_refcnt_set (m,1 ); next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--;
Quoted 8 lines
app/test-crypto-perf/cperf_test_common.c fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, · line 77
Quoted 2 lines
app/test-crypto-perf/cperf_test_common.c +2
-0+ remaining_segments--; +if (remaining_segments >0 ) {[Anoob] Would it make sense to move assignment of
next_mbufalso to here? That way, the checks will become self explanatory.
next_mbuf= (structrte_mbuf*) ((uint8_t*) m +
mbuf_hdr_size+segment_sz);
Make sense. Maybe just like that:
m->next = (struct rte_mbuf *) ((uint8_t *) m +
mbuf_hdr_size + segment_sz); m = m->next;
What do you think?
Quoted 13 lines
Quoted 13 lines
app/test-crypto-perf/cperf_test_common.c +5
-2+ m->next = next_mbuf; + m = next_mbuf; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; }static void
--
2.34.1
Hi Suanming,
Please see inline.
Thanks,
Anoob
Quoted 72 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 6:06 PM
To: Anoob Joseph <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi,
Quoted 54 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Wednesday, January 3, 2024 7:22 PM
To: Suanming Mou <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi Suanming,
Good catch. Please see inline.
Thanks,
AnoobQuoted 39 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 9:24 AM
To: Ciara Power <[email protected]>
Cc: [email protected]
Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationExternal Email
--------------------------------------------------------------------
-- Infill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that casues settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>--- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)(quoted diff) +0
-0b/app/test-crypto-
perf/cperf_test_common.cindex932aab16df..ad2076dd2e100644app/test-crypto-perf/cperf_test_common.c +0
-3@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,rte_mbuf_refcnt_set (m,1 ); next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--;Quoted 8 lines
app/test-crypto-perf/cperf_test_common.c fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, · line 77
Quoted 2 lines
app/test-crypto-perf/cperf_test_common.c +2
-0+ remaining_segments--; +if (remaining_segments >0 ) {[Anoob] Would it make sense to move assignment of
next_mbufalso to here? That way, the checks will become self explanatory.
next_mbuf= (structrte_mbuf*) ((uint8_t*) m +
mbuf_hdr_size+segment_sz);
Quoted 6 lines
Make sense. Maybe just like that:
m->next= (structrte_mbuf*) ((uint8_t*) m +mbuf_hdr_size + segment_sz); m = m->next;What do you think?
[Anoob] Yes. That's even better.
I think we can have line lengths upto 100 characters now. In case you find it easier to put in single line.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
app/test-crypto-perf/cperf_test_common.c +5
-2+ m->next = next_mbuf; + m = next_mbuf; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; }static void
--
2.34.1
Quoted 95 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Wednesday, January 3, 2024 11:43 PM
To: Suanming Mou <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi Suanming,
Please see inline.
Thanks,
AnoobQuoted 79 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 6:06 PM
To: Anoob Joseph <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi,
Quoted 55 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Wednesday, January 3, 2024 7:22 PM
To: Suanming Mou <[email protected]>
Cc: [email protected]; Ciara Power <[email protected]>
Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationHi Suanming,
Good catch. Please see inline.
Thanks,
AnoobQuoted 40 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, January 3, 2024 9:24 AM
To: Ciara Power <[email protected]>
Cc: [email protected]
Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operationExternal Email
------------------------------------------------------------------
--
-- Infill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that casues settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>--- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)(quoted diff) +0
-0b/app/test-crypto-
perf/cperf_test_common.cindex932aab16df..ad2076dd2e100644app/test-crypto-perf/cperf_test_common.c +0
-3@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,rte_mbuf_refcnt_set (m,1 ); next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--;Quoted 8 lines
app/test-crypto-perf/cperf_test_common.c fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, · line 77
Quoted 2 lines
app/test-crypto-perf/cperf_test_common.c +2
-0+ remaining_segments--; +if (remaining_segments >0 ) {[Anoob] Would it make sense to move assignment of
next_mbufalso to here? That way, the checks will become self explanatory.
next_mbuf= (structrte_mbuf*) ((uint8_t*) m +
mbuf_hdr_size+segment_sz);Make sense. Maybe just like that:
m->next= (structrte_mbuf*) ((uint8_t*) m +mbuf_hdr_size + segment_sz); m = m->next;
Quoted 6 lines
Quoted 1 line
What do you think?
[Anoob] Yes. That's even better.
I think we can have line lengths upto 100 characters now. In case you find it easier to put in single line.
OK, thanks for the suggestion.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
app/test-crypto-perf/cperf_test_common.c +5
-2+ m->next = next_mbuf; + m = next_mbuf; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; }static void
--
2.34.1
PATCH v2 1/1 app/test-crypto-perf: fix invalid mbuf next operation
In reply to Suanming MouIn fill_multi_seg_mbuf(), when remaining_segments is 0, rte_mbuf m's next should pointer to NULL instead of a new rte_mbuf, that causes setting m->next as NULL out of the while loop to the invalid mbuf.
This commit fixes the invalid mbuf next operation.
---
v2: move next_mbuf inside remaining_segments check.
--- app/test-crypto-perf/cperf_test_common.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
app/test-crypto-perf/cperf_test_common.c +7 -8
@@ -49,7 +49,6 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, {uint16_t mbuf_hdr_size =sizeof (struct rte_mbuf );uint16_t remaining_segments = segments_nb; -struct rte_mbuf *next_mbuf;rte_iova_t next_seg_phys_addr =rte_mempool_virt2iova (obj) + mbuf_offset + mbuf_hdr_size;
@@ -70,15 +69,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, m->nb_segs = segments_nb; m->port =0xff ;rte_mbuf_refcnt_set (m,1 ); - next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + - mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--; + remaining_segments--; +if (remaining_segments >0 ) { + m->next = (struct rte_mbuf *)((uint8_t *) m + mbuf_hdr_size + segment_sz); + m = m->next; + }else { + m->next =NULL ; + } }while (remaining_segments >0 ); - - m->next =NULL ; } static void
Signature · 1 line
2.34.1
Quoted 9 lines
In
fill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that causes settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>
Quoted 17 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Thursday, January 4, 2024 2:24 AM
To: [email protected]; Power, Ciara <[email protected]>
Cc: [email protected]
Subject: [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operationIn
fill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that causes setting m-Quoted 1 line
next as NULL out of the while loop to the invalid mbuf.
This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")
Quoted 9 lines
Signed-off-by Suanming Mou <[email protected]>---
v2: move
next_mbufinsideremaining_segmentscheck.--- app/test-crypto-perf/cperf_test_common.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
Quoted 10 lines
In
fill_multi_seg_mbuf(), whenremaining_segmentsis 0,rte_mbufm's next should pointer to NULL instead of a newrte_mbuf, that causes settingm->nextas NULL out of the while loop to the invalid mbuf.This commit fixes the invalid mbuf next operation.
Fixes bf9d6702eca9 ("app/crypto-perf: use single mempool")Signed-off-by Suanming Mou <[email protected]>
Cc: [email protected]
Applied to dpdk-next-crypto
Thanks.