DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] mbuf: fix API to copy mbuf dynamic fields
@ 2024-06-26 12:08 Shijith Thotton
  2024-06-26 12:23 ` Morten Brørup
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shijith Thotton @ 2024-06-26 12:08 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, Shijith Thotton, jerinj, mb, stable

Fixed rte_mbuf_dynfield_copy() API to copy dynamic fields from one mbuf
to another. When RTE_IOVA_AS_PA is not defined during the build, an
additional dynamic field (dynfield2) becomes available. This field
should be conditionally copied to ensure the complete duplication of
dynamic fields between mbufs. This patch fixes the same.

see https://bugs.dpdk.org/show_bug.cgi?id=1472

Bugzilla ID: 1472
Fixes: 03b57eb7ab9a ("mbuf: add second dynamic field member")
Cc: stable@dpdk.org

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 lib/mbuf/rte_mbuf.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 4c4722e002..dc6d1237ac 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -1120,6 +1120,9 @@ static inline void
 rte_mbuf_dynfield_copy(struct rte_mbuf *mdst, const struct rte_mbuf *msrc)
 {
 	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
+#if !RTE_IOVA_IN_MBUF
+	mdst->dynfield2 = msrc->dynfield2;
+#endif
 }
 
 /* internal */
-- 
2.25.1


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

* RE: [PATCH] mbuf: fix API to copy mbuf dynamic fields
  2024-06-26 12:08 [PATCH] mbuf: fix API to copy mbuf dynamic fields Shijith Thotton
@ 2024-06-26 12:23 ` Morten Brørup
  2024-06-26 15:00 ` Stephen Hemminger
  2024-06-27  7:57 ` [PATCH v2] " Shijith Thotton
  2 siblings, 0 replies; 4+ messages in thread
From: Morten Brørup @ 2024-06-26 12:23 UTC (permalink / raw)
  To: Shijith Thotton, dev; +Cc: olivier.matz, jerinj, stable

> From: Shijith Thotton [mailto:sthotton@marvell.com]
> Sent: Wednesday, 26 June 2024 14.08
> 
> Fixed rte_mbuf_dynfield_copy() API to copy dynamic fields from one mbuf
> to another. When RTE_IOVA_AS_PA is not defined during the build, an
> additional dynamic field (dynfield2) becomes available. This field
> should be conditionally copied to ensure the complete duplication of
> dynamic fields between mbufs. This patch fixes the same.
> 
> see https://bugs.dpdk.org/show_bug.cgi?id=1472
> 
> Bugzilla ID: 1472
> Fixes: 03b57eb7ab9a ("mbuf: add second dynamic field member")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>

Thank you for fixing this bug.

> ---
>  lib/mbuf/rte_mbuf.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index 4c4722e002..dc6d1237ac 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -1120,6 +1120,9 @@ static inline void
>  rte_mbuf_dynfield_copy(struct rte_mbuf *mdst, const struct rte_mbuf *msrc)
>  {
>  	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
> +#if !RTE_IOVA_IN_MBUF
> +	mdst->dynfield2 = msrc->dynfield2;
> +#endif

dynfield2 is located before dynfield1 in the mbuf struct; suggest copy dynfield2 before dynfield1.

>  }
> 
>  /* internal */
> --
> 2.25.1

With or without suggested change,

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


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

* Re: [PATCH] mbuf: fix API to copy mbuf dynamic fields
  2024-06-26 12:08 [PATCH] mbuf: fix API to copy mbuf dynamic fields Shijith Thotton
  2024-06-26 12:23 ` Morten Brørup
@ 2024-06-26 15:00 ` Stephen Hemminger
  2024-06-27  7:57 ` [PATCH v2] " Shijith Thotton
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-06-26 15:00 UTC (permalink / raw)
  To: Shijith Thotton; +Cc: dev, olivier.matz, jerinj, mb, stable

On Wed, 26 Jun 2024 17:38:02 +0530
Shijith Thotton <sthotton@marvell.com> wrote:

> Fixed rte_mbuf_dynfield_copy() API to copy dynamic fields from one mbuf
> to another. When RTE_IOVA_AS_PA is not defined during the build, an
> additional dynamic field (dynfield2) becomes available. This field
> should be conditionally copied to ensure the complete duplication of
> dynamic fields between mbufs. This patch fixes the same.
> 
> see https://bugs.dpdk.org/show_bug.cgi?id=1472
> 
> Bugzilla ID: 1472
> Fixes: 03b57eb7ab9a ("mbuf: add second dynamic field member")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* [PATCH v2] mbuf: fix API to copy mbuf dynamic fields
  2024-06-26 12:08 [PATCH] mbuf: fix API to copy mbuf dynamic fields Shijith Thotton
  2024-06-26 12:23 ` Morten Brørup
  2024-06-26 15:00 ` Stephen Hemminger
@ 2024-06-27  7:57 ` Shijith Thotton
  2 siblings, 0 replies; 4+ messages in thread
From: Shijith Thotton @ 2024-06-27  7:57 UTC (permalink / raw)
  To: dev
  Cc: olivier.matz, Shijith Thotton, jerinj, stable,
	Morten Brørup, Stephen Hemminger

Fixed rte_mbuf_dynfield_copy() API to copy dynamic fields from one mbuf
to another. When RTE_IOVA_AS_PA is not defined during the build, an
additional dynamic field (dynfield2) becomes available. This field
should be conditionally copied to ensure the complete duplication of
dynamic fields between mbufs. This patch fixes the same.

see https://bugs.dpdk.org/show_bug.cgi?id=1472

Bugzilla ID: 1472
Fixes: 03b57eb7ab9a ("mbuf: add second dynamic field member")
Cc: stable@dpdk.org

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
v2:
- Moved copy of dynfield2 before dynfield1.
- Added Reviewed-by and Acked-by tags.

 lib/mbuf/rte_mbuf.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 4c4722e002..babe16c72c 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -1119,6 +1119,9 @@ rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr,
 static inline void
 rte_mbuf_dynfield_copy(struct rte_mbuf *mdst, const struct rte_mbuf *msrc)
 {
+#if !RTE_IOVA_IN_MBUF
+	mdst->dynfield2 = msrc->dynfield2;
+#endif
 	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
 }
 
-- 
2.25.1


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

end of thread, other threads:[~2024-06-27  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-26 12:08 [PATCH] mbuf: fix API to copy mbuf dynamic fields Shijith Thotton
2024-06-26 12:23 ` Morten Brørup
2024-06-26 15:00 ` Stephen Hemminger
2024-06-27  7:57 ` [PATCH v2] " Shijith Thotton

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).