mbuf: remove userdata field
authorThomas Monjalon <thomas@monjalon.net>
Sun, 25 Oct 2020 20:42:27 +0000 (21:42 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 31 Oct 2020 15:13:11 +0000 (16:13 +0100)
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.

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    uint64_t                          timestamp;        /*  56 +  8 */
      /* --- RTE_MARKER                 cacheline1;                   */
 8    struct rte_mempool *              pool;             /*  64 +  8 */
 9    struct rte_mbuf *                 next;             /*  72 +  8 */
10    uint64_t             union        tx_offload;       /*  80 +  8 */
11    uint16_t                          priv_size;        /*  88 +  2 */
      uint16_t                          timesync;         /*  90 +  2 */
      uint32_t                          seqn;             /*  92 +  4 */
12    struct rte_mbuf_ext_shared_info * shinfo;           /*  96 +  8 */
13    uint64_t                          dynfield1[3];     /* 104 + 24 */
16    /* --- END                                             128      */

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
doc/guides/rel_notes/deprecation.rst
doc/guides/rel_notes/release_20_11.rst
lib/librte_kni/rte_kni_common.h
lib/librte_mbuf/rte_mbuf_core.h

index 2e08249..0f6f1df 100644 (file)
@@ -87,7 +87,6 @@ Deprecation Notices
   The following static fields will be moved as dynamic:
 
   - ``timestamp``
-  - ``userdata`` / ``udata64``
   - ``seqn``
 
   As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
index bae39b2..70cefb6 100644 (file)
@@ -442,6 +442,9 @@ API Changes
   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
   The field ``refcnt`` is remaining from the old unions.
 
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+  from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
index 21b477f..36d66e2 100644 (file)
@@ -86,7 +86,7 @@ struct rte_kni_mbuf {
        uint16_t data_len;      /**< Amount of data in segment buffer. */
 
        /* fields on second cache line */
-       char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
+       __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
        void *pool;
        void *next;             /**< Physical address of next mbuf in kernel. */
 };
index 065d87d..a65eaaf 100644 (file)
@@ -599,12 +599,6 @@ struct rte_mbuf {
        /* second cache line - fields only used in slow path or on TX */
        RTE_MARKER cacheline1 __rte_cache_min_aligned;
 
-       RTE_STD_C11
-       union {
-               void *userdata;   /**< Can be used for external metadata */
-               uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
-       };
-
        struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
        struct rte_mbuf *next;    /**< Next segment of scattered packet. */
 
@@ -662,7 +656,7 @@ struct rte_mbuf {
         */
        struct rte_mbuf_ext_shared_info *shinfo;
 
-       uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+       uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
 /**