Skip to contentSkip to conversation

mbuf: move pool pointer in first half

PATCH In review Thomas Monjalon 7 participants 37 messages Nov 7, 2020 – Nov 12, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbuf: move pool pointer in first half

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

Moving this field gives more space to dynfield1.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

---
 doc/guides/rel_notes/deprecation.rst | 7 -------
 drivers/net/octeontx2/otx2_ethdev.c  | 2 --
 lib/librte_kni/rte_kni_common.h      | 3 ++-
 lib/librte_mbuf/rte_mbuf.h           | 1 -
 lib/librte_mbuf/rte_mbuf_core.h      | 5 ++---
 lib/librte_mbuf/rte_mbuf_dyn.c       | 1 -
 6 files changed, 4 insertions(+), 15 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
index f3258eb3f7..efb09f0c5e 100644
@@ -81,13 +81,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* mbuf: Some fields will be converted to dynamic API in DPDK 20.11
-  in order to reserve more space for the dynamic fields, as explained in
-  `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
-  As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
-  avoiding impact on vectorized implementation of the driver datapaths,
-  while evaluating performance gains of a better use of the first cache line.
-
 * ethdev: The flow director API, including ``rte_eth_conf.fdir_conf`` field,
   and the related structures (``rte_fdir_*`` and ``rte_eth_fdir_*``),
   will be removed in DPDK 20.11.
drivers/net/octeontx2/otx2_ethdev.c +0 -2
index 6cebbe677d..d6e0f1dd03 100644
@@ -748,8 +748,6 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 			 offsetof(struct rte_mbuf, buf_iova) + 16);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
 			 offsetof(struct rte_mbuf, ol_flags) + 12);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-			 offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
 
 	if (conf & DEV_TX_OFFLOAD_VLAN_INSERT ||
 	    conf & DEV_TX_OFFLOAD_QINQ_INSERT)
lib/librte_kni/rte_kni_common.h +2 -1
index 36d66e2ffa..ffb3182731 100644
@@ -84,10 +84,11 @@ struct rte_kni_mbuf {
 	char pad2[4];
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 	uint16_t data_len;      /**< Amount of data in segment buffer. */
+	char pad3[14];
+	void *pool;
 
 	/* fields on second cache line */
 	__attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
-	void *pool;
 	void *next;             /**< Physical address of next mbuf in kernel. */
 };
 
lib/librte_mbuf/rte_mbuf.h +0 -1
index 3190a29cce..c4c9ebfaa0 100644
@@ -1107,7 +1107,6 @@ 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)
 {
-	memcpy(&mdst->dynfield0, msrc->dynfield0, sizeof(mdst->dynfield0));
 	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
 }
 
lib/librte_mbuf/rte_mbuf_core.h +2 -3
index debaace95a..567551deab 100644
@@ -586,12 +586,11 @@ struct rte_mbuf {
 
 	uint16_t buf_len;         /**< Length of segment buffer. */
 
-	uint64_t dynfield0[1]; /**< Reserved for dynamic fields. */
+	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
 	RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 	struct rte_mbuf *next;    /**< Next segment of scattered packet. */
 
 	/* fields to support TX offloads */
@@ -645,7 +644,7 @@ struct rte_mbuf {
 	/** Timesync flags for use with IEEE1588. */
 	uint16_t timesync;
 
-	uint32_t dynfield1[7]; /**< Reserved for dynamic fields. */
+	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
 /**
lib/librte_mbuf/rte_mbuf_dyn.c +0 -1
index fd3e019a22..7d5e942bf0 100644
@@ -125,7 +125,6 @@ init_shared_mem(void)
 		 * rte_mbuf_dynfield_copy().
 		 */
 		memset(shm, 0, sizeof(*shm));
-		mark_free(dynfield0);
 		mark_free(dynfield1);
 
 		/* init free_flags */
Signature · 1 line
2.28.0
#1 lore raw
Quoted 6 lines · Thomas Monjalon

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 144 lines

Moving this field gives more space to dynfield1.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

---
 doc/guides/rel_notes/deprecation.rst | 7 -------
 drivers/net/octeontx2/otx2_ethdev.c  | 2 --
 lib/librte_kni/rte_kni_common.h      | 3 ++-
 lib/librte_mbuf/rte_mbuf.h           | 1 -
 lib/librte_mbuf/rte_mbuf_core.h      | 5 ++---
 lib/librte_mbuf/rte_mbuf_dyn.c       | 1 -
 6 files changed, 4 insertions(+), 15 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
index f3258eb3f7..efb09f0c5e 100644
@@ -81,13 +81,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* mbuf: Some fields will be converted to dynamic API in DPDK 20.11
-  in order to reserve more space for the dynamic fields, as explained in
-  `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
-  As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
-  avoiding impact on vectorized implementation of the driver datapaths,
-  while evaluating performance gains of a better use of the first cache line.
-
 * ethdev: The flow director API, including ``rte_eth_conf.fdir_conf`` field,
   and the related structures (``rte_fdir_*`` and ``rte_eth_fdir_*``),
   will be removed in DPDK 20.11.
drivers/net/octeontx2/otx2_ethdev.c +0 -2
index 6cebbe677d..d6e0f1dd03 100644
@@ -748,8 +748,6 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
                         offsetof(struct rte_mbuf, buf_iova) + 16);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
-       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
 
        if (conf & DEV_TX_OFFLOAD_VLAN_INSERT ||
            conf & DEV_TX_OFFLOAD_QINQ_INSERT)
lib/librte_kni/rte_kni_common.h +2 -1
index 36d66e2ffa..ffb3182731 100644
@@ -84,10 +84,11 @@ struct rte_kni_mbuf {
        char pad2[4];
        uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
        uint16_t data_len;      /**< Amount of data in segment buffer. */
+       char pad3[14];
+       void *pool;
 
        /* fields on second cache line */
        __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
-       void *pool;
        void *next;             /**< Physical address of next mbuf in kernel. */
 };
 
lib/librte_mbuf/rte_mbuf.h +0 -1
index 3190a29cce..c4c9ebfaa0 100644
@@ -1107,7 +1107,6 @@ 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)
 {
-       memcpy(&mdst->dynfield0, msrc->dynfield0, sizeof(mdst->dynfield0));
        memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
 }
 
