mbuf: clean up comments and prefix
The mbuf header files had some commenting style errors that affected the API documentation. Also, the RTE_ prefix was missing on a macro and a definition. Note: This patch does not touch the offload and attachment flags that are also missing the RTE_ prefix. Signed-off-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
c2341bb671
commit
3a35c1c0f6
@ -168,7 +168,7 @@ sfc_ef100_rx_qrefill(struct sfc_ef100_rxq *rxq)
|
||||
struct sfc_ef100_rx_sw_desc *rxd;
|
||||
rte_iova_t phys_addr;
|
||||
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
|
||||
SFC_ASSERT((id & ~ptr_mask) == 0);
|
||||
rxd = &rxq->sw_ring[id];
|
||||
@ -481,7 +481,7 @@ sfc_ef100_rx_process_ready_pkts(struct sfc_ef100_rxq *rxq,
|
||||
rxq->ready_pkts--;
|
||||
|
||||
pkt = sfc_ef100_rx_next_mbuf(rxq);
|
||||
MBUF_RAW_ALLOC_CHECK(pkt);
|
||||
__rte_mbuf_raw_sanity_check(pkt);
|
||||
|
||||
RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
|
||||
sizeof(rxq->rearm_data));
|
||||
@ -505,7 +505,7 @@ sfc_ef100_rx_process_ready_pkts(struct sfc_ef100_rxq *rxq,
|
||||
struct rte_mbuf *seg;
|
||||
|
||||
seg = sfc_ef100_rx_next_mbuf(rxq);
|
||||
MBUF_RAW_ALLOC_CHECK(seg);
|
||||
__rte_mbuf_raw_sanity_check(seg);
|
||||
|
||||
seg->data_off = RTE_PKTMBUF_HEADROOM;
|
||||
|
||||
|
@ -125,7 +125,7 @@ sfc_ef10_essb_next_mbuf(const struct sfc_ef10_essb_rxq *rxq,
|
||||
struct rte_mbuf *m;
|
||||
|
||||
m = (struct rte_mbuf *)((uintptr_t)mbuf + rxq->buf_stride);
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ sfc_ef10_essb_mbuf_by_index(const struct sfc_ef10_essb_rxq *rxq,
|
||||
struct rte_mbuf *m;
|
||||
|
||||
m = (struct rte_mbuf *)((uintptr_t)mbuf + idx * rxq->buf_stride);
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq)
|
||||
struct sfc_ef10_rx_sw_desc *rxd;
|
||||
rte_iova_t phys_addr;
|
||||
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
|
||||
SFC_ASSERT((id & ~ptr_mask) == 0);
|
||||
rxd = &rxq->sw_ring[id];
|
||||
@ -297,7 +297,7 @@ sfc_ef10_rx_process_event(struct sfc_ef10_rxq *rxq, efx_qword_t rx_ev,
|
||||
rxd = &rxq->sw_ring[pending++ & ptr_mask];
|
||||
m = rxd->mbuf;
|
||||
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
|
||||
m->data_off = RTE_PKTMBUF_HEADROOM;
|
||||
rte_pktmbuf_data_len(m) = seg_len;
|
||||
|
@ -109,7 +109,7 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq)
|
||||
++i, id = (id + 1) & rxq->ptr_mask) {
|
||||
m = objs[i];
|
||||
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
|
||||
rxd = &rxq->sw_desc[id];
|
||||
rxd->mbuf = m;
|
||||
|
@ -104,7 +104,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
|
||||
/* init some constant fields */
|
||||
m->pool = mp;
|
||||
m->nb_segs = 1;
|
||||
m->port = MBUF_INVALID_PORT;
|
||||
m->port = RTE_MBUF_PORT_INVALID;
|
||||
rte_mbuf_refcnt_set(m, 1);
|
||||
m->next = NULL;
|
||||
}
|
||||
@ -207,7 +207,7 @@ __rte_pktmbuf_init_extmem(struct rte_mempool *mp,
|
||||
/* init some constant fields */
|
||||
m->pool = mp;
|
||||
m->nb_segs = 1;
|
||||
m->port = MBUF_INVALID_PORT;
|
||||
m->port = RTE_MBUF_PORT_INVALID;
|
||||
m->ol_flags = EXT_ATTACHED_MBUF;
|
||||
rte_mbuf_refcnt_set(m, 1);
|
||||
m->next = NULL;
|
||||
|
@ -540,12 +540,29 @@ __rte_experimental
|
||||
int rte_mbuf_check(const struct rte_mbuf *m, int is_header,
|
||||
const char **reason);
|
||||
|
||||
#define MBUF_RAW_ALLOC_CHECK(m) do { \
|
||||
RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1); \
|
||||
RTE_ASSERT((m)->next == NULL); \
|
||||
RTE_ASSERT((m)->nb_segs == 1); \
|
||||
__rte_mbuf_sanity_check(m, 0); \
|
||||
} while (0)
|
||||
/**
|
||||
* Sanity checks on a reinitialized mbuf in debug mode.
|
||||
*
|
||||
* Check the consistency of the given reinitialized mbuf.
|
||||
* The function will cause a panic if corruption is detected.
|
||||
*
|
||||
* Check that the mbuf is properly reinitialized (refcnt=1, next=NULL,
|
||||
* nb_segs=1), as done by rte_pktmbuf_prefree_seg().
|
||||
*
|
||||
* @param m
|
||||
* The mbuf to be checked.
|
||||
*/
|
||||
static __rte_always_inline void
|
||||
__rte_mbuf_raw_sanity_check(__rte_unused const struct rte_mbuf *m)
|
||||
{
|
||||
RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1);
|
||||
RTE_ASSERT(m->next == NULL);
|
||||
RTE_ASSERT(m->nb_segs == 1);
|
||||
__rte_mbuf_sanity_check(m, 0);
|
||||
}
|
||||
|
||||
/** For backwards compatibility. */
|
||||
#define MBUF_RAW_ALLOC_CHECK(m) __rte_mbuf_raw_sanity_check(m)
|
||||
|
||||
/**
|
||||
* Allocate an uninitialized mbuf from mempool *mp*.
|
||||
@ -572,7 +589,7 @@ static inline struct rte_mbuf *rte_mbuf_raw_alloc(struct rte_mempool *mp)
|
||||
|
||||
if (rte_mempool_get(mp, (void **)&m) < 0)
|
||||
return NULL;
|
||||
MBUF_RAW_ALLOC_CHECK(m);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -595,10 +612,7 @@ rte_mbuf_raw_free(struct rte_mbuf *m)
|
||||
{
|
||||
RTE_ASSERT(!RTE_MBUF_CLONED(m) &&
|
||||
(!RTE_MBUF_HAS_EXTBUF(m) || RTE_MBUF_HAS_PINNED_EXTBUF(m)));
|
||||
RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1);
|
||||
RTE_ASSERT(m->next == NULL);
|
||||
RTE_ASSERT(m->nb_segs == 1);
|
||||
__rte_mbuf_sanity_check(m, 0);
|
||||
__rte_mbuf_raw_sanity_check(m);
|
||||
rte_mempool_put(m->pool, m);
|
||||
}
|
||||
|
||||
@ -844,8 +858,6 @@ static inline void rte_pktmbuf_reset_headroom(struct rte_mbuf *m)
|
||||
* @param m
|
||||
* The packet mbuf to be reset.
|
||||
*/
|
||||
#define MBUF_INVALID_PORT UINT16_MAX
|
||||
|
||||
static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
|
||||
{
|
||||
m->next = NULL;
|
||||
@ -854,7 +866,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
|
||||
m->vlan_tci = 0;
|
||||
m->vlan_tci_outer = 0;
|
||||
m->nb_segs = 1;
|
||||
m->port = MBUF_INVALID_PORT;
|
||||
m->port = RTE_MBUF_PORT_INVALID;
|
||||
|
||||
m->ol_flags &= EXT_ATTACHED_MBUF;
|
||||
m->packet_type = 0;
|
||||
@ -917,22 +929,22 @@ static inline int rte_pktmbuf_alloc_bulk(struct rte_mempool *pool,
|
||||
switch (count % 4) {
|
||||
case 0:
|
||||
while (idx != count) {
|
||||
MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
|
||||
__rte_mbuf_raw_sanity_check(mbufs[idx]);
|
||||
rte_pktmbuf_reset(mbufs[idx]);
|
||||
idx++;
|
||||
/* fall-through */
|
||||
case 3:
|
||||
MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
|
||||
__rte_mbuf_raw_sanity_check(mbufs[idx]);
|
||||
rte_pktmbuf_reset(mbufs[idx]);
|
||||
idx++;
|
||||
/* fall-through */
|
||||
case 2:
|
||||
MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
|
||||
__rte_mbuf_raw_sanity_check(mbufs[idx]);
|
||||
rte_pktmbuf_reset(mbufs[idx]);
|
||||
idx++;
|
||||
/* fall-through */
|
||||
case 1:
|
||||
MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
|
||||
__rte_mbuf_raw_sanity_check(mbufs[idx]);
|
||||
rte_pktmbuf_reset(mbufs[idx]);
|
||||
idx++;
|
||||
/* fall-through */
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
@ -662,7 +662,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 +690,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.
|
||||
|
Loading…
Reference in New Issue
Block a user