Swapped position of mbuf next pointer and second dynamic field (dynfield2)
if the build is configured to disable IOVA as PA. This is to move the
mbuf next pointer to first cache line.

Signed-off-by: Shijith Thotton <sthot...@marvell.com>
Acked-by: Olivier Matz <olivier.m...@6wind.com>
---
 doc/guides/rel_notes/release_22_11.rst |  3 +++
 lib/mbuf/rte_mbuf_core.h               | 19 ++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_11.rst 
b/doc/guides/rel_notes/release_22_11.rst
index 7431dda461..ab69db8d70 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -385,6 +385,9 @@ ABI Changes
 * eventdev: Added ``weight`` and ``affinity`` fields
   to ``rte_event_queue_conf`` structure.
 
+* mbuf: Replaced ``buf_iova`` field with ``next`` field and added a new field
+  ``dynfield2`` at its place in second cacheline if ``RTE_IOVA_AS_PA`` is 0.
+
 
 Known Issues
 ------------
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index dc6c54015e..37d3fcc3b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -479,10 +479,11 @@ struct rte_mbuf {
        rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
 #else
        /**
-        * Reserved for dynamic field in builds where physical address
-        * field is undefined.
+        * Next segment of scattered packet.
+        * This field is valid when physical address field is undefined.
+        * Otherwise next pointer in the second cache line will be used.
         */
-       uint64_t dynfield2;
+       struct rte_mbuf *next;
 #endif
 
        /* next 8 bytes are initialised on RX descriptor rearm */
@@ -599,11 +600,19 @@ struct rte_mbuf {
        /* second cache line - fields only used in slow path or on TX */
        RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
+#if RTE_IOVA_AS_PA
        /**
-        * Next segment of scattered packet. Must be NULL in the last segment or
-        * in case of non-segmented packet.
+        * Next segment of scattered packet. Must be NULL in the last
+        * segment or in case of non-segmented packet.
         */
        struct rte_mbuf *next;
+#else
+       /**
+        * Reserved for dynamic field when the next pointer is in first
+        * cache line (i.e. RTE_IOVA_AS_PA is 0).
+        */
+       uint64_t dynfield2;
+#endif
 
        /* fields to support TX offloads */
        RTE_STD_C11
-- 
2.25.1

Reply via email to