Skip to content

Commit

Permalink
linux-gen: buffer: optimize header layout
Browse files Browse the repository at this point in the history
Pack most often used buffer header fields (including seg[0])
into the first cache line.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
Petri Savolainen authored and muvarov committed Sep 14, 2017
1 parent a787abf commit e4289ab
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions platform/linux-generic/include/odp_buffer_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,56 @@ typedef struct seg_entry_t {

/* Common buffer header */
struct odp_buffer_hdr_t {
/* Buffer index in the pool */
uint32_t index;

/* Initial buffer data pointer and length */
uint8_t *base_data;
uint8_t *buf_end;
/* Buffer index in the pool */
uint32_t index;

/* Max data size */
uint32_t size;
/* Total segment count */
uint16_t segcount;

/* Pool type */
int8_t type;

/* Burst counts */
uint8_t burst_num;
uint8_t burst_first;

/* Number of seg[] entries used */
uint8_t num_seg;

/* Total segment count */
uint32_t segcount;

/* Next header which continues the segment list */
void *next_seg;

/* Last header of the segment list */
void *last_seg;

/* Initial buffer data pointer and length */
uint8_t *base_data;
uint8_t *buf_end;

/* --- 40 bytes --- */

/* Segments */
seg_entry_t seg[CONFIG_PACKET_MAX_SEGS];

/* Burst counts */
uint8_t burst_num;
uint8_t burst_first;

/* Next buf in a list */
struct odp_buffer_hdr_t *next;

/* Burst table */
struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];

/* --- Mostly read only data --- */

/* User context pointer or u64 */
union {
uint64_t buf_u64;
void *buf_ctx;
const void *buf_cctx; /* const alias for ctx */
};

/* Pool pointer */
void *pool_ptr;

/* User area pointer */
void *uarea_addr;

Expand All @@ -94,9 +102,6 @@ struct odp_buffer_hdr_t {
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;

/* Burst table */
struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];

/* ipc mapped process can not walk over pointers,
* offset has to be used */
uint64_t ipc_data_offset;
Expand All @@ -105,8 +110,8 @@ struct odp_buffer_hdr_t {
* inlining */
odp_pool_t pool_hdl;

/* Pool pointer */
void *pool_ptr;
/* Max data size */
uint32_t size;

/* Data or next header */
uint8_t data[0];
Expand Down

0 comments on commit e4289ab

Please sign in to comment.