mbuf: move l2_len and l3_len to second cache line
[dpdk.git] / lib / librte_mbuf / rte_mbuf.h
index 2f1bd4a..1c6e115 100644 (file)
@@ -115,14 +115,22 @@ extern "C" {
  */
 #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
 
+/* define a set of marker types that can be used to refer to set points in the
+ * mbuf */
+typedef void    *MARKER[0];   /**< generic marker for a point in a structure */
+typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
+                               * with a single assignment */
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
+       MARKER cacheline0;
+
        void *buf_addr;           /**< Virtual address of segment buffer. */
        phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
 
        /* next 8 bytes are initialised on RX descriptor rearm */
+       MARKER64 rearm_data;
        uint16_t buf_len;         /**< Length of segment buffer. */
        uint16_t data_off;
 
@@ -147,16 +155,11 @@ struct rte_mbuf {
        uint64_t ol_flags;        /**< Offload features. */
 
        /* remaining bytes are set on RX when pulling packet from descriptor */
+       MARKER rx_descriptor_fields1;
        uint16_t reserved2;       /**< Unused field. Required for padding */
        uint16_t data_len;        /**< Amount of data in segment buffer. */
        uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-       union {
-               uint16_t l2_l3_len; /**< combined l2/l3 lengths as single var */
-               struct {
-                       uint16_t l3_len:9;      /**< L3 (IP) Header Length. */
-                       uint16_t l2_len:7;      /**< L2 (MAC) Header Length. */
-               };
-       };
+       uint16_t reserved;
        uint16_t vlan_tci;        /**< VLAN Tag Control Identifier (CPU order) */
        union {
                uint32_t rss;     /**< RSS hash result if RSS enabled */
@@ -167,10 +170,19 @@ struct rte_mbuf {
                uint32_t sched;   /**< Hierarchical scheduler */
        } hash;                   /**< hash information */
 
-       /* fields only used in slow path or on TX */
+       /* second cache line - fields only used in slow path or on TX */
+       MARKER cacheline1 __rte_cache_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 */
+       union {
+               uint16_t l2_l3_len; /**< combined l2/l3 lengths as single var */
+               struct {
+                       uint16_t l3_len:9;      /**< L3 (IP) Header Length. */
+                       uint16_t l2_len:7;      /**< L2 (MAC) Header Length. */
+               };
+       };
 } __rte_cache_aligned;
 
 /**