lib/librte_mbuf/rte_mbuf_core.h +2 -3
index debaace95a..567551deab 100644
@@ -586,12 +586,11 @@ struct rte_mbuf {
 
        uint16_t buf_len;         /**< Length of segment buffer. */
 
-       uint64_t dynfield0[1]; /**< Reserved for dynamic fields. */
+       struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
        /* second cache line - fields only used in slow path or on TX */
        RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
-       struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
        struct rte_mbuf *next;    /**< Next segment of scattered packet. */
 
        /* fields to support TX offloads */
@@ -645,7 +644,7 @@ struct rte_mbuf {
        /** Timesync flags for use with IEEE1588. */
        uint16_t timesync;
 
-       uint32_t dynfield1[7]; /**< Reserved for dynamic fields. */
+       uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
 /**
lib/librte_mbuf/rte_mbuf_dyn.c +0 -2
index fd3e019a22..7d5e942bf0 100644
@@ -125,7 +125,6 @@ init_shared_mem(void)
                 * rte_mbuf_dynfield_copy().
                 */
                memset(shm, 0, sizeof(*shm));
-               mark_free(dynfield0);
                mark_free(dynfield1);
 
                /* init free_flags */
--

2.28.0

#2 lore raw

07/11/2020 18:12, Jerin Jacob:

Quoted 16 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

Quoted 5 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

#3 lore raw
Quoted 17 lines · Thomas Monjalon

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

Quoted 2 lines
#4 lore raw

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

#5 lore raw
Quoted 38 lines · Thomas Monjalon

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.
- Also it will be effecting exiting vector routines

I request to reconsider the tech board decision.

Quoted 3 lines
#6 lore raw

09/11/2020 06:18, Jerin Jacob:

Quoted 44 lines · Thomas Monjalon
Quoted 37 lines

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Quoted 6 lines

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Small note: It is not true for all Arm platforms.

Quoted 3 lines

- Also it will be effecting exiting vector routines

I request to reconsider the tech board decision.

#7 lore raw
Quoted 46 lines · Thomas Monjalon

09/11/2020 06:18, Jerin Jacob:

Quoted 44 lines · Thomas Monjalon
Quoted 42 lines

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Quoted 8 lines
Quoted 6 lines

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Small note: It is not true for all Arm platforms.

Yes. Generally, it is not specific to Arm platform. Any platform that has HW accelerated mempool.

Quoted 7 lines
Quoted 4 lines

- Also it will be effecting exiting vector routines

I request to reconsider the tech board decision.

#8 lore raw
Quoted 54 lines · Jerin Jacob
Quoted 53 lines · Thomas Monjalon

09/11/2020 06:18, Jerin Jacob:

Quoted 50 lines · Thomas Monjalon
Quoted 37 lines

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Quoted 5 lines
Quoted 1 line

Small note: It is not true for all Arm platforms.

Yes. Generally, it is not specific to Arm platform. Any platform that has HW accelerated mempool.

Hi Jerin, Thomas,

For platforms without hw mempool support too, the same holds that the pool pointer should never need to be touched on RX. However, as we discussed on the tech board, moving the pointer may help a little some cases, and especially less optimized drivers, and there seemed to be no downside to it. Jerin, can you please clarify why moving the pool pointer would cause a problem? Is it going to cause things to be slower on some systems for some reasons?

Regards,
/Bruce

#9 lore raw
Quoted 64 lines · Bruce Richardson
Quoted 54 lines · Jerin Jacob
Quoted 53 lines · Thomas Monjalon

09/11/2020 06:18, Jerin Jacob:

Quoted 50 lines · Thomas Monjalon
Quoted 37 lines

07/11/2020 20:05, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 16 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 15 lines · Thomas Monjalon
Quoted 6 lines

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to the pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the first 64B cache line? The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

See below.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

It will be breaking the Tx path, Please just don't remove the static assert without adjusting the code.

Quoted 8 lines
Quoted 4 lines

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the rationale for this change
and where it helps and how much it helps?

Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Quoted 5 lines
Quoted 1 line

Small note: It is not true for all Arm platforms.

Yes. Generally, it is not specific to Arm platform. Any platform that has HW accelerated mempool.

Hi Jerin, Thomas,

Quoted 7 lines

For platforms without hw mempool support too, the same holds that the pool pointer should never need to be touched on RX. However, as we discussed on the tech board, moving the pointer may help a little some cases, and especially less optimized drivers, and there seemed to be no downside to it. Jerin, can you please clarify why moving the pool pointer would cause a problem? Is it going to cause things to be slower on some systems for some reasons?

I overlooked on that part, No specific issue in moving first cache line.

Hi @Thomas Monjalon

Any specific reason why you removed the static assert from octeontx2. I am not able
to compilation issue with that static assert.

The current vector driver assumes pool and tx offload needs to 2 DWORDS apart, Which is the case before and after your change.

Please remove that static assert change, No issue from my side on this patch.

In general, it is too much effort to re-verify and measure performance impact with
all the cases after RC2, I hope this will last mbuf change in this release.

Quoted 3 lines

Regards,
/Bruce

#10 lore raw

09/11/2020 13:01, Jerin Jacob:

Quoted 3 lines

Hi @Thomas Monjalon

Any specific reason why you removed the static assert from octeontx2.

I have a build failure when cross-compiling for octeontx2.

Quoted 1 line

I am not able to compilation issue with that static assert.

There is no issue when compiling for x86.

Quoted 2 lines

The current vector driver assumes pool and tx offload needs to 2 DWORDS apart, Which is the case before and after your change.

You're right, pool and tx_offload are moved together. The only difference is passing the cache line frontier.

Quoted 1 line

Please remove that static assert change, No issue from my side on this patch.

I cannot remove it without fixing something else, maybe an issue in cache line alignment?

Quoted 3 lines

In general, it is too much effort to re-verify and measure performance impact with
all the cases after RC2, I hope this will last mbuf change in this release.

Yes it is the last change to mbuf layout, sorry for pushing all these changes so late.

#11 lore raw
Quoted 7 lines · Thomas Monjalon

09/11/2020 13:01, Jerin Jacob:

Quoted 3 lines

Hi @Thomas Monjalon

Any specific reason why you removed the static assert from octeontx2.

I have a build failure when cross-compiling for octeontx2.

I am trying the below command, I am not able to see any issue meson build --cross-file config/arm/arm64_octeontx2_linux_gcc

Are you facing the issue with 32bit? Could you share the steps to reproduce and gcc version?

Quoted 8 lines
Quoted 2 lines

I am not able to compilation issue with that static assert.

There is no issue when compiling for x86.

Quoted 2 lines

The current vector driver assumes pool and tx offload needs to 2 DWORDS apart, Which is the case before and after your change.

Quoted 7 lines

You're right, pool and tx_offload are moved together. The only difference is passing the cache line frontier.

Quoted 1 line

Please remove that static assert change, No issue from my side on this patch.

I cannot remove it without fixing something else, maybe an issue in cache line alignment?

Can try the below fix. If the issue is seen with 32bit.

(quoted diff) +0 -0

b/drivers/net/octeontx2/otx2_ethdev.c
index 6cebbe677..66a4d429d 100644

drivers/net/octeontx2/otx2_ethdev.c +1 -1
@@ -749,7 +749,7 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
+                        offsetof(struct rte_mbuf, pool) + 2 *

sizeof(uint64_t));

Quoted 10 lines
Quoted 4 lines

In general, it is too much effort to re-verify and measure performance impact with
all the cases after RC2, I hope this will last mbuf change in this release.

Yes it is the last change to mbuf layout, sorry for pushing all these changes so late.

#12 lore raw

09/11/2020 14:35, Jerin Jacob:

Quoted 8 lines · Thomas Monjalon
Quoted 7 lines

09/11/2020 13:01, Jerin Jacob:

Quoted 3 lines

Hi @Thomas Monjalon

Any specific reason why you removed the static assert from octeontx2.

I have a build failure when cross-compiling for octeontx2.

I was wrong here.

Quoted 5 lines

I am trying the below command, I am not able to see any issue meson build --cross-file config/arm/arm64_octeontx2_linux_gcc

Are you facing the issue with 32bit? Could you share the steps to reproduce and gcc version?

Oh you're right, the issue was with 32-bit build, sorry for the confusion.

drivers/net/octeontx2/otx2_ethdev.c nix_tx_offload_flags(struct rte_eth_dev *eth_dev) · line 752

Quoted 8 lines
drivers/net/octeontx2/otx2_ethdev.c +1 -1
@@ -749,7 +749,7 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
+                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(uint64_t));

The actual "fix" is
offsetof(struct rte_mbuf, pool) + sizeof(uint64_t) + sizeof(void *)

I don't understand the octeontx2 vector code. Please check what is the impact of this offset change. BTW, is 32-bit build really supported with octeontx2?

#13 lore raw
Quoted 13 lines · Thomas Monjalon

09/11/2020 14:35, Jerin Jacob:

Quoted 8 lines · Thomas Monjalon
Quoted 7 lines

09/11/2020 13:01, Jerin Jacob:

Quoted 3 lines

Hi @Thomas Monjalon

Any specific reason why you removed the static assert from octeontx2.

I have a build failure when cross-compiling for octeontx2.

I was wrong here.

Quoted 7 lines
Quoted 5 lines

I am trying the below command, I am not able to see any issue meson build --cross-file config/arm/arm64_octeontx2_linux_gcc

Are you facing the issue with 32bit? Could you share the steps to reproduce and gcc version?

Oh you're right, the issue was with 32-bit build,

Thanks

Quoted 15 lines

sorry for the confusion.

drivers/net/octeontx2/otx2_ethdev.c nix_tx_offload_flags(struct rte_eth_dev *eth_dev) · line 752

Quoted 8 lines
drivers/net/octeontx2/otx2_ethdev.c +1 -1
@@ -749,7 +749,7 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
+                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(uint64_t));

The actual "fix" is
offsetof(struct rte_mbuf, pool) + sizeof(uint64_t) + sizeof(void *)

Quoted 2 lines

I don't understand the octeontx2 vector code. Please check what is the impact of this offset change.

Tested the changes, No issue seen. All the expectation of vector code is expressed with RTE_BUILD_BUG_ON.

Quoted 1 line

BTW, is 32-bit build really supported with octeontx2?

No. I think, keeping assert as "sizeof(void *)"(Same as now) and remove build support for 32bit works too for octeontx2.
We will add it when really required.

Quoted 2 lines
#14 lore raw

09/11/2020 15:08, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 5 lines

09/11/2020 14:35, Jerin Jacob:

Quoted 2 lines

Are you facing the issue with 32bit? Could you share the steps to reproduce and gcc version?

Oh you're right, the issue was with 32-bit build,

Thanks

Quoted 15 lines

sorry for the confusion.

drivers/net/octeontx2/otx2_ethdev.c nix_tx_offload_flags(struct rte_eth_dev *eth_dev) · line 752

Quoted 8 lines
drivers/net/octeontx2/otx2_ethdev.c +1 -1
@@ -749,7 +749,7 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
+                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(uint64_t));

The actual "fix" is
offsetof(struct rte_mbuf, pool) + sizeof(uint64_t) + sizeof(void *)

Quoted 2 lines

I don't understand the octeontx2 vector code. Please check what is the impact of this offset change.

Quoted 7 lines

