lib: remove unneeded header includes
[dpdk.git] / lib / mbuf / rte_mbuf.h
index c4c9ebf..9811e8c 100644 (file)
 #include <rte_common.h>
 #include <rte_config.h>
 #include <rte_mempool.h>
-#include <rte_memory.h>
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
-#include <rte_byteorder.h>
 #include <rte_mbuf_ptype.h>
 #include <rte_mbuf_core.h>
 
@@ -77,7 +75,7 @@ int rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen);
  * @param mask
  *   The mask describing the flag. Usually only one bit must be set.
  *   Several bits can be given if they belong to the same mask.
- *   Ex: PKT_TX_L4_MASK.
+ *   Ex: RTE_MBUF_F_TX_L4_MASK.
  * @return
  *   The name of this flag, or NULL if it's not a valid TX flag.
  */
@@ -191,11 +189,6 @@ rte_mbuf_from_indirect(struct rte_mbuf *mi)
  * mbuf is already known because it doesn't need to access mbuf contents in
  * order to get the mempool pointer.
  *
- * @warning
- * @b EXPERIMENTAL: This API may change without prior notice.
- * This will be used by rte_mbuf_to_baddr() which has redundant code once
- * experimental tag is removed.
- *
  * @param mb
  *   The pointer to the mbuf.
  * @param mp
@@ -203,7 +196,6 @@ rte_mbuf_from_indirect(struct rte_mbuf *mi)
  * @return
  *   The pointer of the mbuf buffer.
  */
-__rte_experimental
 static inline char *
 rte_mbuf_buf_addr(struct rte_mbuf *mb, struct rte_mempool *mp)
 {
@@ -213,26 +205,15 @@ rte_mbuf_buf_addr(struct rte_mbuf *mb, struct rte_mempool *mp)
 /**
  * Return the default address of the beginning of the mbuf data.
  *
- * @warning
- * @b EXPERIMENTAL: This API may change without prior notice.
- *
  * @param mb
  *   The pointer to the mbuf.
  * @return
  *   The pointer of the beginning of the mbuf data.
  */
-__rte_experimental
 static inline char *
-rte_mbuf_data_addr_default(__rte_unused struct rte_mbuf *mb)
+rte_mbuf_data_addr_default(struct rte_mbuf *mb)
 {
-       /* gcc complains about calling this experimental function even
-        * when not using it. Hide it with ALLOW_EXPERIMENTAL_API.
-        */
-#ifdef ALLOW_EXPERIMENTAL_API
        return rte_mbuf_buf_addr(mb, mb->pool) + RTE_PKTMBUF_HEADROOM;
-#else
-       return NULL;
-#endif
 }
 
 /**
@@ -251,13 +232,7 @@ rte_mbuf_data_addr_default(__rte_unused struct rte_mbuf *mb)
 static inline char *
 rte_mbuf_to_baddr(struct rte_mbuf *md)
 {
-#ifdef ALLOW_EXPERIMENTAL_API
        return rte_mbuf_buf_addr(md, md->pool);
-#else
-       char *buffer_addr;
-       buffer_addr = (char *)md + sizeof(*md) + rte_pktmbuf_priv_size(md->pool);
-       return buffer_addr;
-#endif
 }
 
 /**
@@ -272,7 +247,6 @@ rte_mbuf_to_baddr(struct rte_mbuf *md)
  * @return
  *   The starting address of the private data area of the given mbuf.
  */
-__rte_experimental
 static inline void *
 rte_mbuf_to_priv(struct rte_mbuf *m)
 {
@@ -536,7 +510,6 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);
  *   - -1 if a problem is detected, reason then points to a string describing
  *     the reason why the mbuf is deemed invalid.
  */
-__rte_experimental
 int rte_mbuf_check(const struct rte_mbuf *m, int is_header,
                   const char **reason);
 
@@ -624,6 +597,9 @@ rte_mbuf_raw_free(struct rte_mbuf *m)
  * address, and so on). This function is given as a callback function to
  * rte_mempool_obj_iter() or rte_mempool_create() at pool creation time.
  *
+ * This function expects that the mempool private area was previously
+ * initialized with rte_pktmbuf_pool_init().
+ *
  * @param mp
  *   The mempool from which mbufs originate.
  * @param opaque_arg
@@ -639,7 +615,7 @@ void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg,
                      void *m, unsigned i);
 
 /**
- * A  packet mbuf pool constructor.
+ * A packet mbuf pool constructor.
  *
  * This function initializes the mempool private data in the case of a
  * pktmbuf pool. This private data is needed by the driver. The
@@ -648,6 +624,9 @@ void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg,
  * pool creation. It can be extended by the user, for example, to
  * provide another packet size.
  *
+ * The mempool private area size must be at least equal to
+ * sizeof(struct rte_pktmbuf_pool_private).
+ *
  * @param mp
  *   The mempool from which mbufs originate.
  * @param opaque_arg
@@ -868,7 +847,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
        m->nb_segs = 1;
        m->port = RTE_MBUF_PORT_INVALID;
 
-       m->ol_flags &= EXT_ATTACHED_MBUF;
+       m->ol_flags &= RTE_MBUF_F_EXTERNAL;
        m->packet_type = 0;
        rte_pktmbuf_reset_headroom(m);
 
@@ -1083,7 +1062,7 @@ rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr,
        m->data_len = 0;
        m->data_off = 0;
 
-       m->ol_flags |= EXT_ATTACHED_MBUF;
+       m->ol_flags |= RTE_MBUF_F_EXTERNAL;
        m->shinfo = shinfo;
 }
 
@@ -1157,7 +1136,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
                /* if m is not direct, get the mbuf that embeds the data */
                rte_mbuf_refcnt_update(rte_mbuf_from_indirect(m), 1);
                mi->priv_size = m->priv_size;
