mbuf: fix reset on mbuf free
[dpdk.git] / lib / librte_mbuf / rte_mbuf_core.h
index 38e24a5..78a1fcc 100644 (file)
@@ -276,7 +276,7 @@ extern "C" {
  * mbuf 'vlan_tci' & 'vlan_tci_outer' must be valid when this flag is set.
  */
 #define PKT_TX_QINQ        (1ULL << 49)
-/* this old name is deprecated */
+/** This old name is deprecated. */
 #define PKT_TX_QINQ_PKT    PKT_TX_QINQ
 
 /**
@@ -495,7 +495,12 @@ struct rte_mbuf {
         * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
         */
        uint16_t refcnt;
-       uint16_t nb_segs;         /**< Number of segments. */
+
+       /**
+        * Number of segments. Only valid for the first segment of an mbuf
+        * chain.
+        */
+       uint16_t nb_segs;
 
        /** Input port (16 bits to support more than 256 virtual ports).
         * The event eth Tx adapter uses this field to specify the output port.
@@ -586,13 +591,16 @@ 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. */
+       /**
+        * Next segment of scattered packet. Must be NULL in the last segment or
+        * in case of non-segmented packet.
+        */
+       struct rte_mbuf *next;
 
        /* fields to support TX offloads */
        RTE_STD_C11
@@ -645,7 +653,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;
 
 /**
@@ -662,7 +670,7 @@ struct rte_mbuf_ext_shared_info {
        uint16_t refcnt;
 };
 
-/**< Maximum number of nb_segs allowed. */
+/** Maximum number of nb_segs allowed. */
 #define RTE_MBUF_MAX_NB_SEGS   UINT16_MAX
 
 /**
@@ -690,7 +698,10 @@ struct rte_mbuf_ext_shared_info {
 #define RTE_MBUF_DIRECT(mb) \
        (!((mb)->ol_flags & (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF)))
 
-#define MBUF_INVALID_PORT UINT16_MAX
+/** Uninitialized or unspecified port. */
+#define RTE_MBUF_PORT_INVALID UINT16_MAX
+/** For backwards compatibility. */
+#define MBUF_INVALID_PORT RTE_MBUF_PORT_INVALID
 
 /**
  * A macro that points to an offset into the data in the mbuf.