Tested the changes, No issue seen. All the expectation of vector code is expressed with RTE_BUILD_BUG_ON.

Quoted 1 line

BTW, is 32-bit build really supported with octeontx2?

No. I think, keeping assert as "sizeof(void *)"(Same as now) and remove build support for 32bit works too for octeontx2.

OK, I think it's better than tweaking RTE_BUILD_BUG_ON for something not really supported.

Quoted 1 line

We will add it when really required.

Then I'm going to send a patch to disable octeontx2 drivers on 32-bit.

Note there is another build issue with octeontx2 drivers on CentOS/RHEL 7 with Arm GGC 4.8.

#15 lore raw
Quoted 37 lines · Thomas Monjalon

09/11/2020 15:08, Jerin Jacob:

Quoted 27 lines · Thomas Monjalon
Quoted 5 lines

09/11/2020 14:35, Jerin Jacob:

Quoted 2 lines

Are you facing the issue with 32bit? Could you share the steps to reproduce and gcc version?

Oh you're right, the issue was with 32-bit build,

Thanks

Quoted 15 lines

sorry for the confusion.

drivers/net/octeontx2/otx2_ethdev.c nix_tx_offload_flags(struct rte_eth_dev *eth_dev) · line 752

Quoted 8 lines
drivers/net/octeontx2/otx2_ethdev.c +1 -1
@@ -749,7 +749,7 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
                         offsetof(struct rte_mbuf, ol_flags) + 12);
        RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
+                        offsetof(struct rte_mbuf, pool) + 2 * sizeof(uint64_t));

The actual "fix" is
offsetof(struct rte_mbuf, pool) + sizeof(uint64_t) + sizeof(void *)

Quoted 2 lines

I don't understand the octeontx2 vector code. Please check what is the impact of this offset change.

Quoted 7 lines

Tested the changes, No issue seen. All the expectation of vector code is expressed with RTE_BUILD_BUG_ON.

Quoted 1 line

BTW, is 32-bit build really supported with octeontx2?

No. I think, keeping assert as "sizeof(void *)"(Same as now) and remove build support for 32bit works too for octeontx2.

Quoted 6 lines

OK, I think it's better than tweaking RTE_BUILD_BUG_ON for something not really supported.

Quoted 1 line

We will add it when really required.

Then I'm going to send a patch to disable octeontx2 drivers on 32-bit.

OK.

Quoted 3 lines

Note there is another build issue with octeontx2 drivers on CentOS/RHEL 7 with Arm GGC 4.8.

It is a segfault from the compiler. In Makefile, we have skipped building < 4.9, not sure what needs to be done
for meson.

Quoted 2 lines
#16 lore raw
In reply to Jerin Jacob

+CC techboard

Quoted 59 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, November 9, 2020 6:18 AM

Quoted 3 lines · Thomas Monjalon

07/11/2020 20:05, Jerin Jacob:

Quoted 1 line

On Sun, Nov 8, 2020 at 12:09 AM Thomas Monjalon

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 1 line

On Sat, Nov 7, 2020 at 10:04 PM Thomas Monjalon

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The mempool pointer in the mbuf struct is moved from the second to the first half.
It should increase performance on most systems having 64-byte

cache line,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the

first 64B cache line?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it

needs to

Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

touch in Tx if the reference count is implemented.

See below.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some vector data

paths

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

may need to be adjusted. Note: OCTEON TX2 check is removed

temporarily!

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It will be breaking the Tx path, Please just don't remove the

static

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the

rationale

Quoted 8 lines
Quoted 2 lines

for this change
and where it helps and how much it helps?

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Quoted 6 lines

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Jerin, I don't understand what the problem is here...

Since RX doesn't touch m->pool, it shouldn't matter for RX which cache line m->pool resides in. I get that.

You are saying that TX needs to touch m->pool if the reference count is implemented. I get that. But I don't understand why it is worse having m->pool in the first cache line than in the second cache line; can you please clarify?

Quoted 1 line

- Also it will be effecting exiting vector routines

That is unavoidable if we move something from the second to the first cache line.

It may require some rework on the vector routines, but it shouldn't be too difficult for whoever wrote these vector routines.

Quoted 2 lines

I request to reconsider the tech board decision.

I was on the techboard meeting as an observer (or whatever the correct term would be for non-members), and this is my impression of the decision on the meeting:

The techboard clearly decided not to move any dynamic fields in the first cache line, on the grounds that if we move them away again in a later version, DPDK users utilizing a dynamic field in the first cache line might experience a performance drop at that later time. And this will be a very bad user experience, causing grief and complaints. To me, this seemed like a firm decision, based on solid arguments.

Then the techboard discussed which other field to move to the freed up space in the first cache line. There were no performance reports showing any improvements by moving the any of the suggested fields (m->pool, m->next, m->tx_offload), and there was a performance report showing no improvements by moving m->next in a test case with large segmented packets. The techboard decided to move m->pool as originally suggested. To me, this seemed like a somewhat random choice between A, B and C, on the grounds that moving one of them is probably better than moving none of them.

The techboard made its decision based on the information available at that time.

Unfortunately, I do not have the resources to test the performance improvement by moving m->next to the first cache line instead of m->pool and utilizing the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag mentioned by Konstantin.

If no new information comes to light, we cannot expect the techboard to change a decision it has already made.

In any case, I am grateful for the joint effort put into nurturing the mbuf, and especially Thomas' unrelenting hard work in this area!

Med venlig hilsen / kind regards
- Morten Brørup

#17 lore raw
Quoted 81 lines · Morten Brørup

+CC techboard

Quoted 59 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, November 9, 2020 6:18 AM

Quoted 3 lines · Thomas Monjalon

07/11/2020 20:05, Jerin Jacob:

Quoted 1 line

On Sun, Nov 8, 2020 at 12:09 AM Thomas Monjalon

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 1 line

On Sat, Nov 7, 2020 at 10:04 PM Thomas Monjalon

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The mempool pointer in the mbuf struct is moved from the second to the first half.
It should increase performance on most systems having 64-byte

cache line,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing back to

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the

first 64B cache line?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

The gain varies from driver to driver. For example, a Typical ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it

needs to

Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

touch in Tx if the reference count is implemented.

See below.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some vector data

paths

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

may need to be adjusted. Note: OCTEON TX2 check is removed

temporarily!

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It will be breaking the Tx path, Please just don't remove the

static

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the

rationale

Quoted 8 lines
Quoted 2 lines

for this change
and where it helps and how much it helps?

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Quoted 6 lines

Yes. Initially, I thought it is OK as we have 128B CL, After looking into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx and its been filled by HW. Whereas it needs to
touch in Tx if the reference count is implemented.

Jerin, I don't understand what the problem is here...

Since RX doesn't touch m->pool, it shouldn't matter for RX which cache line m->pool resides in. I get that.

You are saying that TX needs to touch m->pool if the reference count is implemented. I get that. But I don't understand why it is worse having m->pool in the first cache line than in the second cache line; can you please clarify?

Quoted 1 line

- Also it will be effecting exiting vector routines

That is unavoidable if we move something from the second to the first cache line.

It may require some rework on the vector routines, but it shouldn't be too difficult for whoever wrote these vector routines.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

I request to reconsider the tech board decision.

I was on the techboard meeting as an observer (or whatever the correct term would be for non-members), and this is my impression of the decision on the meeting:

The techboard clearly decided not to move any dynamic fields in the first cache line, on the grounds that if we move them away again in a later version, DPDK users utilizing a dynamic field in the first cache line might experience a performance drop at that later time. And this will be a very bad user experience, causing grief and complaints. To me, this seemed like a firm decision, based on solid arguments.

Then the techboard discussed which other field to move to the freed up space in the first cache line. There were no performance reports showing any improvements by moving the any of the suggested fields (m->pool, m->next, m->tx_offload), and there was a performance report showing no improvements by moving m->next in a test case with large segmented packets. The techboard decided to move m->pool as originally suggested. To me, this seemed like a somewhat random choice between A, B and C, on the grounds that moving one of them is probably better than moving none of them.

This largely tallies with what I remember of the discussion too.

I'd also add though that the choice between the next pointer and the pool pointer came down to the fact that the next pointer is only used for chained, multi-segment, packets - which also tend to be larger packets - while the pool pointer is of relevance to all packets, big and small, single and multi-segment.

/Bruce

#18 lore raw
Quoted 126 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Monday, November 9, 2020 11:06 AM

Quoted 6 lines · Morten Brørup

+CC techboard

Quoted 4 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, November 9, 2020 6:18 AM

On Sun, Nov 8, 2020 at 2:03 AM Thomas Monjalon

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:

07/11/2020 20:05, Jerin Jacob:

Quoted 1 line

On Sun, Nov 8, 2020 at 12:09 AM Thomas Monjalon

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 1 line