-               mi->ol_flags = m->ol_flags | IND_ATTACHED_MBUF;
+               mi->ol_flags = m->ol_flags | RTE_MBUF_F_INDIRECT;
        }
 
        __rte_pktmbuf_copy_hdr(mi, m);
@@ -1291,7 +1270,7 @@ static inline int __rte_pktmbuf_pinned_extbuf_decref(struct rte_mbuf *m)
        struct rte_mbuf_ext_shared_info *shinfo;
 
        /* Clear flags, mbuf is being freed. */
-       m->ol_flags = EXT_ATTACHED_MBUF;
+       m->ol_flags = RTE_MBUF_F_EXTERNAL;
        shinfo = m->shinfo;
 
        /* Optimize for performance - do not dec/reinit */
@@ -1340,10 +1319,10 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
                                return NULL;
                }
 
-               if (m->next != NULL) {
+               if (m->next != NULL)
                        m->next = NULL;
+               if (m->nb_segs != 1)
                        m->nb_segs = 1;
-               }
 
                return m;
 
@@ -1357,10 +1336,10 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
                                return NULL;
                }
 
-               if (m->next != NULL) {
+               if (m->next != NULL)
                        m->next = NULL;
+               if (m->nb_segs != 1)
                        m->nb_segs = 1;
-               }
                rte_mbuf_refcnt_set(m, 1);
 
                return m;
@@ -1420,7 +1399,6 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
  *  @param count
  *    Array size.
  */
-__rte_experimental
 void rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int count);
 
 /**
@@ -1450,7 +1428,7 @@ rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool *mp);
  * set of mbufs. The private data are is not copied.
  *
  * @param m
- *   The packet mbuf to be copiedd.
+ *   The packet mbuf to be copied.
  * @param mp
  *   The mempool from which the "clone" mbufs are allocated.
  * @param offset
@@ -1464,7 +1442,6 @@ rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool *mp);
  *   - The pointer to the new "clone" mbuf on success.
  *   - NULL if allocation fails.
  */
-__rte_experimental
 struct rte_mbuf *
 rte_pktmbuf_copy(const struct rte_mbuf *m, struct rte_mempool *mp,
                 uint32_t offset, uint32_t length);
@@ -1769,10 +1746,7 @@ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail
        return 0;
 }
 
-/*
- * @warning
- * @b EXPERIMENTAL: This API may change without prior notice.
- *
+/**
  * For given input values generate raw tx_offload value.
  * Note that it is caller responsibility to make sure that input parameters
  * don't exceed maximum bit-field values.
@@ -1822,28 +1796,28 @@ rte_validate_tx_offload(const struct rte_mbuf *m)
        uint64_t ol_flags = m->ol_flags;
 
        /* Does packet set any of available offloads? */
-       if (!(ol_flags & PKT_TX_OFFLOAD_MASK))
+       if (!(ol_flags & RTE_MBUF_F_TX_OFFLOAD_MASK))
                return 0;
 
        /* IP checksum can be counted only for IPv4 packet */
-       if ((ol_flags & PKT_TX_IP_CKSUM) && (ol_flags & PKT_TX_IPV6))
+       if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) && (ol_flags & RTE_MBUF_F_TX_IPV6))
                return -EINVAL;
 
        /* IP type not set when required */
-       if (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
-               if (!(ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)))
+       if (ol_flags & (RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG))
+               if (!(ol_flags & (RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IPV6)))
                        return -EINVAL;
 
        /* Check requirements for TSO packet */
-       if (ol_flags & PKT_TX_TCP_SEG)
+       if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
                if ((m->tso_segsz == 0) ||
-                               ((ol_flags & PKT_TX_IPV4) &&
-                               !(ol_flags & PKT_TX_IP_CKSUM)))
+                               ((ol_flags & RTE_MBUF_F_TX_IPV4) &&
+                                !(ol_flags & RTE_MBUF_F_TX_IP_CKSUM)))
                        return -EINVAL;
 
-       /* PKT_TX_OUTER_IP_CKSUM set for non outer IPv4 packet. */
-       if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
-                       !(ol_flags & PKT_TX_OUTER_IPV4))
+       /* RTE_MBUF_F_TX_OUTER_IP_CKSUM set for non outer IPv4 packet. */
+       if ((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) &&
+                       !(ol_flags & RTE_MBUF_F_TX_OUTER_IPV4))
                return -EINVAL;
 
        return 0;