#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>
* @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.
*/
* 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
* @return
* The pointer of the mbuf buffer.
*/
-__rte_experimental
static inline char *
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
}
/**
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
}
/**
* @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)
{
* - -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);
* 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
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
* 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
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);
m->data_len = 0;
m->data_off = 0;
- m->ol_flags |= EXT_ATTACHED_MBUF;
+ m->ol_flags |= RTE_MBUF_F_EXTERNAL;
m->shinfo = shinfo;
}
/* 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);
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 */
return NULL;
}
- if (m->next != NULL) {
+ if (m->next != NULL)
m->next = NULL;
+ if (m->nb_segs != 1)
m->nb_segs = 1;
- }
return 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;
* @param count
* Array size.
*/
-__rte_experimental
void rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int count);
/**
* 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
* - 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);
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.
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;