On Sat, Nov 7, 2020 at 10:04 PM Thomas Monjalon

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The mempool pointer in the mbuf struct is moved from the second to the first half.
It should increase performance on most systems having 64-

byte

Quoted 5 lines
Quoted 5 lines

cache line,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing

back to

Quoted 5 lines
Quoted 5 lines

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the

first 64B cache line?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The gain varies from driver to driver. For example, a

Typical

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it

needs to

Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

touch in Tx if the reference count is implemented.

See below.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some vector

data

Quoted 2 lines
Quoted 2 lines

paths

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

may need to be adjusted. Note: OCTEON TX2 check is

removed

Quoted 3 lines
Quoted 3 lines

temporarily!

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It will be breaking the Tx path, Please just don't remove

the

Quoted 13 lines
Quoted 13 lines

static

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the

rationale

Quoted 3 lines
Quoted 2 lines

for this change
and where it helps and how much it helps?

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After

looking

Quoted 3 lines
Quoted 3 lines

into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx

and

Quoted 6 lines
Quoted 2 lines

its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

Jerin, I don't understand what the problem is here...

Since RX doesn't touch m->pool, it shouldn't matter for RX which

cache line m->pool resides in. I get that.

Quoted 2 lines

You are saying that TX needs to touch m->pool if the reference count

is implemented. I get that. But I don't understand why it is worse having m->pool in the first cache line than in the second cache line; can you please clarify?

Quoted 4 lines
Quoted 2 lines

- Also it will be effecting exiting vector routines

That is unavoidable if we move something from the second to the first

cache line.

Quoted 2 lines

It may require some rework on the vector routines, but it shouldn't

be too difficult for whoever wrote these vector routines.

Quoted 5 lines
Quoted 3 lines

I request to reconsider the tech board decision.

I was on the techboard meeting as an observer (or whatever the

correct term would be for non-members), and this is my impression of the decision on the meeting:

Quoted 2 lines

The techboard clearly decided not to move any dynamic fields in the

first cache line, on the grounds that if we move them away again in a later version, DPDK users utilizing a dynamic field in the first cache line might experience a performance drop at that later time. And this will be a very bad user experience, causing grief and complaints. To me, this seemed like a firm decision, based on solid arguments.

Quoted 2 lines

Then the techboard discussed which other field to move to the freed

up space in the first cache line. There were no performance reports showing any improvements by moving the any of the suggested fields (m-

Quoted 1 line

pool, m->next, m->tx_offload), and there was a performance report

showing no improvements by moving m->next in a test case with large segmented packets. The techboard decided to move m->pool as originally suggested. To me, this seemed like a somewhat random choice between A, B and C, on the grounds that moving one of them is probably better than moving none of them.

Quoted 1 line

This largely tallies with what I remember of the discussion too.

Quoted 7 lines

I'd also add though that the choice between the next pointer and the pool
pointer came down to the fact that the next pointer is only used for chained, multi-segment, packets - which also tend to be larger packets -
while the pool pointer is of relevance to all packets, big and small, single and multi-segment.

I wish that was the case, but I am not so sure...

It is true that m->next is NULL for non-segmented packets.

However, m->next is read in the likely path of rte_pktmbuf_prefree_seg(), which is called from e.g. rte_pktmbuf_free_seg(), and again from rte_pktmbuf_free(). And I assume that these functions are quite commonly used.

Not being a PMD developer, I might be wrong about this assumption.

Quoted 2 lines

/Bruce

#19 lore raw
Quoted 134 lines · On Mon, 9 Nov 2020 11:21:02 +0100 Morten Brørup <[email protected]>…
Quoted 126 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Monday, November 9, 2020 11:06 AM

Quoted 6 lines · Morten Brørup

+CC techboard

Quoted 4 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, November 9, 2020 6:18 AM

On Sun, Nov 8, 2020 at 2:03 AM Thomas Monjalon

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:

07/11/2020 20:05, Jerin Jacob:

Quoted 1 line

On Sun, Nov 8, 2020 at 12:09 AM Thomas Monjalon

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 1 line

On Sat, Nov 7, 2020 at 10:04 PM Thomas Monjalon

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The mempool pointer in the mbuf struct is moved from the second to the first half.
It should increase performance on most systems having 64-

byte

Quoted 5 lines
Quoted 5 lines

cache line,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing

back to

Quoted 5 lines
Quoted 5 lines

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pool upon Tx completion. Right?
Not able to understand the motivation for moving it to the

first 64B cache line?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The gain varies from driver to driver. For example, a

Typical

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas it

needs to

Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

touch in Tx if the reference count is implemented.

See below.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some vector

data

Quoted 2 lines
Quoted 2 lines

paths

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

may need to be adjusted. Note: OCTEON TX2 check is

removed

Quoted 3 lines
Quoted 3 lines

temporarily!

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It will be breaking the Tx path, Please just don't remove

the

Quoted 13 lines
Quoted 13 lines

static

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Off course. Could you check the above section any share the

rationale

Quoted 3 lines
Quoted 2 lines

for this change
and where it helps and how much it helps?

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

It has been concluded in the techboard meeting you were part of. I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then please do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After

looking

Quoted 3 lines
Quoted 3 lines

into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in Rx

and

Quoted 6 lines
Quoted 2 lines

its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

Jerin, I don't understand what the problem is here...

Since RX doesn't touch m->pool, it shouldn't matter for RX which

cache line m->pool resides in. I get that.

Quoted 2 lines

You are saying that TX needs to touch m->pool if the reference count

is implemented. I get that. But I don't understand why it is worse having m->pool in the first cache line than in the second cache line; can you please clarify?

Quoted 4 lines
Quoted 2 lines

- Also it will be effecting exiting vector routines

That is unavoidable if we move something from the second to the first

cache line.

Quoted 2 lines

It may require some rework on the vector routines, but it shouldn't

be too difficult for whoever wrote these vector routines.

Quoted 5 lines
Quoted 3 lines

I request to reconsider the tech board decision.

I was on the techboard meeting as an observer (or whatever the

correct term would be for non-members), and this is my impression of the decision on the meeting:

Quoted 2 lines

The techboard clearly decided not to move any dynamic fields in the

first cache line, on the grounds that if we move them away again in a later version, DPDK users utilizing a dynamic field in the first cache line might experience a performance drop at that later time. And this will be a very bad user experience, causing grief and complaints. To me, this seemed like a firm decision, based on solid arguments.

Quoted 2 lines

Then the techboard discussed which other field to move to the freed

up space in the first cache line. There were no performance reports showing any improvements by moving the any of the suggested fields (m-

Quoted 1 line

pool, m->next, m->tx_offload), and there was a performance report

showing no improvements by moving m->next in a test case with large segmented packets. The techboard decided to move m->pool as originally suggested. To me, this seemed like a somewhat random choice between A, B and C, on the grounds that moving one of them is probably better than moving none of them.

Quoted 1 line

This largely tallies with what I remember of the discussion too.

Quoted 7 lines

I'd also add though that the choice between the next pointer and the pool
pointer came down to the fact that the next pointer is only used for chained, multi-segment, packets - which also tend to be larger packets -
while the pool pointer is of relevance to all packets, big and small, single and multi-segment.

Quoted 3 lines

I wish that was the case, but I am not so sure...

It is true that m->next is NULL for non-segmented packets.

Yes m->next is NULL for non-segmented packets.
Do we need to modify rte_mbuf_check() to enforce these checks?

#20 lore raw
Quoted 166 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Monday, November 9, 2020 7:05 PM

Quoted 1 line · On Mon, 9 Nov 2020 11:21:02 +0100 Morten Brørup <[email protected]>…
Quoted 1 line

From: dev [mailto:[email protected]] On Behalf Of Bruce

Richardson

Quoted 14 lines
Quoted 14 lines

Sent: Monday, November 9, 2020 11:06 AM

Quoted 6 lines · Morten Brørup

+CC techboard

Quoted 4 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, November 9, 2020 6:18 AM

On Sun, Nov 8, 2020 at 2:03 AM Thomas Monjalon

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:

07/11/2020 20:05, Jerin Jacob:

Quoted 1 line

On Sun, Nov 8, 2020 at 12:09 AM Thomas Monjalon

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

07/11/2020 18:12, Jerin Jacob:

Quoted 1 line

On Sat, Nov 7, 2020 at 10:04 PM Thomas Monjalon

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The mempool pointer in the mbuf struct is moved from the second to the first half.
It should increase performance on most systems having

64-

Quoted 10 lines
Quoted 10 lines

byte

Quoted 5 lines
Quoted 5 lines

cache line,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

i.e. mbuf is split in two cache lines.

But In any event, Tx needs to touch the pool to freeing

back to

Quoted 3 lines
Quoted 3 lines

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pool upon Tx completion. Right?
Not able to understand the motivation for moving it to

the

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

first 64B cache line?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The gain varies from driver to driver. For example, a

