Skip to content

Commit

Permalink
linux-dpdk: pool: add checks for internal event header sizes
Browse files Browse the repository at this point in the history
Add compile time checks for implementation internal event header sizes.
Detect if a size of an event header expands to a new cache line, as this
may have significant performance implications.

RTE_CACHE_LINE_SIZE is used instead of ODP_CACHE_LINE_SIZE because in ABI
compat mode the values may differ.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Tuomas Taipale <[email protected]>
  • Loading branch information
MatiasElo committed Aug 31, 2023
1 parent 5d505fd commit c11b278
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions platform/linux-dpdk/include/odp_buffer_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ typedef struct ODP_ALIGNED_CACHE odp_buffer_hdr_t {

} odp_buffer_hdr_t;

ODP_STATIC_ASSERT(sizeof(odp_buffer_hdr_t) <= 3 * RTE_CACHE_LINE_SIZE,
"Additional cache line required for odp_buffer_hdr_t");

static inline struct rte_mbuf *_odp_buf_to_mbuf(odp_buffer_t buf)
{
return (struct rte_mbuf *)(uintptr_t)buf;
Expand Down
5 changes: 5 additions & 0 deletions platform/linux-dpdk/include/odp_event_vector_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <odp_event_internal.h>

#include <rte_config.h>

#include <stdint.h>

/**
Expand All @@ -47,6 +49,9 @@ typedef struct ODP_ALIGNED_CACHE odp_event_vector_hdr_t {

} odp_event_vector_hdr_t;

ODP_STATIC_ASSERT(sizeof(odp_event_vector_hdr_t) <= 3 * RTE_CACHE_LINE_SIZE,
"Additional cache line required for odp_event_vector_hdr_t");

/**
* Return the vector header
*/
Expand Down
3 changes: 3 additions & 0 deletions platform/linux-dpdk/include/odp_packet_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
uint8_t crypto_aad_buf[PACKET_AAD_MAX];
} odp_packet_hdr_t;

ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) <= 6 * RTE_CACHE_LINE_SIZE,
"Additional cache line required for odp_packet_hdr_t");

/**
* Return the packet header
*/
Expand Down
5 changes: 5 additions & 0 deletions platform/linux-dpdk/include/odp_timer_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <odp_global_data.h>
#include <odp_pool_internal.h>

#include <rte_config.h>

/**
* Internal Timeout header
*/
Expand All @@ -46,6 +48,9 @@ typedef struct ODP_ALIGNED_CACHE odp_timeout_hdr_t {

} odp_timeout_hdr_t;

ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) <= 3 * RTE_CACHE_LINE_SIZE,
"Additional cache line required for odp_timeout_hdr_t");

/* A larger decrement value should be used after receiving events compared to
* an 'empty' call. */
void _odp_timer_run_inline(int dec);
Expand Down

0 comments on commit c11b278

Please sign in to comment.