mbuf: introduce routine to get private mbuf pool flags
[dpdk.git] / lib / librte_mbuf / rte_mbuf.h
index 92d8197..9b0691d 100644 (file)
@@ -303,8 +303,26 @@ rte_mbuf_to_priv(struct rte_mbuf *m)
 struct rte_pktmbuf_pool_private {
        uint16_t mbuf_data_room_size; /**< Size of data space in each mbuf. */
        uint16_t mbuf_priv_size;      /**< Size of private area in each mbuf. */
+       uint32_t flags; /**< reserved for future use. */
 };
 
+/**
+ * Return the flags from private data in an mempool structure.
+ *
+ * @param mp
+ *   A pointer to the mempool structure.
+ * @return
+ *   The flags from the private data structure.
+ */
+static inline uint32_t
+rte_pktmbuf_priv_flags(struct rte_mempool *mp)
+{
+       struct rte_pktmbuf_pool_private *mbp_priv;
+
+       mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(mp);
+       return mbp_priv->flags;
+}
+
 #ifdef RTE_LIBRTE_MBUF_DEBUG
 
 /**  check mbuf type in debug mode */
@@ -923,10 +941,14 @@ rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
  * provided via shinfo. This callback function will be called once all the
  * mbufs are detached from the buffer (refcnt becomes zero).
  *
- * The headroom for the attaching mbuf will be set to zero and this can be
- * properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
+ * The headroom length of the attaching mbuf will be set to zero and this
+ * can be properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
  * or ``rte_pktmbuf_reset_headroom()`` might be used.
  *
+ * Similarly, the packet length is initialized to 0. If the buffer contains
+ * data, the user has to adjust ``data_len`` and the ``pkt_len`` field of
+ * the mbuf accordingly.
+ *
  * More mbufs can be attached to the same external buffer by
  * ``rte_pktmbuf_attach()`` once the external buffer has been attached by
  * this API.