Typical

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ARM-based NPU does not need to
touch the pool in Rx and its been filled by HW. Whereas

it

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

needs to

Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

touch in Tx if the reference count is implemented.

See below.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Due to this change, tx_offload is moved, so some

vector

Quoted 7 lines
Quoted 7 lines

data

Quoted 2 lines
Quoted 2 lines

paths

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

may need to be adjusted. Note: OCTEON TX2 check is

removed

Quoted 3 lines
Quoted 3 lines

temporarily!

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It will be breaking the Tx path, Please just don't

remove

Quoted 9 lines
Quoted 9 lines

the

Quoted 8 lines
Quoted 8 lines

static

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

assert without adjusting the code.

Of course not.
I looked at the vector Tx path of OCTEON TX2,
it's close to be impossible to understand :)
Please help!

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

Off course. Could you check the above section any share the

rationale

Quoted 4 lines
Quoted 2 lines

for this change
and where it helps and how much it helps?

It has been concluded in the techboard meeting you were part

of.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I don't understand why we restart this discussion again. I won't have the energy to restart this process myself. If you don't want to apply the techboard decision, then

please

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

do the necessary to request another quick decision.

Yes. Initially, I thought it is OK as we have 128B CL, After

looking

Quoted 3 lines
Quoted 3 lines

into Thomas's change, I realized
it is not good for ARM64 64B catchlines based NPU as
- A Typical ARM-based NPU does not need to touch the pool in

Rx

Quoted 10 lines
Quoted 10 lines

and

Quoted 6 lines
Quoted 2 lines

its been filled by HW. Whereas it needs to touch in Tx if the reference count is implemented.

Jerin, I don't understand what the problem is here...

Since RX doesn't touch m->pool, it shouldn't matter for RX which

cache line m->pool resides in. I get that.

Quoted 2 lines

You are saying that TX needs to touch m->pool if the reference

count

Quoted 2 lines
Quoted 2 lines

is implemented. I get that. But I don't understand why it is worse having m->pool in the first cache line than in the second cache

line;

Quoted 5 lines
Quoted 5 lines

can you please clarify?

Quoted 4 lines
Quoted 2 lines

- Also it will be effecting exiting vector routines

That is unavoidable if we move something from the second to the

first

Quoted 3 lines
Quoted 3 lines

cache line.

Quoted 2 lines

It may require some rework on the vector routines, but it

shouldn't

Quoted 7 lines
Quoted 7 lines

be too difficult for whoever wrote these vector routines.

Quoted 5 lines
Quoted 3 lines

I request to reconsider the tech board decision.

I was on the techboard meeting as an observer (or whatever the

correct term would be for non-members), and this is my impression

of

Quoted 3 lines
Quoted 3 lines

the decision on the meeting:

Quoted 2 lines

The techboard clearly decided not to move any dynamic fields in

the

Quoted 1 line
Quoted 1 line

first cache line, on the grounds that if we move them away again in

a

Quoted 1 line
Quoted 1 line

later version, DPDK users utilizing a dynamic field in the first

cache

Quoted 1 line
Quoted 1 line

line might experience a performance drop at that later time. And

this

Quoted 1 line
Quoted 1 line

will be a very bad user experience, causing grief and complaints.

To

Quoted 3 lines
Quoted 3 lines

me, this seemed like a firm decision, based on solid arguments.

Quoted 2 lines

Then the techboard discussed which other field to move to the

freed

Quoted 2 lines
Quoted 2 lines

up space in the first cache line. There were no performance reports showing any improvements by moving the any of the suggested fields

(m-

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

pool, m->next, m->tx_offload), and there was a performance report

showing no improvements by moving m->next in a test case with large segmented packets. The techboard decided to move m->pool as

originally

Quoted 1 line
Quoted 1 line

suggested. To me, this seemed like a somewhat random choice between

A,

Quoted 1 line
Quoted 1 line

B and C, on the grounds that moving one of them is probably better

than

Quoted 6 lines
Quoted 6 lines

moving none of them.

Quoted 1 line

This largely tallies with what I remember of the discussion too.

I'd also add though that the choice between the next pointer and

the

Quoted 2 lines
Quoted 2 lines

pool
pointer came down to the fact that the next pointer is only used

for

Quoted 1 line
Quoted 1 line

chained, multi-segment, packets - which also tend to be larger

packets

Quoted 2 lines
Quoted 2 lines

-
while the pool pointer is of relevance to all packets, big and

small,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

single and multi-segment.

I wish that was the case, but I am not so sure...

It is true that m->next is NULL for non-segmented packets.

Yes m->next is NULL for non-segmented packets.
Do we need to modify rte_mbuf_check() to enforce these checks?

I went through rte_mbuf_check() in my head, and it already enforces this check:
When called with is_header set, the function proceeds to count the number of segments by following the m->next chain (while m->next is not NULL), and checks that the count matches m->nb_segs. The loop in the function (used when called with is_header set) is implemented to also check that m->nb_segs == 1 when m->next == NULL.

#21 lore raw
In reply to Thomas Monjalon
Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by Konstantin, it might be better moving m->next instead, at least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Unfortunately, the information about the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

Quoted 3 lines

Due to this change, tx_offload is moved, so some vector data paths may need to be adjusted. Note: OCTEON TX2 check is removed temporarily!

Regardless if m->pool or m->next is moved, it will not affect any issues related to m->tx_offload moving to a new location in the second cache line.

Quoted 156 lines

Moving this field gives more space to dynfield1.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

---
 doc/guides/rel_notes/deprecation.rst | 7 -------
 drivers/net/octeontx2/otx2_ethdev.c  | 2 --
 lib/librte_kni/rte_kni_common.h      | 3 ++-
 lib/librte_mbuf/rte_mbuf.h           | 1 -
 lib/librte_mbuf/rte_mbuf_core.h      | 5 ++---
 lib/librte_mbuf/rte_mbuf_dyn.c       | 1 -
 6 files changed, 4 insertions(+), 15 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -0
index f3258eb3f7..efb09f0c5e 100644
@@ -81,13 +81,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*``

value.

