Skip to content

Commit 6d53169

Browse files
MortenBroeruptmonjalo
authored andcommitted
mbuf: improve comments
Updated the comment preceding the 'rearm_data' fields to reflect that some ethdev drivers don't really set the rearm_data fields on Rx descriptor rearm, but rather when pulling the packet from the descriptor. By doing this, they avoid a store operation into the mbuf when they rearm the Rx descriptor, and instead postpone it to later, where it will be combined with other store operations into the mbuf. Updated the comment describing what the second cache line is used for, to reflect that there are exceptions, where some fields are set on Rx too. Updated comments describing what needs to be updated when adding new Rx and Tx offload flags. Signed-off-by: Morten Brørup <[email protected]>
1 parent 32d7d57 commit 6d53169

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

lib/mbuf/rte_mbuf_core.h

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ extern "C" {
3737
* added to the right of the previously defined flags i.e. they should count
3838
* downwards, not upwards.
3939
*
40-
* Keep these flags synchronized with rte_get_rx_ol_flag_name() and
41-
* rte_get_tx_ol_flag_name().
40+
* Keep these flags synchronized with rte_get_rx_ol_flag_name(), rte_get_rx_ol_flag_list(),
41+
* rte_get_tx_ol_flag_name(), and rte_get_tx_ol_flag_list().
4242
*/
4343

4444
/**
@@ -180,12 +180,20 @@ extern "C" {
180180
#define RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD (1ULL << 22)
181181
#define RTE_MBUF_F_RX_OUTER_L4_CKSUM_INVALID ((1ULL << 21) | (1ULL << 22))
182182

183-
/* add new RX flags here, don't forget to update RTE_MBUF_F_FIRST_FREE */
183+
/*
184+
* Add new Rx flags here.
185+
* Don't forget to update RTE_MBUF_F_FIRST_FREE,
186+
* rte_get_rx_ol_flag_name(), and rte_get_rx_ol_flag_list().
187+
*/
184188

185189
#define RTE_MBUF_F_FIRST_FREE (1ULL << 23)
186190
#define RTE_MBUF_F_LAST_FREE (1ULL << 40)
187191

188-
/* add new TX flags here, don't forget to update RTE_MBUF_F_LAST_FREE */
192+
/*
193+
* Add new Tx flags here.
194+
* Don't forget to update RTE_MBUF_F_LAST_FREE, RTE_MBUF_F_TX_OFFLOAD_MASK,
195+
* rte_get_tx_ol_flag_name(), and rte_get_tx_ol_flag_list().
196+
*/
189197

190198
/**
191199
* Outer UDP checksum offload flag. This flag is used for enabling
@@ -485,7 +493,10 @@ struct __rte_cache_aligned rte_mbuf {
485493
struct rte_mbuf *next;
486494
#endif
487495

488-
/* next 8 bytes are initialised on RX descriptor rearm */
496+
/*
497+
* Next 8 bytes are initialised on Rx descriptor rearm,
498+
* or on Rx when pulling packet from descriptor.
499+
*/
489500
union {
490501
uint64_t rearm_data[1];
491502
__extension__
@@ -517,7 +528,7 @@ struct __rte_cache_aligned rte_mbuf {
517528

518529
uint64_t ol_flags; /**< Offload features. */
519530

520-
/* remaining 24 bytes are set on RX when pulling packet from descriptor */
531+
/* Remaining 24 bytes are set on Rx when pulling packet from descriptor. */
521532
union {
522533
/* void * type of the array elements is retained for driver compatibility. */
523534
void *rx_descriptor_fields1[24 / sizeof(void *)];
@@ -603,7 +614,11 @@ struct __rte_cache_aligned rte_mbuf {
603614

604615
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
605616

606-
/* second cache line - fields only used in slow path or on TX */
617+
/*
618+
* Second cache line - fields only used in slow path or on Tx.
619+
* In special cases, some of these fields are also set on Rx,
620+
* most notably the 'next' field is set on Rx scattered packets.
621+
*/
607622
#if RTE_IOVA_IN_MBUF
608623
/**
609624
* Next segment of scattered packet. Must be NULL in the last

0 commit comments

Comments
 (0)