* [PATCH] app/test-crypto-perf: fix invalid mbuf next operation @ 2024-01-03 3:53 Suanming Mou 2024-01-03 11:21 ` [EXT] " Anoob Joseph 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou 0 siblings, 2 replies; 9+ messages in thread From: Suanming Mou @ 2024-01-03 3:53 UTC (permalink / raw) To: Ciara Power; +Cc: dev 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. Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") Signed-off-by: Suanming Mou <suanmingm@nvidia.com> --- app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 932aab16df..ad2076dd2e 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -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 -- 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-03 3:53 [PATCH] app/test-crypto-perf: fix invalid mbuf next operation Suanming Mou @ 2024-01-03 11:21 ` Anoob Joseph 2024-01-03 12:35 ` Suanming Mou 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou 1 sibling, 1 reply; 9+ messages in thread From: Anoob Joseph @ 2024-01-03 11:21 UTC (permalink / raw) To: Suanming Mou; +Cc: dev, Ciara Power Hi Suanming, Good catch. Please see inline. Thanks, Anoob > -----Original Message----- > From: Suanming Mou <suanmingm@nvidia.com> > Sent: Wednesday, January 3, 2024 9:24 AM > To: Ciara Power <ciara.power@intel.com> > Cc: dev@dpdk.org > Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation > > External Email > > ---------------------------------------------------------------------- > 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. > > Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > --- > app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto- > perf/cperf_test_common.c > index 932aab16df..ad2076dd2e 100644 > --- a/app/test-crypto-perf/cperf_test_common.c > +++ b/app/test-crypto-perf/cperf_test_common.c > @@ -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); > + m->next = next_mbuf; > + m = next_mbuf; > + } else { > + m->next = NULL; > + } > } while (remaining_segments > 0); > - > - m->next = NULL; > } > > static void > -- > 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-03 11:21 ` [EXT] " Anoob Joseph @ 2024-01-03 12:35 ` Suanming Mou 2024-01-03 15:42 ` Anoob Joseph 0 siblings, 1 reply; 9+ messages in thread From: Suanming Mou @ 2024-01-03 12:35 UTC (permalink / raw) To: Anoob Joseph; +Cc: dev, Ciara Power Hi, > -----Original Message----- > From: Anoob Joseph <anoobj@marvell.com> > Sent: Wednesday, January 3, 2024 7:22 PM > To: Suanming Mou <suanmingm@nvidia.com> > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation > > Hi Suanming, > > Good catch. Please see inline. > > Thanks, > Anoob > > > -----Original Message----- > > From: Suanming Mou <suanmingm@nvidia.com> > > Sent: Wednesday, January 3, 2024 9:24 AM > > To: Ciara Power <ciara.power@intel.com> > > Cc: dev@dpdk.org > > Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next > > operation > > > > External Email > > > > ---------------------------------------------------------------------- > > 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. > > > > Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") > > > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > > --- > > app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/app/test-crypto-perf/cperf_test_common.c > > b/app/test-crypto- perf/cperf_test_common.c index > > 932aab16df..ad2076dd2e 100644 > > --- a/app/test-crypto-perf/cperf_test_common.c > > +++ b/app/test-crypto-perf/cperf_test_common.c > > @@ -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); > 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? > > + m->next = next_mbuf; > > + m = next_mbuf; > > + } else { > > + m->next = NULL; > > + } > > } while (remaining_segments > 0); > > - > > - m->next = NULL; > > } > > > > static void > > -- > > 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-03 12:35 ` Suanming Mou @ 2024-01-03 15:42 ` Anoob Joseph 2024-01-04 2:23 ` Suanming Mou 0 siblings, 1 reply; 9+ messages in thread From: Anoob Joseph @ 2024-01-03 15:42 UTC (permalink / raw) To: Suanming Mou; +Cc: dev, Ciara Power Hi Suanming, Please see inline. Thanks, Anoob > -----Original Message----- > From: Suanming Mou <suanmingm@nvidia.com> > Sent: Wednesday, January 3, 2024 6:06 PM > To: Anoob Joseph <anoobj@marvell.com> > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation > > Hi, > > > -----Original Message----- > > From: Anoob Joseph <anoobj@marvell.com> > > Sent: Wednesday, January 3, 2024 7:22 PM > > To: Suanming Mou <suanmingm@nvidia.com> > > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next > > operation > > > > Hi Suanming, > > > > Good catch. Please see inline. > > > > Thanks, > > Anoob > > > > > -----Original Message----- > > > From: Suanming Mou <suanmingm@nvidia.com> > > > Sent: Wednesday, January 3, 2024 9:24 AM > > > To: Ciara Power <ciara.power@intel.com> > > > Cc: dev@dpdk.org > > > Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next > > > operation > > > > > > External Email > > > > > > -------------------------------------------------------------------- > > > -- 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. > > > > > > Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") > > > > > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > > > --- > > > app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- > > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > > > diff --git a/app/test-crypto-perf/cperf_test_common.c > > > b/app/test-crypto- perf/cperf_test_common.c index > > > 932aab16df..ad2076dd2e 100644 > > > --- a/app/test-crypto-perf/cperf_test_common.c > > > +++ b/app/test-crypto-perf/cperf_test_common.c > > > @@ -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); > > > > 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? [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. > > > > + m->next = next_mbuf; > > > + m = next_mbuf; > > > + } else { > > > + m->next = NULL; > > > + } > > > } while (remaining_segments > 0); > > > - > > > - m->next = NULL; > > > } > > > > > > static void > > > -- > > > 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-03 15:42 ` Anoob Joseph @ 2024-01-04 2:23 ` Suanming Mou 0 siblings, 0 replies; 9+ messages in thread From: Suanming Mou @ 2024-01-04 2:23 UTC (permalink / raw) To: Anoob Joseph; +Cc: dev, Ciara Power > -----Original Message----- > From: Anoob Joseph <anoobj@marvell.com> > Sent: Wednesday, January 3, 2024 11:43 PM > To: Suanming Mou <suanmingm@nvidia.com> > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next operation > > Hi Suanming, > > Please see inline. > > Thanks, > Anoob > > > -----Original Message----- > > From: Suanming Mou <suanmingm@nvidia.com> > > Sent: Wednesday, January 3, 2024 6:06 PM > > To: Anoob Joseph <anoobj@marvell.com> > > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next > > operation > > > > Hi, > > > > > -----Original Message----- > > > From: Anoob Joseph <anoobj@marvell.com> > > > Sent: Wednesday, January 3, 2024 7:22 PM > > > To: Suanming Mou <suanmingm@nvidia.com> > > > Cc: dev@dpdk.org; Ciara Power <ciara.power@intel.com> > > > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf > > > next operation > > > > > > Hi Suanming, > > > > > > Good catch. Please see inline. > > > > > > Thanks, > > > Anoob > > > > > > > -----Original Message----- > > > > From: Suanming Mou <suanmingm@nvidia.com> > > > > Sent: Wednesday, January 3, 2024 9:24 AM > > > > To: Ciara Power <ciara.power@intel.com> > > > > Cc: dev@dpdk.org > > > > Subject: [EXT] [PATCH] app/test-crypto-perf: fix invalid mbuf next > > > > operation > > > > > > > > External Email > > > > > > > > ------------------------------------------------------------------ > > > > -- > > > > -- 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. > > > > > > > > Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") > > > > > > > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > > > > --- > > > > app/test-crypto-perf/cperf_test_common.c | 12 +++++++----- > > > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/app/test-crypto-perf/cperf_test_common.c > > > > b/app/test-crypto- perf/cperf_test_common.c index > > > > 932aab16df..ad2076dd2e 100644 > > > > --- a/app/test-crypto-perf/cperf_test_common.c > > > > +++ b/app/test-crypto-perf/cperf_test_common.c > > > > @@ -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); > > > > > > > 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? > > [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. > > > > > > > + m->next = next_mbuf; > > > > + m = next_mbuf; > > > > + } else { > > > > + m->next = NULL; > > > > + } > > > > } while (remaining_segments > 0); > > > > - > > > > - m->next = NULL; > > > > } > > > > > > > > static void > > > > -- > > > > 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-03 3:53 [PATCH] app/test-crypto-perf: fix invalid mbuf next operation Suanming Mou 2024-01-03 11:21 ` [EXT] " Anoob Joseph @ 2024-01-04 2:24 ` Suanming Mou 2024-01-04 4:17 ` [EXT] " Anoob Joseph ` (2 more replies) 1 sibling, 3 replies; 9+ messages in thread From: Suanming Mou @ 2024-01-04 2:24 UTC (permalink / raw) To: anoobj, ciara.power; +Cc: dev 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 causes setting m->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") Signed-off-by: Suanming Mou <suanmingm@nvidia.com> --- v2: move next_mbuf inside remaining_segments check. --- app/test-crypto-perf/cperf_test_common.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 932aab16df..b3bf9f67e8 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -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 -- 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou @ 2024-01-04 4:17 ` Anoob Joseph 2024-01-12 16:04 ` Power, Ciara 2024-02-01 8:45 ` [EXT] " Akhil Goyal 2 siblings, 0 replies; 9+ messages in thread From: Anoob Joseph @ 2024-01-04 4:17 UTC (permalink / raw) To: Suanming Mou, ciara.power; +Cc: dev > 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 causes setting m->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") > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> Acked-by: Anoob Joseph <anoobj@marvell.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou 2024-01-04 4:17 ` [EXT] " Anoob Joseph @ 2024-01-12 16:04 ` Power, Ciara 2024-02-01 8:45 ` [EXT] " Akhil Goyal 2 siblings, 0 replies; 9+ messages in thread From: Power, Ciara @ 2024-01-12 16:04 UTC (permalink / raw) To: Suanming Mou, anoobj; +Cc: dev > -----Original Message----- > From: Suanming Mou <suanmingm@nvidia.com> > Sent: Thursday, January 4, 2024 2:24 AM > To: anoobj@marvell.com; Power, Ciara <ciara.power@intel.com> > Cc: dev@dpdk.org > Subject: [PATCH v2] 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 causes setting m- > >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") > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > --- > > v2: move next_mbuf inside remaining_segments check. > > --- > app/test-crypto-perf/cperf_test_common.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > Acked-by: Ciara Power <ciara.power@intel.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operation 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou 2024-01-04 4:17 ` [EXT] " Anoob Joseph 2024-01-12 16:04 ` Power, Ciara @ 2024-02-01 8:45 ` Akhil Goyal 2 siblings, 0 replies; 9+ messages in thread From: Akhil Goyal @ 2024-02-01 8:45 UTC (permalink / raw) To: Suanming Mou, Anoob Joseph, ciara.power; +Cc: dev > 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 causes setting m->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") > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> Cc: stable@dpdk.org Applied to dpdk-next-crypto Thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-02-01 8:46 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-01-03 3:53 [PATCH] app/test-crypto-perf: fix invalid mbuf next operation Suanming Mou 2024-01-03 11:21 ` [EXT] " Anoob Joseph 2024-01-03 12:35 ` Suanming Mou 2024-01-03 15:42 ` Anoob Joseph 2024-01-04 2:23 ` Suanming Mou 2024-01-04 2:24 ` [PATCH v2] " Suanming Mou 2024-01-04 4:17 ` [EXT] " Anoob Joseph 2024-01-12 16:04 ` Power, Ciara 2024-02-01 8:45 ` [EXT] " Akhil Goyal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).