38 #ifndef included_clib_cache_h 39 #define included_clib_cache_h 46 #ifndef CLIB_LOG2_CACHE_LINE_BYTES 49 #ifndef CLIB_LOG2_CACHE_LINE_BYTES 50 #define CLIB_LOG2_CACHE_LINE_BYTES 6 55 #if (CLIB_LOG2_CACHE_LINE_BYTES >= 9) 56 #error Cache line size 512 bytes or greater 59 #define CLIB_CACHE_LINE_BYTES (1 << CLIB_LOG2_CACHE_LINE_BYTES) 60 #define CLIB_CACHE_LINE_ALIGN_MARK(mark) u8 mark[0] __attribute__((aligned(CLIB_CACHE_LINE_BYTES))) 61 #define CLIB_CACHE_LINE_ROUND(x) ((x + CLIB_CACHE_LINE_BYTES - 1) & ~(CLIB_CACHE_LINE_BYTES - 1)) 64 #ifndef CLIB_N_PREFETCHES 65 #define CLIB_N_PREFETCHES 16 69 #define CLIB_PREFETCH_READ 0 70 #define CLIB_PREFETCH_LOAD 0 71 #define CLIB_PREFETCH_WRITE 1 72 #define CLIB_PREFETCH_STORE 1 74 #define _CLIB_PREFETCH(n,size,type) \ 75 if ((size) > (n)*CLIB_CACHE_LINE_BYTES) \ 76 __builtin_prefetch (_addr + (n)*CLIB_CACHE_LINE_BYTES, \ 77 CLIB_PREFETCH_##type, \ 80 #define CLIB_PREFETCH(addr,size,type) \ 82 void * _addr = (addr); \ 84 ASSERT ((size) <= 4*CLIB_CACHE_LINE_BYTES); \ 85 _CLIB_PREFETCH (0, size, type); \ 86 _CLIB_PREFETCH (1, size, type); \ 87 _CLIB_PREFETCH (2, size, type); \ 88 _CLIB_PREFETCH (3, size, type); \
static_always_inline void clib_prefetch_load(void *p)
#define static_always_inline
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void clib_prefetch_store(void *p)
#define CLIB_CACHE_LINE_BYTES