doc/guides/rel_notes/deprecation.rst +0 -4
-* mbuf: Some fields will be converted to dynamic API in DPDK 20.11
-  in order to reserve more space for the dynamic fields, as explained in
-  `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
-  As a consequence, the layout of the ``struct rte_mbuf`` will be re-

arranged,

doc/guides/rel_notes/deprecation.rst +0 -2
-  avoiding impact on vectorized implementation of the driver datapaths,
-  while evaluating performance gains of a better use of the first cache

line.
-
* ethdev: The flow director API, including ``rte_eth_conf.fdir_conf``
field,
and the related structures (``rte_fdir_*`` and ``rte_eth_fdir_*``), will be removed in DPDK 20.11.

drivers/net/octeontx2/otx2_ethdev.c +0 -2
index 6cebbe677d..d6e0f1dd03 100644
@@ -748,8 +748,6 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 			 offsetof(struct rte_mbuf, buf_iova) + 16);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
 			 offsetof(struct rte_mbuf, ol_flags) + 12);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
-			 offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
 
 	if (conf & DEV_TX_OFFLOAD_VLAN_INSERT ||
 	    conf & DEV_TX_OFFLOAD_QINQ_INSERT)
lib/librte_kni/rte_kni_common.h +0 -0
index 36d66e2ffa..ffb3182731 100644
@@ -84,10 +84,11 @@ struct rte_kni_mbuf {
 	char pad2[4];
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment

data_len. */

lib/librte_kni/rte_kni_common.h +2 -1
 	uint16_t data_len;      /**< Amount of data in segment buffer. */
+	char pad3[14];
+	void *pool;
 
 	/* fields on second cache line */
 	__attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
-	void *pool;
 	void *next;             /**< Physical address of next mbuf in kernel.

*/
};

lib/librte_mbuf/rte_mbuf.h +0 -1
index 3190a29cce..c4c9ebfaa0 100644
@@ -1107,7 +1107,6 @@ 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)
 {
-	memcpy(&mdst->dynfield0, msrc->dynfield0, sizeof(mdst->dynfield0));
 	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
 }
lib/librte_mbuf/rte_mbuf_core.h +2 -3
index debaace95a..567551deab 100644
@@ -586,12 +586,11 @@ struct rte_mbuf {
 
 	uint16_t buf_len;         /**< Length of segment buffer. */
 
-	uint64_t dynfield0[1]; /**< Reserved for dynamic fields. */
+	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
 	RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 	struct rte_mbuf *next;    /**< Next segment of scattered packet. */
 
 	/* fields to support TX offloads */
@@ -645,7 +644,7 @@ struct rte_mbuf {
 	/** Timesync flags for use with IEEE1588. */
 	uint16_t timesync;
 
-	uint32_t dynfield1[7]; /**< Reserved for dynamic fields. */
+	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
 /**
lib/librte_mbuf/rte_mbuf_dyn.c +0 -2
index fd3e019a22..7d5e942bf0 100644
@@ -125,7 +125,6 @@ init_shared_mem(void)
 		 * rte_mbuf_dynfield_copy().
 		 */
 		memset(shm, 0, sizeof(*shm));
-		mark_free(dynfield0);
 		mark_free(dynfield1);
 
 		/* init free_flags */
--

2.28.0

#22 lore raw
Quoted 12 lines · Morten Brørup
Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by Konstantin, it might be better moving m->next instead, at least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Unfortunately, the information about the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

The thing with FAST_FREE is that it doesn't just indicate that there is only one mbuf pool, but rather that none of the packets are chained mbufs either. Therefore, the flag applies equally to both next and pool pointers for optimization. [And the flag should perhaps be two flags!]

/Bruce

#23 lore raw
Quoted 25 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, November 9, 2020 11:09 AM

Quoted 6 lines · Morten Brørup
Quoted 6 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache

line,

Quoted 3 lines
Quoted 1 line

i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by

Konstantin, it might be better moving m->next instead, at least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Quoted 2 lines

Unfortunately, the information about the

DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

Quoted 1 line
Quoted 6 lines

The thing with FAST_FREE is that it doesn't just indicate that there is only one mbuf pool, but rather that none of the packets are chained mbufs
either. Therefore, the flag applies equally to both next and pool pointers
for optimization. [And the flag should perhaps be two flags!]

I guess we could offer the same optimization to applications by adding a rte_mbuf_raw_free_bulk() function to the mbuf library. I will put that on my ToDo-list. :-)

#24 lore raw
In reply to Bruce Richardson
Quoted 14 lines · Morten Brørup
Quoted 9 lines
Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by Konstantin, it might be better moving m->next instead, at

least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Unfortunately, the information about the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I

don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

Quoted 1 line

The thing with FAST_FREE is that it doesn't just indicate that there is only one mbuf pool, but rather that none of the packets are chained mbufs either.

Hmm, wonder where such assumption comes from?
There is nothing about forbidding chained mbufs in rte_ethdev.h right now:
#define DEV_TX_OFFLOAD_MBUF_FAST_FREE 0x00010000
/**< Device supports optimization for fast release of mbufs.
* When set application must guarantee that per-queue all mbufs comes from
* the same mempool and has refcnt = 1.
*/

Quoted 3 lines

Therefore, the flag applies equally to both next and pool pointers for optimization. [And the flag should perhaps be two flags!]

I think what Morten means here:
For FAST_FREE PMD can store pool pointer somewhere in its queue metadata and doesn't need to read it from the mbuf.
So if we move next to first line - mbuf_free code-path for FAST_FREE case can avoid touching second cache line in the mbuf.

#25 lore raw
Quoted 22 lines · Konstantin
Quoted 14 lines · Morten Brørup
Quoted 9 lines
Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by Konstantin, it might be better moving m->next instead, at

least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Unfortunately, the information about the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I

don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

Quoted 1 line

The thing with FAST_FREE is that it doesn't just indicate that there is only one mbuf pool, but rather that none of the packets are chained mbufs either.

Quoted 8 lines

Hmm, wonder where such assumption comes from?
There is nothing about forbidding chained mbufs in rte_ethdev.h right now:
#define DEV_TX_OFFLOAD_MBUF_FAST_FREE 0x00010000
/**< Device supports optimization for fast release of mbufs.
* When set application must guarantee that per-queue all mbufs comes from
* the same mempool and has refcnt = 1.
*/

I should have checked before mailing. I was mixing up the refcnt = 1 bit with chained mbuf support.

/Bruce

#26 lore raw
In reply to Ananyev, Konstantin
Quoted 31 lines
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, November 7, 2020 4:53 PM

The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines.

Perhaps with the #define DEV_TX_OFFLOAD_MBUF_FAST_FREE mentioned by Konstantin, it might be better moving m->next instead, at

least for applications with the opportunity to set this flag (e.g. applications with only one mbuf pool).

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Unfortunately, the information about the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag came to light after the techboard meeting, and I

don't have any benchmarks to support this suggestion, so I guess it's hard to change the techboard's decision to move the pool pointer.

Quoted 1 line

The thing with FAST_FREE is that it doesn't just indicate that there is only one mbuf pool, but rather that none of the packets are chained mbufs either.

Hmm, wonder where such assumption comes from?
There is nothing about forbidding chained mbufs in rte_ethdev.h right now:
#define DEV_TX_OFFLOAD_MBUF_FAST_FREE 0x00010000
/**< Device supports optimization for fast release of mbufs.
* When set application must guarantee that per-queue all mbufs comes from
* the same mempool and has refcnt = 1.
*/

Quoted 3 lines

Therefore, the flag applies equally to both next and pool pointers for optimization. [And the flag should perhaps be two flags!]

Quoted 5 lines

I think what Morten means here:
For FAST_FREE PMD can store pool pointer somewhere in its queue metadata and doesn't need to read it from the mbuf.
So if we move next to first line - mbuf_free code-path for FAST_FREE case can avoid touching second cache line in the mbuf.

Just as a different thought:
if we move 'next' to the first cache line, can we get rid of 'nb_segs' field completely?

#27 lore raw

v2 cover move mbuf pool pointer

In reply to Thomas Monjalon

After some discussions, it seems the best option is still to use the remaining space in the first half to move the pool pointer.

The fields move has an impact on octeontx2 in 32-bit build.

v2: disable octeontx2 drivers in 32-bit build.

Thomas Monjalon (2):
drivers: disable OCTEON TX2 in 32-bit build
mbuf: move pool pointer in first half

 doc/guides/rel_notes/deprecation.rst  |  7 -------
 drivers/common/octeontx2/meson.build  | 18 ++++++------------
 drivers/crypto/octeontx2/meson.build  | 17 +++--------------
 drivers/event/octeontx2/meson.build   | 18 ++++++------------
 drivers/mempool/octeontx2/meson.build | 18 ++++++------------
 drivers/net/octeontx2/meson.build     | 11 ++++++-----
 drivers/regex/octeontx2/meson.build   | 22 +++-------------------
 lib/librte_kni/rte_kni_common.h       |  3 ++-
 lib/librte_mbuf/rte_mbuf.h            |  1 -
 lib/librte_mbuf/rte_mbuf_core.h       |  5 ++---
 lib/librte_mbuf/rte_mbuf_dyn.c        |  1 -
 11 files changed, 34 insertions(+), 87 deletions(-)
Signature · 1 line
2.28.0
#28 lore raw

PATCH v2 1/2 drivers: disable OCTEON TX2 in 32-bit build

The drivers for OCTEON TX2 are not supported in 32-bit mode.

---
 drivers/common/octeontx2/meson.build  | 18 ++++++------------
 drivers/crypto/octeontx2/meson.build  | 17 +++--------------
 drivers/event/octeontx2/meson.build   | 18 ++++++------------
 drivers/mempool/octeontx2/meson.build | 18 ++++++------------
 drivers/net/octeontx2/meson.build     | 11 ++++++-----
 drivers/regex/octeontx2/meson.build   | 22 +++-------------------
 6 files changed, 30 insertions(+), 74 deletions(-)
drivers/common/octeontx2/meson.build +6 -12
index f2c04342e9..84fb11524d 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
 sources= files('otx2_dev.c',
 		'otx2_irq.c',
 		'otx2_mbox.c',
@@ -9,18 +15,6 @@ sources= files('otx2_dev.c',
 		'otx2_sec_idev.c',
 	       )
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-	if cc.has_argument(flag)
-		cflags += flag
-	endif
-endforeach
-
 deps = ['eal', 'pci', 'ethdev', 'kvargs']
 includes += include_directories('../../common/octeontx2',
 		'../../mempool/octeontx2', '../../bus/pci')
drivers/crypto/octeontx2/meson.build +3 -14
index 4e4522cace..0aad4e9a16 100644
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (C) 2019 Marvell International Ltd.
 
-if not is_linux
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
 	build = false
-	reason = 'only supported on Linux'
+	reason = 'only supported on 64-bit Linux'
+	subdir_done()
 endif
 
 deps += ['bus_pci']
@@ -21,18 +22,6 @@ sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_ops.c',
 		'otx2_cryptodev_sec.c')
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-	if cc.has_argument(flag)
-		cflags += flag
-	endif
-endforeach
-
 includes += include_directories('../../common/cpt')
 includes += include_directories('../../common/octeontx2')
 includes += include_directories('../../crypto/octeontx2')
drivers/event/octeontx2/meson.build +6 -12
index 724da2e6b7..22e7e4cb63 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
 sources = files('otx2_worker.c',
 		'otx2_worker_dual.c',
 		'otx2_evdev.c',
@@ -13,18 +19,6 @@ sources = files('otx2_worker.c',
 		'otx2_tim_worker.c'
 		)
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-	if cc.has_argument(flag)
-		cflags += flag
-	endif
-endforeach
-
 deps += ['bus_pci', 'common_octeontx2', 'crypto_octeontx2', 'mempool_octeontx2', 'net_octeontx2']
 
 includes += include_directories('../../crypto/octeontx2')
drivers/mempool/octeontx2/meson.build +6 -12
index 0226f76d4b..0586321abe 100644
@@ -5,6 +5,12 @@
 if is_windows
 	build = false
 	reason = 'not supported on Windows'
+	subdir_done()
+endif
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
 endif
 
 sources = files('otx2_mempool_ops.c',
@@ -13,16 +19,4 @@ sources = files('otx2_mempool_ops.c',
 		'otx2_mempool_debug.c'
 		)
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-	if cc.has_argument(flag)
-		cflags += flag
-	endif
-endforeach
-
 deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_octeontx2', 'mempool']
drivers/net/octeontx2/meson.build +6 -5
index 599ade6727..638c04a2fe 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
 sources = files('otx2_rx.c',
 		'otx2_tx.c',
 		'otx2_tm.c',
@@ -29,11 +35,6 @@ deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_octeontx2', 'mempool_octeontx2']
 
 extra_flags = ['-flax-vector-conversions']
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
 foreach flag: extra_flags
 	if cc.has_argument(flag)
 		cflags += flag
drivers/regex/octeontx2/meson.build +3 -19
index aada0b5601..34e51728c2 100644
@@ -2,9 +2,10 @@
 # Copyright(C) 2020 Marvell International Ltd.
 #
 
-if not is_linux
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
 	build = false
-	reason = 'only supported on Linux'
+	reason = 'only supported on 64-bit Linux'
+	subdir_done()
 endif
 
 lib = cc.find_library('librxp_compiler', required: false)
@@ -21,23 +22,6 @@ sources = files('otx2_regexdev.c',
 		'otx2_regexdev_compiler.c'
 		)
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-	extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
-if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
-	ext_deps += cc.find_library('atomic')
-endif
-
-foreach flag: extra_flags
-	if cc.has_argument(flag)
-		cflags += flag
-	endif
-endforeach
-
 fmt_name = 'octeontx2_regex'
 deps += ['bus_pci', 'common_octeontx2', 'regexdev']
 
Signature · 1 line
2.28.0
Acked-by on v2 1/2
#29 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] drivers: disable OCTEON TX2 in 32-bit build

Quoted 5 lines · Thomas Monjalon

The drivers for OCTEON TX2 are not supported in 32-bit mode.

Quoted 224 lines
---
 drivers/common/octeontx2/meson.build  | 18 ++++++------------
 drivers/crypto/octeontx2/meson.build  | 17 +++--------------
 drivers/event/octeontx2/meson.build   | 18 ++++++------------
 drivers/mempool/octeontx2/meson.build | 18 ++++++------------
 drivers/net/octeontx2/meson.build     | 11 ++++++-----
 drivers/regex/octeontx2/meson.build   | 22 +++-------------------
 6 files changed, 30 insertions(+), 74 deletions(-)
drivers/common/octeontx2/meson.build +6 -12
index f2c04342e9..84fb11524d 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+       build = false
+       reason = 'only supported on 64-bit'
+       subdir_done()
+endif
+
 sources= files('otx2_dev.c',
                'otx2_irq.c',
                'otx2_mbox.c',
@@ -9,18 +15,6 @@ sources= files('otx2_dev.c',
                'otx2_sec_idev.c',
               )
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-       if cc.has_argument(flag)
-               cflags += flag
-       endif
-endforeach
-
 deps = ['eal', 'pci', 'ethdev', 'kvargs']
 includes += include_directories('../../common/octeontx2',
                '../../mempool/octeontx2', '../../bus/pci')
drivers/crypto/octeontx2/meson.build +3 -14
index 4e4522cace..0aad4e9a16 100644
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (C) 2019 Marvell International Ltd.
 
-if not is_linux
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
        build = false
-       reason = 'only supported on Linux'
+       reason = 'only supported on 64-bit Linux'
+       subdir_done()
 endif
 
 deps += ['bus_pci']
@@ -21,18 +22,6 @@ sources = files('otx2_cryptodev.c',
                'otx2_cryptodev_ops.c',
                'otx2_cryptodev_sec.c')
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-       if cc.has_argument(flag)
-               cflags += flag
-       endif
-endforeach
-
 includes += include_directories('../../common/cpt')
 includes += include_directories('../../common/octeontx2')
 includes += include_directories('../../crypto/octeontx2')
drivers/event/octeontx2/meson.build +6 -12
index 724da2e6b7..22e7e4cb63 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+       build = false
+       reason = 'only supported on 64-bit'
+       subdir_done()
+endif
+
 sources = files('otx2_worker.c',
                'otx2_worker_dual.c',
                'otx2_evdev.c',
@@ -13,18 +19,6 @@ sources = files('otx2_worker.c',
                'otx2_tim_worker.c'
                )
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-       if cc.has_argument(flag)
-               cflags += flag
-       endif
-endforeach
-
 deps += ['bus_pci', 'common_octeontx2', 'crypto_octeontx2', 'mempool_octeontx2', 'net_octeontx2']
 
 includes += include_directories('../../crypto/octeontx2')
drivers/mempool/octeontx2/meson.build +6 -12
index 0226f76d4b..0586321abe 100644
@@ -5,6 +5,12 @@
 if is_windows
        build = false
        reason = 'not supported on Windows'
+       subdir_done()
+endif
+if not dpdk_conf.get('RTE_ARCH_64')
+       build = false
+       reason = 'only supported on 64-bit'
+       subdir_done()
 endif
 
 sources = files('otx2_mempool_ops.c',
@@ -13,16 +19,4 @@ sources = files('otx2_mempool_ops.c',
                'otx2_mempool_debug.c'
                )
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-foreach flag: extra_flags
-       if cc.has_argument(flag)
-               cflags += flag
-       endif
-endforeach
-
 deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_octeontx2', 'mempool']
drivers/net/octeontx2/meson.build +6 -5
index 599ade6727..638c04a2fe 100644
@@ -2,6 +2,12 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
+if not dpdk_conf.get('RTE_ARCH_64')
+       build = false
+       reason = 'only supported on 64-bit'
+       subdir_done()
+endif
+
 sources = files('otx2_rx.c',
                'otx2_tx.c',
                'otx2_tm.c',
@@ -29,11 +35,6 @@ deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_octeontx2', 'mempool_octeontx2']
 
 extra_flags = ['-flax-vector-conversions']
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
 foreach flag: extra_flags
        if cc.has_argument(flag)
                cflags += flag
drivers/regex/octeontx2/meson.build +3 -20
index aada0b5601..34e51728c2 100644
@@ -2,9 +2,10 @@
 # Copyright(C) 2020 Marvell International Ltd.
 #
 
-if not is_linux
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
        build = false
-       reason = 'only supported on Linux'
+       reason = 'only supported on 64-bit Linux'
+       subdir_done()
 endif
 
 lib = cc.find_library('librxp_compiler', required: false)
@@ -21,23 +22,6 @@ sources = files('otx2_regexdev.c',
                'otx2_regexdev_compiler.c'
                )
 
-extra_flags = []
-# This integrated controller runs only on a arm64 machine, remove 32bit warnings
-if not dpdk_conf.get('RTE_ARCH_64')
-       extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
-endif
-
-# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
-if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
-       ext_deps += cc.find_library('atomic')
-endif
-
-foreach flag: extra_flags
-       if cc.has_argument(flag)
-               cflags += flag
-       endif
-endforeach
-
 fmt_name = 'octeontx2_regex'
 deps += ['bus_pci', 'common_octeontx2', 'regexdev']
 
--

2.28.0

#30 lore raw

PATCH v2 2/2 mbuf: move pool pointer in first half

In reply to Thomas Monjalon

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Due to this change, tx_offload is moved. Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

---
 doc/guides/rel_notes/deprecation.rst | 7 -------
 lib/librte_kni/rte_kni_common.h      | 3 ++-
 lib/librte_mbuf/rte_mbuf.h           | 1 -
 lib/librte_mbuf/rte_mbuf_core.h      | 5 ++---
 lib/librte_mbuf/rte_mbuf_dyn.c       | 1 -
 5 files changed, 4 insertions(+), 13 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
index f3258eb3f7..efb09f0c5e 100644
@@ -81,13 +81,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* mbuf: Some fields will be converted to dynamic API in DPDK 20.11
-  in order to reserve more space for the dynamic fields, as explained in
-  `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
-  As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
-  avoiding impact on vectorized implementation of the driver datapaths,
-  while evaluating performance gains of a better use of the first cache line.
-
 * ethdev: The flow director API, including ``rte_eth_conf.fdir_conf`` field,
   and the related structures (``rte_fdir_*`` and ``rte_eth_fdir_*``),
   will be removed in DPDK 20.11.
lib/librte_kni/rte_kni_common.h +2 -1
index 36d66e2ffa..ffb3182731 100644
@@ -84,10 +84,11 @@ struct rte_kni_mbuf {
 	char pad2[4];
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 	uint16_t data_len;      /**< Amount of data in segment buffer. */
+	char pad3[14];
+	void *pool;
 
 	/* fields on second cache line */
 	__attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
-	void *pool;
 	void *next;             /**< Physical address of next mbuf in kernel. */
 };
 
lib/librte_mbuf/rte_mbuf.h +0 -1
index 3190a29cce..c4c9ebfaa0 100644
@@ -1107,7 +1107,6 @@ 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)
 {
-	memcpy(&mdst->dynfield0, msrc->dynfield0, sizeof(mdst->dynfield0));
 	memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
 }
 
lib/librte_mbuf/rte_mbuf_core.h +2 -3
index debaace95a..567551deab 100644
@@ -586,12 +586,11 @@ struct rte_mbuf {
 
 	uint16_t buf_len;         /**< Length of segment buffer. */
 
-	uint64_t dynfield0[1]; /**< Reserved for dynamic fields. */
+	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
 	RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 	struct rte_mbuf *next;    /**< Next segment of scattered packet. */
 
 	/* fields to support TX offloads */
@@ -645,7 +644,7 @@ struct rte_mbuf {
 	/** Timesync flags for use with IEEE1588. */
 	uint16_t timesync;
 
-	uint32_t dynfield1[7]; /**< Reserved for dynamic fields. */
+	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
 /**
lib/librte_mbuf/rte_mbuf_dyn.c +0 -1
index fd3e019a22..7d5e942bf0 100644
@@ -125,7 +125,6 @@ init_shared_mem(void)
 		 * rte_mbuf_dynfield_copy().
 		 */
 		memset(shm, 0, sizeof(*shm));
-		mark_free(dynfield0);
 		mark_free(dynfield1);
 
 		/* init free_flags */
Signature · 1 line
2.28.0
Acked-by on v2 2/2
#31 lore raw
Quoted 11 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, November 9, 2020 10:30 PM

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Quoted 1 line

Due to this change, tx_offload is moved.

A minor correction: All fields after m->pool are moved up 8 bytes, not only m->tx_offload.

Quoted 59 lines

Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8
*/
 1    rte_iova_t                        buf_iova          /*   8 +  8
*/
      /* --- RTE_MARKER64               rearm_data;

*/
2 uint16_t data_off; /* 16 + 2
*/
uint16_t refcnt; /* 18 + 2
*/
uint16_t nb_segs; /* 20 + 2
*/
uint16_t port; /* 22 + 2
*/
3 uint64_t ol_flags; /* 24 + 8
*/

      /* --- RTE_MARKER                 rx_descriptor_fields1;

*/
4 uint32_t union packet_type; /* 32 + 4
*/
uint32_t pkt_len; /* 36 + 4
*/
5 uint16_t data_len; /* 40 + 2
*/
uint16_t vlan_tci; /* 42 + 2
*/
5.5 uint64_t union hash; /* 44 + 8
*/
6.5 uint16_t vlan_tci_outer; /* 52 + 2
*/
uint16_t buf_len; /* 54 + 2
*/
7 struct rte_mempool * pool; /* 56 + 8
*/

      /* --- RTE_MARKER                 cacheline1;

*/
8 struct rte_mbuf * next; /* 64 + 8
*/
9 uint64_t union tx_offload; /* 72 + 8
*/
10 struct rte_mbuf_ext_shared_info * shinfo; /* 80 + 8
*/
11 uint16_t priv_size; /* 88 + 2
*/
uint16_t timesync; /* 90 + 2
*/
11.5 uint32_t dynfield1[9]; /* 92 + 36
*/
16 /* --- END 128
*/

Quoted 1 line

The minor detail doesn’t prevent...

#32 lore raw

10/11/2020 11:05, Morten Brørup:

Quoted 11 lines
Quoted 11 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, November 9, 2020 10:30 PM

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Quoted 3 lines
Quoted 1 line

Due to this change, tx_offload is moved.

A minor correction: All fields after m->pool are moved up 8 bytes, not only m->tx_offload.

Yes I will improve the message before merging, thanks.

Quoted 67 lines
Quoted 60 lines

Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8
*/
 1    rte_iova_t                        buf_iova          /*   8 +  8
*/
      /* --- RTE_MARKER64               rearm_data;

*/
2 uint16_t data_off; /* 16 + 2
*/
uint16_t refcnt; /* 18 + 2
*/
uint16_t nb_segs; /* 20 + 2
*/
uint16_t port; /* 22 + 2
*/
3 uint64_t ol_flags; /* 24 + 8
*/

      /* --- RTE_MARKER                 rx_descriptor_fields1;

*/
4 uint32_t union packet_type; /* 32 + 4
*/
uint32_t pkt_len; /* 36 + 4
*/
5 uint16_t data_len; /* 40 + 2
*/
uint16_t vlan_tci; /* 42 + 2
*/
5.5 uint64_t union hash; /* 44 + 8
*/
6.5 uint16_t vlan_tci_outer; /* 52 + 2
*/
uint16_t buf_len; /* 54 + 2
*/
7 struct rte_mempool * pool; /* 56 + 8
*/

      /* --- RTE_MARKER                 cacheline1;

*/
8 struct rte_mbuf * next; /* 64 + 8
*/
9 uint64_t union tx_offload; /* 72 + 8
*/
10 struct rte_mbuf_ext_shared_info * shinfo; /* 80 + 8
*/
11 uint16_t priv_size; /* 88 + 2
*/
uint16_t timesync; /* 90 + 2
*/
11.5 uint32_t dynfield1[9]; /* 92 + 36
*/
16 /* --- END 128
*/

Quoted 1 line

The minor detail doesn’t prevent...

Acked-by on v2 2/2
#33 lore raw
In reply to Thomas Monjalon
Quoted 40 lines · Thomas Monjalon

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Due to this change, tx_offload is moved. Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */
Quoted 3 lines

16 /* --- END 128 */

Acked-by
#34 lore raw
Quoted 44 lines · Olivier Matz
Quoted 42 lines · Thomas Monjalon

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Due to this change, tx_offload is moved. Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

Quoted 3 lines
Quoted 1 line
#35 lore raw
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Due to this change, tx_offload is moved. Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Series applied

#36 lore raw
In reply to Olivier Matz
Quoted 43 lines · On Tue, 10 Nov 2020 17:25:09 +0100 Olivier Matz <[email protected]> wrote:
Quoted 42 lines · Thomas Monjalon

According to the Technical Board decision
(http://mails.dpdk.org/archives/dev/2020-November/191859.html),
the mempool pointer in the mbuf struct is moved
from the second to the first half.
It may increase performance in some cases
on systems having 64-byte cache line, i.e. mbuf split in two cache lines.

Due to this change, tx_offload is moved. Hopefully no vector data path is impacted.

Moving this field gives more space to dynfield1 while dropping the temporary dynfield0.

This is how the mbuf layout looks like (pahole-style):

word  type                              name                byte  size
 0    void *                            buf_addr;         /*   0 +  8 */
 1    rte_iova_t                        buf_iova          /*   8 +  8 */
      /* --- RTE_MARKER64               rearm_data;                   */
 2    uint16_t                          data_off;         /*  16 +  2 */
      uint16_t                          refcnt;           /*  18 +  2 */
      uint16_t                          nb_segs;          /*  20 +  2 */
      uint16_t                          port;             /*  22 +  2 */
 3    uint64_t                          ol_flags;         /*  24 +  8 */
      /* --- RTE_MARKER                 rx_descriptor_fields1;        */
 4    uint32_t             union        packet_type;      /*  32 +  4 */
      uint32_t                          pkt_len;          /*  36 +  4 */
 5    uint16_t                          data_len;         /*  40 +  2 */
      uint16_t                          vlan_tci;         /*  42 +  2 */
 5.5  uint64_t             union        hash;             /*  44 +  8 */
 6.5  uint16_t                          vlan_tci_outer;   /*  52 +  2 */
      uint16_t                          buf_len;          /*  54 +  2 */
 7    struct rte_mempool *              pool;             /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mbuf *                 next;             /*  64 +  8 */
 9    uint64_t             union        tx_offload;       /*  72 +  8 */
10    struct rte_mbuf_ext_shared_info * shinfo;           /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
11.5  uint32_t                          dynfield1[9];     /*  92 + 36 */

16 /* --- END 128 */

Quoted 3 lines
Quoted 1 line

Thanks this looks good.