struct ipv6_5tuple *w;
sz = config.nb_traces * (config.ipv6 ? sizeof(*w) : sizeof(*v));
- config.traces = rte_zmalloc_socket(name, sz, CACHE_LINE_SIZE,
+ config.traces = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
if (config.traces == NULL)
rte_exit(EXIT_FAILURE, "Cannot allocate %zu bytes for "
rte_lcore_id());
worker_mbuf = rte_malloc_socket(NULL, sizeof(struct app_mbuf_array),
- CACHE_LINE_SIZE, rte_socket_id());
+ RTE_CACHE_LINE_SIZE, rte_socket_id());
if (worker_mbuf == NULL)
rte_panic("Worker thread: cannot allocate buffer space\n");
mbp_ctor_arg.seg_buf_size = (uint16_t) (RTE_PKTMBUF_HEADROOM +
mbuf_seg_size);
mb_ctor_arg.seg_buf_offset =
- (uint16_t) CACHE_LINE_ROUNDUP(sizeof(struct rte_mbuf));
+ (uint16_t) RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_mbuf));
mb_ctor_arg.seg_buf_size = mbp_ctor_arg.seg_buf_size;
mb_size = mb_ctor_arg.seg_buf_offset + mb_ctor_arg.seg_buf_size;
mbuf_poolname_build(socket_id, pool_name, sizeof(pool_name));
/* Configuration of logical cores. */
fwd_lcores = rte_zmalloc("testpmd: fwd_lcores",
sizeof(struct fwd_lcore *) * nb_lcores,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (fwd_lcores == NULL) {
rte_exit(EXIT_FAILURE, "rte_zmalloc(%d (struct fwd_lcore *)) "
"failed\n", nb_lcores);
for (lc_id = 0; lc_id < nb_lcores; lc_id++) {
fwd_lcores[lc_id] = rte_zmalloc("testpmd: struct fwd_lcore",
sizeof(struct fwd_lcore),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (fwd_lcores[lc_id] == NULL) {
rte_exit(EXIT_FAILURE, "rte_zmalloc(struct fwd_lcore) "
"failed\n");
/* Configuration of Ethernet ports. */
ports = rte_zmalloc("testpmd: ports",
sizeof(struct rte_port) * nb_ports,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (ports == NULL) {
rte_exit(EXIT_FAILURE, "rte_zmalloc(%d struct rte_port) "
"failed\n", nb_ports);
/* Reconfiguration of Ethernet ports. */
ports = rte_realloc(ports,
sizeof(struct rte_port) * nb_ports,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (ports == NULL) {
rte_exit(EXIT_FAILURE, "rte_realloc(%d struct rte_port) failed\n",
nb_ports);
/* init new */
nb_fwd_streams = nb_fwd_streams_new;
fwd_streams = rte_zmalloc("testpmd: fwd_streams",
- sizeof(struct fwd_stream *) * nb_fwd_streams, CACHE_LINE_SIZE);
+ sizeof(struct fwd_stream *) * nb_fwd_streams, RTE_CACHE_LINE_SIZE);
if (fwd_streams == NULL)
rte_exit(EXIT_FAILURE, "rte_zmalloc(%d (struct fwd_stream *)) "
"failed\n", nb_fwd_streams);
for (sm_id = 0; sm_id < nb_fwd_streams; sm_id++) {
fwd_streams[sm_id] = rte_zmalloc("testpmd: struct fwd_stream",
- sizeof(struct fwd_stream), CACHE_LINE_SIZE);
+ sizeof(struct fwd_stream), RTE_CACHE_LINE_SIZE);
if (fwd_streams[sm_id] == NULL)
rte_exit(EXIT_FAILURE, "rte_zmalloc(struct fwd_stream)"
" failed\n");
#define DEF_MBUF_CACHE 250
-#define CACHE_LINE_SIZE_ROUNDUP(size) \
- (CACHE_LINE_SIZE * ((size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE))
+#define RTE_CACHE_LINE_SIZE_ROUNDUP(size) \
+ (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE))
#define NUMA_NO_CONFIG 0xFF
#define UMA_NO_CONFIG 0xFF
time_cache_line_switch(void)
{
/* allocate a full cache line for data, we use only first byte of it */
- uint64_t data[CACHE_LINE_SIZE*3 / sizeof(uint64_t)];
+ uint64_t data[RTE_CACHE_LINE_SIZE*3 / sizeof(uint64_t)];
unsigned i, slaveid = rte_get_next_lcore(rte_lcore_id(), 0, 0);
volatile uint64_t *pdata = &data[0];
for (i = 0; i < RTE_LIBRTE_IVSHMEM_MAX_ENTRIES; i++) {
snprintf(name, sizeof(name), "mz_%i", i);
- mz = rte_memzone_reserve(name, CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
+ mz = rte_memzone_reserve(name, RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
ASSERT(mz != NULL, "Failed to reserve memzone");
ASSERT(rte_ivshmem_metadata_add_memzone(mz, METADATA_NAME) == 0,
"Failed to add memzone");
}
- mz = rte_memzone_reserve("one too many", CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
+ mz = rte_memzone_reserve("one too many", RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
ASSERT(mz != NULL, "Failed to reserve memzone");
ASSERT(rte_ivshmem_metadata_add_memzone(mz, METADATA_NAME) < 0,
ASSERT(rte_ivshmem_metadata_create(METADATA_NAME) == 0,
"Failed to create metadata");
- mz = rte_memzone_reserve("mz", CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
+ mz = rte_memzone_reserve("mz", RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
ASSERT(mz != NULL, "Failed to reserve memzone");
ASSERT(rte_ivshmem_metadata_add_memzone(mz, METADATA_NAME) == 0,
size_t size =rte_str_to_size(MALLOC_MEMZONE_SIZE)*2;
int align = 0;
#ifndef RTE_LIBRTE_MALLOC_DEBUG
- int overhead = CACHE_LINE_SIZE + CACHE_LINE_SIZE;
+ int overhead = RTE_CACHE_LINE_SIZE + RTE_CACHE_LINE_SIZE;
#else
- int overhead = CACHE_LINE_SIZE + CACHE_LINE_SIZE + CACHE_LINE_SIZE;
+ int overhead = RTE_CACHE_LINE_SIZE + RTE_CACHE_LINE_SIZE + RTE_CACHE_LINE_SIZE;
#endif
rte_malloc_get_socket_stats(socket, &pre_stats);
#ifndef RTE_LIBRTE_MALLOC_DEBUG
int trailer_size = 0;
#else
- int trailer_size = CACHE_LINE_SIZE;
+ int trailer_size = RTE_CACHE_LINE_SIZE;
#endif
- int overhead = CACHE_LINE_SIZE + trailer_size;
+ int overhead = RTE_CACHE_LINE_SIZE + trailer_size;
rte_malloc_get_socket_stats(socket, &pre_stats);
const unsigned size4 = size3 + 1024;
/* test data is the same even if element is moved*/
- char *ptr1 = rte_zmalloc(NULL, size1, CACHE_LINE_SIZE);
+ char *ptr1 = rte_zmalloc(NULL, size1, RTE_CACHE_LINE_SIZE);
if (!ptr1){
printf("NULL pointer returned from rte_zmalloc\n");
return -1;
}
snprintf(ptr1, size1, "%s" ,hello_str);
- char *ptr2 = rte_realloc(ptr1, size2, CACHE_LINE_SIZE);
+ char *ptr2 = rte_realloc(ptr1, size2, RTE_CACHE_LINE_SIZE);
if (!ptr2){
rte_free(ptr1);
printf("NULL pointer returned from rte_realloc\n");
/* now allocate third element, free the second
* and resize third. It should not move. (ptr1 is now invalid)
*/
- char *ptr3 = rte_zmalloc(NULL, size3, CACHE_LINE_SIZE);
+ char *ptr3 = rte_zmalloc(NULL, size3, RTE_CACHE_LINE_SIZE);
if (!ptr3){
printf("NULL pointer returned from rte_zmalloc\n");
rte_free(ptr2);
}
rte_free(ptr2);
/* first resize to half the size of the freed block */
- char *ptr4 = rte_realloc(ptr3, size4, CACHE_LINE_SIZE);
+ char *ptr4 = rte_realloc(ptr3, size4, RTE_CACHE_LINE_SIZE);
if (!ptr4){
printf("NULL pointer returned from rte_realloc\n");
rte_free(ptr3);
return -1;
}
/* now resize again to the full size of the freed block */
- ptr4 = rte_realloc(ptr3, size3 + size2 + size1, CACHE_LINE_SIZE);
+ ptr4 = rte_realloc(ptr3, size3 + size2 + size1, RTE_CACHE_LINE_SIZE);
if (ptr3 != ptr4){
printf("Unexpected - ptr4 != ptr3 on second resize\n");
rte_free(ptr4);
/* now try a resize to a smaller size, see if it works */
const unsigned size5 = 1024;
const unsigned size6 = size5 / 2;
- char *ptr5 = rte_malloc(NULL, size5, CACHE_LINE_SIZE);
+ char *ptr5 = rte_malloc(NULL, size5, RTE_CACHE_LINE_SIZE);
if (!ptr5){
printf("NULL pointer returned from rte_malloc\n");
return -1;
}
- char *ptr6 = rte_realloc(ptr5, size6, CACHE_LINE_SIZE);
+ char *ptr6 = rte_realloc(ptr5, size6, RTE_CACHE_LINE_SIZE);
if (!ptr6){
printf("NULL pointer returned from rte_realloc\n");
rte_free(ptr5);
/* check for behaviour changing alignment */
const unsigned size7 = 1024;
- const unsigned orig_align = CACHE_LINE_SIZE;
- unsigned new_align = CACHE_LINE_SIZE * 2;
+ const unsigned orig_align = RTE_CACHE_LINE_SIZE;
+ unsigned new_align = RTE_CACHE_LINE_SIZE * 2;
char *ptr7 = rte_malloc(NULL, size7, orig_align);
if (!ptr7){
printf("NULL pointer returned from rte_malloc\n");
*/
unsigned size9 = 1024, size10 = 1024;
unsigned size11 = size9 + size10 + 256;
- char *ptr9 = rte_malloc(NULL, size9, CACHE_LINE_SIZE);
+ char *ptr9 = rte_malloc(NULL, size9, RTE_CACHE_LINE_SIZE);
if (!ptr9){
printf("NULL pointer returned from rte_malloc\n");
return -1;
}
- char *ptr10 = rte_malloc(NULL, size10, CACHE_LINE_SIZE);
+ char *ptr10 = rte_malloc(NULL, size10, RTE_CACHE_LINE_SIZE);
if (!ptr10){
printf("NULL pointer returned from rte_malloc\n");
return -1;
}
rte_free(ptr9);
- char *ptr11 = rte_realloc(ptr10, size11, CACHE_LINE_SIZE);
+ char *ptr11 = rte_realloc(ptr10, size11, RTE_CACHE_LINE_SIZE);
if (!ptr11){
printf("NULL pointer returned from rte_realloc\n");
rte_free(ptr10);
* We should get a malloc of the size requested*/
const size_t size12 = 1024;
size_t size12_check;
- char *ptr12 = rte_realloc(NULL, size12, CACHE_LINE_SIZE);
+ char *ptr12 = rte_realloc(NULL, size12, RTE_CACHE_LINE_SIZE);
if (!ptr12){
printf("NULL pointer returned from rte_realloc\n");
return -1;
{
const size_t request_size = 1024;
size_t allocated_size;
- char *data_ptr = rte_malloc(NULL, request_size, CACHE_LINE_SIZE);
+ char *data_ptr = rte_malloc(NULL, request_size, RTE_CACHE_LINE_SIZE);
#ifdef RTE_LIBRTE_MALLOC_DEBUG
int retval;
char *over_write_vals = NULL;
char *p1 = rte_malloc(NULL,1024, 0);
if (!p1)
goto err_return;
- if (!rte_is_aligned(p1, CACHE_LINE_SIZE))
+ if (!rte_is_aligned(p1, RTE_CACHE_LINE_SIZE))
goto err_return;
rte_free(p1);
return 0;
{
const char *type = NULL;
size_t size = 0;
- unsigned align = CACHE_LINE_SIZE;
+ unsigned align = RTE_CACHE_LINE_SIZE;
/* rte_malloc expected to return null with inappropriate size */
char *bad_ptr = rte_malloc(type, size, align);
static int
test_mbuf(void)
{
- RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != CACHE_LINE_SIZE * 2);
+ RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_SIZE * 2);
/* create pktmbuf pool if it does not exist */
if (pktmbuf_pool == NULL) {
continue;
/* align everything */
- last_addr = RTE_PTR_ALIGN_CEIL(ms[memseg_idx].addr, CACHE_LINE_SIZE);
+ last_addr = RTE_PTR_ALIGN_CEIL(ms[memseg_idx].addr, RTE_CACHE_LINE_SIZE);
len = ms[memseg_idx].len - RTE_PTR_DIFF(last_addr, ms[memseg_idx].addr);
- len &= ~((size_t) CACHE_LINE_MASK);
+ len &= ~((size_t) RTE_CACHE_LINE_MASK);
/* cycle through all memzones */
for (memzone_idx = 0; memzone_idx < RTE_MAX_MEMZONE; memzone_idx++) {
continue;
/* align everything */
- last_addr = RTE_PTR_ALIGN_CEIL(ms[memseg_idx].addr, CACHE_LINE_SIZE);
+ last_addr = RTE_PTR_ALIGN_CEIL(ms[memseg_idx].addr, RTE_CACHE_LINE_SIZE);
len = ms[memseg_idx].len - RTE_PTR_DIFF(last_addr, ms[memseg_idx].addr);
- len &= ~((size_t) CACHE_LINE_MASK);
+ len &= ~((size_t) RTE_CACHE_LINE_MASK);
/* cycle through all memzones */
for (memzone_idx = 0; memzone_idx < RTE_MAX_MEMZONE; memzone_idx++) {
printf("Unable to reserve 64-byte aligned memzone!\n");
return -1;
}
- if ((memzone_aligned_32->phys_addr & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_32->phys_addr & RTE_CACHE_LINE_MASK) != 0)
return -1;
- if (((uintptr_t) memzone_aligned_32->addr & CACHE_LINE_MASK) != 0)
+ if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0)
return -1;
- if ((memzone_aligned_32->len & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_32->len & RTE_CACHE_LINE_MASK) != 0)
return -1;
if (memzone_aligned_128 == NULL) {
return -1;
if (((uintptr_t) memzone_aligned_128->addr & 127) != 0)
return -1;
- if ((memzone_aligned_128->len & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_128->len & RTE_CACHE_LINE_MASK) != 0)
return -1;
if (memzone_aligned_256 == NULL) {
return -1;
if (((uintptr_t) memzone_aligned_256->addr & 255) != 0)
return -1;
- if ((memzone_aligned_256->len & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_256->len & RTE_CACHE_LINE_MASK) != 0)
return -1;
if (memzone_aligned_512 == NULL) {
return -1;
if (((uintptr_t) memzone_aligned_512->addr & 511) != 0)
return -1;
- if ((memzone_aligned_512->len & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_512->len & RTE_CACHE_LINE_MASK) != 0)
return -1;
if (memzone_aligned_1024 == NULL) {
return -1;
if (((uintptr_t) memzone_aligned_1024->addr & 1023) != 0)
return -1;
- if ((memzone_aligned_1024->len & CACHE_LINE_MASK) != 0)
+ if ((memzone_aligned_1024->len & RTE_CACHE_LINE_MASK) != 0)
return -1;
/* check that zones don't overlap */
return (-1);
}
- if ((mz->len & CACHE_LINE_MASK) != 0 || mz->len < len ||
- mz->len < CACHE_LINE_SIZE) {
+ if ((mz->len & RTE_CACHE_LINE_MASK) != 0 || mz->len < len ||
+ mz->len < RTE_CACHE_LINE_SIZE) {
printf("%s(%s): invalid length\n",
__func__, mz->name);
return (-1);
prev_min_len = prev_min_ms->len;
/* try reserving a memzone in the smallest memseg */
- mz = rte_memzone_reserve("smallest_mz", CACHE_LINE_SIZE,
+ mz = rte_memzone_reserve("smallest_mz", RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY, 0);
if (mz == NULL) {
printf("Failed to reserve memory from smallest memseg!\n");
return -1;
}
if (prev_min_ms->len != prev_min_len &&
- min_ms->len != min_len - CACHE_LINE_SIZE) {
+ min_ms->len != min_len - RTE_CACHE_LINE_SIZE) {
printf("Reserved memory from wrong memseg!\n");
return -1;
}
min_ms = NULL; /*< smallest segment */
prev_min_ms = NULL; /*< second smallest segment */
- align = CACHE_LINE_SIZE * 4;
+ align = RTE_CACHE_LINE_SIZE * 4;
/* find two smallest segments */
for (i = 0; i < RTE_MAX_MEMSEG; i++) {
/* make sure final length is *not* aligned */
while (((min_ms->addr_64 + len) & (align-1)) == 0)
- len += CACHE_LINE_SIZE;
+ len += RTE_CACHE_LINE_SIZE;
if (rte_memzone_reserve("dummy_mz1", len, SOCKET_ID_ANY, 0) == NULL) {
printf("Cannot reserve memory!\n");
}
/* if we don't need to touch smallest segment but it's aligned */
else if ((min_ms->addr_64 & (align-1)) == 0) {
- if (rte_memzone_reserve("align_mz1", CACHE_LINE_SIZE,
+ if (rte_memzone_reserve("align_mz1", RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY, 0) == NULL) {
printf("Cannot reserve memory!\n");
return -1;
}
- if (min_ms->len != min_len - CACHE_LINE_SIZE) {
+ if (min_ms->len != min_len - RTE_CACHE_LINE_SIZE) {
printf("Reserved memory from wrong segment!\n");
return -1;
}
/* make sure final length is aligned */
while (((prev_min_ms->addr_64 + len) & (align-1)) != 0)
- len += CACHE_LINE_SIZE;
+ len += RTE_CACHE_LINE_SIZE;
if (rte_memzone_reserve("dummy_mz2", len, SOCKET_ID_ANY, 0) == NULL) {
printf("Cannot reserve memory!\n");
return -1;
}
}
- len = CACHE_LINE_SIZE;
+ len = RTE_CACHE_LINE_SIZE;
int i, align;
min_len = 0;
- align = CACHE_LINE_SIZE;
+ align = RTE_CACHE_LINE_SIZE;
config = rte_eal_get_configuration();
min_ms = ms;
/* find maximum alignment this segment is able to hold */
- align = CACHE_LINE_SIZE;
+ align = RTE_CACHE_LINE_SIZE;
while ((ms->addr_64 & (align-1)) == 0) {
align <<= 1;
}
/* check cache-line alignments */
printf("check alignments and lengths\n");
- if ((memzone1->phys_addr & CACHE_LINE_MASK) != 0)
+ if ((memzone1->phys_addr & RTE_CACHE_LINE_MASK) != 0)
return -1;
- if ((memzone2->phys_addr & CACHE_LINE_MASK) != 0)
+ if ((memzone2->phys_addr & RTE_CACHE_LINE_MASK) != 0)
return -1;
- if (memzone3 != NULL && (memzone3->phys_addr & CACHE_LINE_MASK) != 0)
+ if (memzone3 != NULL && (memzone3->phys_addr & RTE_CACHE_LINE_MASK) != 0)
return -1;
- if ((memzone1->len & CACHE_LINE_MASK) != 0 || memzone1->len == 0)
+ if ((memzone1->len & RTE_CACHE_LINE_MASK) != 0 || memzone1->len == 0)
return -1;
- if ((memzone2->len & CACHE_LINE_MASK) != 0 || memzone2->len == 0)
+ if ((memzone2->len & RTE_CACHE_LINE_MASK) != 0 || memzone2->len == 0)
return -1;
- if (memzone3 != NULL && ((memzone3->len & CACHE_LINE_MASK) != 0 ||
+ if (memzone3 != NULL && ((memzone3->len & RTE_CACHE_LINE_MASK) != 0 ||
memzone3->len == 0))
return -1;
if (memzone4->len != 1024)
pkts_burst = (struct rte_mbuf **)
rte_calloc_socket("poll_burst",
total, sizeof(void *),
- CACHE_LINE_SIZE, conf->socketid);
+ RTE_CACHE_LINE_SIZE, conf->socketid);
if (!pkts_burst)
return -1;
rte_calloc_socket("tx_buff",
MAX_TRAFFIC_BURST * nb_ports,
sizeof(void *),
- CACHE_LINE_SIZE, socketid);
+ RTE_CACHE_LINE_SIZE, socketid);
if (!tx_burst)
return -1;
}
rte_pipeline_table_action_handler_hit f_action;
uint32_t table_next_id;
uint32_t table_next_id_valid;
- uint8_t actions_lookup_miss[CACHE_LINE_SIZE];
+ uint8_t actions_lookup_miss[RTE_CACHE_LINE_SIZE];
uint32_t action_data_size;
void *h_table;
};
goto fail;
}
- kni_port_params_array[port_id] = (struct kni_port_params*)rte_zmalloc("KNI_port_params", sizeof(struct kni_port_params), CACHE_LINE_SIZE);
+ kni_port_params_array[port_id] = (struct kni_port_params*)rte_zmalloc("KNI_port_params", sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
kni_port_params_array[port_id]->port_id = port_id;
kni_port_params_array[port_id]->lcore_rx = (uint8_t)int_fld[i++];
kni_port_params_array[port_id]->lcore_tx = (uint8_t)int_fld[i++];
}
pLocalInstanceHandles = rte_malloc("pLocalInstanceHandles",
- sizeof(CpaInstanceHandle) * numInstances, CACHE_LINE_SIZE);
+ sizeof(CpaInstanceHandle) * numInstances, RTE_CACHE_LINE_SIZE);
if (NULL == pLocalInstanceHandles) {
return CPA_STATUS_FAIL;
struct app_rule *new_rule = (struct app_rule *)
rte_zmalloc_socket("CLI",
sizeof(struct app_rule),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
rte_socket_id());
if (new_rule == NULL)
struct app_rule *new_rule = (struct app_rule *)
rte_zmalloc_socket("CLI",
sizeof(struct app_rule),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
rte_socket_id());
if (new_rule == NULL)
struct app_rule *new_rule = (struct app_rule *)
rte_zmalloc_socket("CLI",
sizeof(struct app_rule),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
rte_socket_id());
memcpy(new_rule, &rule, sizeof(rule));
struct app_rule *new_rule = (struct app_rule *)
rte_zmalloc_socket("CLI",
sizeof(struct app_rule),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
rte_socket_id());
if (new_rule == NULL)
RTE_LOG(INFO, USER1, "Initializing %u SW rings ...\n", n_swq);
app.rings = rte_malloc_socket(NULL, n_swq * sizeof(struct rte_ring *),
- CACHE_LINE_SIZE, rte_socket_id());
+ RTE_CACHE_LINE_SIZE, rte_socket_id());
if (app.rings == NULL)
rte_panic("Cannot allocate memory to store ring pointers\n");
void
app_init(void)
{
- if ((sizeof(struct app_pkt_metadata) % CACHE_LINE_SIZE) != 0)
+ if ((sizeof(struct app_pkt_metadata) % RTE_CACHE_LINE_SIZE) != 0)
rte_panic("Application pkt meta-data size mismatch\n");
app_check_core_params();
core_id);
m = rte_malloc_socket(NULL, sizeof(struct app_mbuf_array),
- CACHE_LINE_SIZE, rte_socket_id());
+ RTE_CACHE_LINE_SIZE, rte_socket_id());
if (m == NULL)
rte_panic("%s: cannot allocate buffer space\n", __func__);
RTE_LOG(INFO, USER1, "Core %u is doing RX (no pipeline)\n", core_id);
ma = rte_malloc_socket(NULL, sizeof(struct app_mbuf_array),
- CACHE_LINE_SIZE, rte_socket_id());
+ RTE_CACHE_LINE_SIZE, rte_socket_id());
if (ma == NULL)
rte_panic("%s: cannot allocate buffer space\n", __func__);
for (i = 0; i < APP_MAX_PORTS; i++) {
m[i] = rte_malloc_socket(NULL, sizeof(struct app_mbuf_array),
- CACHE_LINE_SIZE, rte_socket_id());
+ RTE_CACHE_LINE_SIZE, rte_socket_id());
if (m[i] == NULL)
rte_panic("%s: Cannot allocate buffer space\n",
__func__);
n = RTE_MAX(max_flow_num, 2UL * MAX_PKT_BURST);
sz = sizeof (*mtb) + sizeof (mtb->m_table[0]) * n;
- if ((mtb = rte_zmalloc_socket(__func__, sz, CACHE_LINE_SIZE,
+ if ((mtb = rte_zmalloc_socket(__func__, sz, RTE_CACHE_LINE_SIZE,
socket)) == NULL) {
RTE_LOG(ERR, IP_RSMBL, "%s() for lcore: %u, port: %u "
"failed to allocate %zu bytes\n",
}
kni_port_params_array[port_id] =
(struct kni_port_params*)rte_zmalloc("KNI_port_params",
- sizeof(struct kni_port_params), CACHE_LINE_SIZE);
+ sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
kni_port_params_array[port_id]->port_id = port_id;
kni_port_params_array[port_id]->lcore_rx =
(uint8_t)int_fld[i++];
/* Setup lcore ID allocation map */
lcore_cfg = rte_zmalloc("LCORE_ID_MAP",
sizeof(uint16_t) * RTE_MAX_LCORE,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if(lcore_cfg == NULL)
rte_panic("Failed to malloc\n");
{
if ((core_cfg = rte_zmalloc("core_cfg",
sizeof(struct lcore_stat) * RTE_MAX_LCORE,
- CACHE_LINE_SIZE)) == NULL ) {
+ RTE_CACHE_LINE_SIZE)) == NULL ) {
printf("rte_zmalloc failed\n");
return -1;
}
unsigned rx;
unsigned tx;
unsigned drop;
-} __attribute__((aligned(CACHE_LINE_SIZE / 2)));
+} __attribute__((aligned(RTE_CACHE_LINE_SIZE / 2)));
static int proc_id = -1;
static unsigned num_procs = 0;
nmif_sz = NETMAP_IF_RING_OFS(port_rings, port_rings, port_slots);
sz = nmif_sz * port_num;
- buf_ofs = RTE_ALIGN_CEIL(sz, CACHE_LINE_SIZE);
+ buf_ofs = RTE_ALIGN_CEIL(sz, RTE_CACHE_LINE_SIZE);
sz = buf_ofs + port_bufs * conf->max_bufsz * port_num;
if (sz > UINT32_MAX ||
(netmap.mem = rte_zmalloc_socket(__func__, sz,
- CACHE_LINE_SIZE, conf->socket_id)) == NULL) {
+ RTE_CACHE_LINE_SIZE, conf->socket_id)) == NULL) {
RTE_LOG(ERR, USER1, "%s: failed to allocate %zu bytes\n",
__func__, sz);
return (-ENOMEM);
else if (mode == (APP_TX_MODE | APP_WT_MODE)) {
for (i = 0; i < wt_idx; i++) {
wt_confs[i]->m_table = rte_malloc("table_wt", sizeof(struct rte_mbuf *)
- * burst_conf.tx_burst, CACHE_LINE_SIZE);
+ * burst_conf.tx_burst, RTE_CACHE_LINE_SIZE);
if (wt_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
else if (mode == APP_TX_MODE) {
for (i = 0; i < tx_idx; i++) {
tx_confs[i]->m_table = rte_malloc("table_tx", sizeof(struct rte_mbuf *)
- * burst_conf.tx_burst, CACHE_LINE_SIZE);
+ * burst_conf.tx_burst, RTE_CACHE_LINE_SIZE);
if (tx_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
#define MAC_ADDR_CMP 0xFFFFFFFFFFFFULL
/* Number of descriptors per cacheline. */
-#define DESC_PER_CACHELINE (CACHE_LINE_SIZE / sizeof(struct vring_desc))
+#define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))
/* mask of enabled ports */
static uint32_t enabled_port_mask = 0;
struct vhost_dev *vdev;
uint32_t regionidx;
- vdev = rte_zmalloc("vhost device", sizeof(*vdev), CACHE_LINE_SIZE);
+ vdev = rte_zmalloc("vhost device", sizeof(*vdev), RTE_CACHE_LINE_SIZE);
if (vdev == NULL) {
RTE_LOG(INFO, VHOST_DATA, "(%"PRIu64") Couldn't allocate memory for vhost dev\n",
dev->device_fh);
vdev->regions_hpa = (struct virtio_memory_regions_hpa *) rte_zmalloc("vhost hpa region",
sizeof(struct virtio_memory_regions_hpa) * vdev->nregions_hpa,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (vdev->regions_hpa == NULL) {
RTE_LOG(ERR, VHOST_CONFIG, "Cannot allocate memory for hpa region\n");
rte_free(vdev);
/* Setup device and virtqueues. */
new_ll_dev = calloc(1, sizeof(struct virtio_net_config_ll));
- virtqueue_rx = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), CACHE_LINE_SIZE);
- virtqueue_tx = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), CACHE_LINE_SIZE);
+ virtqueue_rx = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), RTE_CACHE_LINE_SIZE);
+ virtqueue_tx = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), RTE_CACHE_LINE_SIZE);
if (new_ll_dev == NULL || virtqueue_rx == NULL || virtqueue_tx == NULL)
goto err;
continue;
chan_info = rte_malloc(NULL, sizeof(*chan_info),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (chan_info == NULL) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error allocating memory for "
"channel '%s%s'\n", CHANNEL_MGR_SOCKET_PATH, dir->d_name);
continue;
}
chan_info = rte_malloc(NULL, sizeof(*chan_info),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (chan_info == NULL) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error allocating memory for "
"channel '%s'\n", socket_path);
}
new_domain = rte_malloc("virtual_machine_info", sizeof(*new_domain),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (new_domain == NULL) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to allocate memory for VM "
"info\n");
global_maplen = VIR_CPU_MAPLEN(CHANNEL_CMDS_MAX_CPUS);
global_vircpuinfo = rte_zmalloc(NULL, sizeof(*global_vircpuinfo) *
- CHANNEL_CMDS_MAX_CPUS, CACHE_LINE_SIZE);
+ CHANNEL_CMDS_MAX_CPUS, RTE_CACHE_LINE_SIZE);
if (global_vircpuinfo == NULL) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error allocating memory for CPU Info\n");
goto error;
}
global_cpumaps = rte_zmalloc(NULL, CHANNEL_CMDS_MAX_CPUS * global_maplen,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (global_cpumaps == NULL) {
goto error;
}
return -1;
}
global_events_list = rte_malloc("epoll_events", sizeof(*global_events_list)
- * MAX_EVENTS, CACHE_LINE_SIZE);
+ * MAX_EVENTS, RTE_CACHE_LINE_SIZE);
if (global_events_list == NULL) {
RTE_LOG(ERR, CHANNEL_MONITOR, "Unable to rte_malloc for "
"epoll events\n");
node_bld_trie, num_tries, match_num);
/* Allocate runtime memory (align to cache boundary) */
- total_size = RTE_ALIGN(data_index_sz, CACHE_LINE_SIZE) +
+ total_size = RTE_ALIGN(data_index_sz, RTE_CACHE_LINE_SIZE) +
indices.match_index * sizeof(uint64_t) +
(match_num + 2) * sizeof(struct rte_acl_match_results) +
XMM_SIZE;
- mem = rte_zmalloc_socket(ctx->name, total_size, CACHE_LINE_SIZE,
+ mem = rte_zmalloc_socket(ctx->name, total_size, RTE_CACHE_LINE_SIZE,
ctx->socket_id);
if (mem == NULL) {
RTE_LOG(ERR, ACL,
/* Fill the runtime structure */
match_index = indices.match_index;
node_array = (uint64_t *)((uintptr_t)mem +
- RTE_ALIGN(data_index_sz, CACHE_LINE_SIZE));
+ RTE_ALIGN(data_index_sz, RTE_CACHE_LINE_SIZE));
/*
* Setup the NOMATCH node (a SINGLE at the
goto exit;
}
- ctx = rte_zmalloc_socket(name, sz, CACHE_LINE_SIZE, param->socket_id);
+ ctx = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE, param->socket_id);
if (ctx == NULL) {
RTE_LOG(ERR, ACL,
* rte_memory related.
*/
#define SOCKET_ID_ANY -1 /**< Any NUMA socket. */
-#define CACHE_LINE_SIZE 64 /**< Cache line size. */
-#define CACHE_LINE_MASK (CACHE_LINE_SIZE-1) /**< Cache line mask. */
+#define RTE_CACHE_LINE_SIZE 64 /**< Cache line size. */
+#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1) /**< Cache line mask. */
/**
* Force alignment to cache line.
*/
-#define __rte_cache_aligned __attribute__((__aligned__(CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
/*
*/
union rte_distributor_buffer {
volatile int64_t bufptr64;
- char pad[CACHE_LINE_SIZE*3];
+ char pad[RTE_CACHE_LINE_SIZE*3];
} __rte_cache_aligned;
struct rte_distributor_backlog {
const struct rte_memzone *mz;
/* compilation-time checks */
- RTE_BUILD_BUG_ON((sizeof(*d) & CACHE_LINE_MASK) != 0);
+ RTE_BUILD_BUG_ON((sizeof(*d) & RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) != 0);
RTE_BUILD_BUG_ON(RTE_DISTRIB_MAX_WORKERS >
sizeof(d->in_flight_bitmask) * CHAR_BIT);
unsigned flags)
{
return rte_memzone_reserve_aligned(name,
- len, socket_id, flags, CACHE_LINE_SIZE);
+ len, socket_id, flags, RTE_CACHE_LINE_SIZE);
}
/*
}
/* alignment less than cache size is not allowed */
- if (align < CACHE_LINE_SIZE)
- align = CACHE_LINE_SIZE;
+ if (align < RTE_CACHE_LINE_SIZE)
+ align = RTE_CACHE_LINE_SIZE;
/* align length on cache boundary. Check for overflow before doing so */
- if (len > SIZE_MAX - CACHE_LINE_MASK) {
+ if (len > SIZE_MAX - RTE_CACHE_LINE_MASK) {
rte_errno = EINVAL; /* requested size too big */
return NULL;
}
- len += CACHE_LINE_MASK;
- len &= ~((size_t) CACHE_LINE_MASK);
+ len += RTE_CACHE_LINE_MASK;
+ len &= ~((size_t) RTE_CACHE_LINE_MASK);
/* save minimal requested length */
- requested_len = RTE_MAX((size_t)CACHE_LINE_SIZE, len);
+ requested_len = RTE_MAX((size_t)RTE_CACHE_LINE_SIZE, len);
/* check that boundary condition is valid */
if (bound != 0 &&
unsigned virt_align;
unsigned off;
- phys_align = memseg->phys_addr & CACHE_LINE_MASK;
- virt_align = (unsigned long)memseg->addr & CACHE_LINE_MASK;
+ phys_align = memseg->phys_addr & RTE_CACHE_LINE_MASK;
+ virt_align = (unsigned long)memseg->addr & RTE_CACHE_LINE_MASK;
/*
* sanity check: phys_addr and addr must have the same
return -1;
/* memseg is really too small, don't bother with it */
- if (memseg->len < (2 * CACHE_LINE_SIZE)) {
+ if (memseg->len < (2 * RTE_CACHE_LINE_SIZE)) {
memseg->len = 0;
return 0;
}
/* align start address */
- off = (CACHE_LINE_SIZE - phys_align) & CACHE_LINE_MASK;
+ off = (RTE_CACHE_LINE_SIZE - phys_align) & RTE_CACHE_LINE_MASK;
memseg->phys_addr += off;
memseg->addr = (char *)memseg->addr + off;
memseg->len -= off;
/* align end address */
- memseg->len &= ~((uint64_t)CACHE_LINE_MASK);
+ memseg->len &= ~((uint64_t)RTE_CACHE_LINE_MASK);
return 0;
}
};
#define SOCKET_ID_ANY -1 /**< Any NUMA socket. */
-#ifndef CACHE_LINE_SIZE
-#define CACHE_LINE_SIZE 64 /**< Cache line size. */
+#ifndef RTE_CACHE_LINE_SIZE
+#define RTE_CACHE_LINE_SIZE 64 /**< Cache line size. */
#endif
-#define CACHE_LINE_MASK (CACHE_LINE_SIZE-1) /**< Cache line mask. */
+#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1) /**< Cache line mask. */
-#define CACHE_LINE_ROUNDUP(size) \
- (CACHE_LINE_SIZE * ((size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE))
+#define RTE_CACHE_LINE_ROUNDUP(size) \
+ (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE))
/**< Return the first cache-aligned value greater or equal to size. */
/**
* Force alignment to cache line.
*/
-#define __rte_cache_aligned __attribute__((__aligned__(CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
typedef uint64_t phys_addr_t; /**< Physical address definition. */
#define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
if (rte_eal_process_type() == RTE_PROC_PRIMARY){
eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
eth_drv->dev_private_size,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (eth_dev->data->dev_private == NULL)
rte_panic("Cannot allocate memzone for private port data\n");
}
if (dev->data->rx_queues == NULL) { /* first time configuration */
dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
sizeof(dev->data->rx_queues[0]) * nb_queues,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (dev->data->rx_queues == NULL) {
dev->data->nb_rx_queues = 0;
return -(ENOMEM);
for (i = nb_queues; i < old_nb_queues; i++)
(*dev->dev_ops->rx_queue_release)(rxq[i]);
rxq = rte_realloc(rxq, sizeof(rxq[0]) * nb_queues,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (rxq == NULL)
return -(ENOMEM);
if (dev->data->tx_queues == NULL) { /* first time configuration */
dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
sizeof(dev->data->tx_queues[0]) * nb_queues,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (dev->data->tx_queues == NULL) {
dev->data->nb_tx_queues = 0;
return -(ENOMEM);
for (i = nb_queues; i < old_nb_queues; i++)
(*dev->dev_ops->tx_queue_release)(txq[i]);
txq = rte_realloc(txq, sizeof(txq[0]) * nb_queues,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (txq == NULL)
return -(ENOMEM);
#include <sys/queue.h>
#include <rte_common.h>
-#include <rte_memory.h> /* for definition of CACHE_LINE_SIZE */
+#include <rte_memory.h> /* for definition of RTE_CACHE_LINE_SIZE */
#include <rte_log.h>
#include <rte_memcpy.h>
#include <rte_prefetch.h>
sizeof(hash_sig_t), SIG_BUCKET_ALIGNMENT);
key_size = align_size(params->key_len, KEY_ALIGNMENT);
- hash_tbl_size = align_size(sizeof(struct rte_hash), CACHE_LINE_SIZE);
+ hash_tbl_size = align_size(sizeof(struct rte_hash), RTE_CACHE_LINE_SIZE);
sig_tbl_size = align_size(num_buckets * sig_bucket_size,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
key_tbl_size = align_size(num_buckets * key_size *
- params->bucket_entries, CACHE_LINE_SIZE);
+ params->bucket_entries, RTE_CACHE_LINE_SIZE);
/* Total memory required for hash context */
mem_size = hash_tbl_size + sig_tbl_size + key_tbl_size;
}
h = (struct rte_hash *)rte_zmalloc_socket(hash_name, mem_size,
- CACHE_LINE_SIZE, params->socket_id);
+ RTE_CACHE_LINE_SIZE, params->socket_id);
if (h == NULL) {
RTE_LOG(ERR, HASH, "memory allocation failed\n");
rte_free(te);
}
sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]);
- if ((tbl = rte_zmalloc_socket(__func__, sz, CACHE_LINE_SIZE,
+ if ((tbl = rte_zmalloc_socket(__func__, sz, RTE_CACHE_LINE_SIZE,
socket_id)) == NULL) {
RTE_LOG(ERR, USER1,
"%s: allocation of %zu bytes at socket %d failed do\n",
#include <rte_log.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
-#include <rte_memory.h> /* for definition of CACHE_LINE_SIZE */
+#include <rte_memory.h> /* for definition of RTE_CACHE_LINE_SIZE */
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_tailq.h>
/* Allocate memory to store the LPM data structures. */
lpm = (struct rte_lpm *)rte_zmalloc_socket(mem_name, mem_size,
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
rte_free(te);
/* Allocate memory to store the LPM data structures. */
lpm = (struct rte_lpm6 *)rte_zmalloc_socket(mem_name, (size_t)mem_size,
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
}
lpm->rules_tbl = (struct rte_lpm6_rule *)rte_zmalloc_socket(NULL,
- (size_t)rules_size, CACHE_LINE_SIZE, socket_id);
+ (size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
if (lpm->rules_tbl == NULL) {
RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
#include "malloc_elem.h"
#include "malloc_heap.h"
-#define MIN_DATA_SIZE (CACHE_LINE_SIZE)
+#define MIN_DATA_SIZE (RTE_CACHE_LINE_SIZE)
/*
* initialise a general malloc_elem header structure
if (elem->size - new_size >= MIN_DATA_SIZE + MALLOC_ELEM_OVERHEAD){
/* now we have a big block together. Lets cut it down a bit, by splitting */
struct malloc_elem *split_pt = RTE_PTR_ADD(elem, new_size);
- split_pt = RTE_PTR_ALIGN_CEIL(split_pt, CACHE_LINE_SIZE);
+ split_pt = RTE_PTR_ALIGN_CEIL(split_pt, RTE_CACHE_LINE_SIZE);
split_elem(elem, split_pt);
malloc_elem_free_list_insert(split_pt);
}
#else
-static const unsigned MALLOC_ELEM_TRAILER_LEN = CACHE_LINE_SIZE;
+static const unsigned MALLOC_ELEM_TRAILER_LEN = RTE_CACHE_LINE_SIZE;
#define MALLOC_HEADER_COOKIE 0xbadbadbadadd2e55ULL /**< Header cookie. */
#define MALLOC_TRAILER_COOKIE 0xadd2e55badbadbadULL /**< Trailer cookie.*/
struct malloc_elem *start_elem = (struct malloc_elem *)mz->addr;
struct malloc_elem *end_elem = RTE_PTR_ADD(mz->addr,
mz_size - MALLOC_ELEM_OVERHEAD);
- end_elem = RTE_PTR_ALIGN_FLOOR(end_elem, CACHE_LINE_SIZE);
+ end_elem = RTE_PTR_ALIGN_FLOOR(end_elem, RTE_CACHE_LINE_SIZE);
const unsigned elem_size = (uintptr_t)end_elem - (uintptr_t)start_elem;
malloc_elem_init(start_elem, heap, mz, elem_size);
malloc_heap_alloc(struct malloc_heap *heap,
const char *type __attribute__((unused)), size_t size, unsigned align)
{
- size = CACHE_LINE_ROUNDUP(size);
- align = CACHE_LINE_ROUNDUP(align);
+ size = RTE_CACHE_LINE_ROUNDUP(size);
+ align = RTE_CACHE_LINE_ROUNDUP(align);
rte_spinlock_lock(&heap->lock);
struct malloc_elem *elem = find_suitable_element(heap, size, align);
if (elem == NULL){
if (elem == NULL)
rte_panic("Fatal error: memory corruption detected\n");
- size = CACHE_LINE_ROUNDUP(size), align = CACHE_LINE_ROUNDUP(align);
+ size = RTE_CACHE_LINE_ROUNDUP(size), align = RTE_CACHE_LINE_ROUNDUP(align);
/* check alignment matches first, and if ok, see if we can resize block */
if (RTE_PTR_ALIGN(ptr,align) == ptr &&
malloc_elem_resize(elem, size) == 0)
nrank = 1;
/* process new object size */
- new_obj_size = (obj_size + CACHE_LINE_MASK) / CACHE_LINE_SIZE;
+ new_obj_size = (obj_size + RTE_CACHE_LINE_MASK) / RTE_CACHE_LINE_SIZE;
while (get_gcd(new_obj_size, nrank * nchan) != 1)
new_obj_size++;
- return new_obj_size * CACHE_LINE_SIZE;
+ return new_obj_size * RTE_CACHE_LINE_SIZE;
}
static void
#endif
if ((flags & MEMPOOL_F_NO_CACHE_ALIGN) == 0)
sz->header_size = RTE_ALIGN_CEIL(sz->header_size,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
/* trailer contains the cookie in debug mode */
sz->trailer_size = 0;
if ((flags & MEMPOOL_F_NO_CACHE_ALIGN) == 0) {
sz->total_size = sz->header_size + sz->elt_size +
sz->trailer_size;
- sz->trailer_size += ((CACHE_LINE_SIZE -
- (sz->total_size & CACHE_LINE_MASK)) &
- CACHE_LINE_MASK);
+ sz->trailer_size += ((RTE_CACHE_LINE_SIZE -
+ (sz->total_size & RTE_CACHE_LINE_MASK)) &
+ RTE_CACHE_LINE_MASK);
}
/*
/* compilation-time checks */
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_cache) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, local_cache) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#endif
#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_mempool_debug_stats) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_mempool, stats) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#endif
/* check that we have an initialised tail queue */
* cache-aligned
*/
private_data_size = (private_data_size +
- CACHE_LINE_MASK) & (~CACHE_LINE_MASK);
+ RTE_CACHE_LINE_MASK) & (~RTE_CACHE_LINE_MASK);
if (! rte_eal_has_hugepages()) {
/*
*/
#define MEMPOOL_HEADER_SIZE(mp, pgn) (sizeof(*(mp)) + \
RTE_ALIGN_CEIL(((pgn) - RTE_DIM((mp)->elt_pa)) * \
- sizeof ((mp)->elt_pa[0]), CACHE_LINE_SIZE))
+ sizeof ((mp)->elt_pa[0]), RTE_CACHE_LINE_SIZE))
/**
* Returns TRUE if whole mempool is allocated in one contiguous block of memory.
/* Allocate memory for the pipeline on requested socket */
p = rte_zmalloc_socket("PIPELINE", sizeof(struct rte_pipeline),
- CACHE_LINE_SIZE, params->socket_id);
+ RTE_CACHE_LINE_SIZE, params->socket_id);
if (p == NULL) {
RTE_LOG(ERR, PIPELINE,
entry_size = sizeof(struct rte_pipeline_table_entry) +
params->action_data_size;
default_entry = (struct rte_pipeline_table_entry *) rte_zmalloc_socket(
- "PIPELINE", entry_size, CACHE_LINE_SIZE, p->socket_id);
+ "PIPELINE", entry_size, RTE_CACHE_LINE_SIZE, p->socket_id);
if (default_entry == NULL) {
RTE_LOG(ERR, PIPELINE,
"%s: Failed to allocate default entry\n", __func__);
#ifdef RTE_LIBRTE_XEN_DOM0
return rte_memzone_reserve_bounded(z_name, ring_size,
- socket_id, 0, CACHE_LINE_SIZE, RTE_PGSIZE_2M);
+ socket_id, 0, RTE_CACHE_LINE_SIZE, RTE_PGSIZE_2M);
#else
return rte_memzone_reserve(z_name, ring_size, socket_id, 0);
#endif
/* Allocate the tx queue data structure. */
if ((txq = rte_zmalloc("ethdev TX queue", sizeof(*txq),
- CACHE_LINE_SIZE)) == NULL)
+ RTE_CACHE_LINE_SIZE)) == NULL)
return (-ENOMEM);
/* Allocate software ring */
if ((txq->sw_ring = rte_zmalloc("txq->sw_ring",
sizeof(txq->sw_ring[0]) * nb_desc,
- CACHE_LINE_SIZE)) == NULL) {
+ RTE_CACHE_LINE_SIZE)) == NULL) {
em_tx_queue_release(txq);
return (-ENOMEM);
}
/* Allocate the RX queue data structure. */
if ((rxq = rte_zmalloc("ethdev RX queue", sizeof(*rxq),
- CACHE_LINE_SIZE)) == NULL)
+ RTE_CACHE_LINE_SIZE)) == NULL)
return (-ENOMEM);
/* Allocate software ring. */
if ((rxq->sw_ring = rte_zmalloc("rxq->sw_ring",
sizeof (rxq->sw_ring[0]) * nb_desc,
- CACHE_LINE_SIZE)) == NULL) {
+ RTE_CACHE_LINE_SIZE)) == NULL) {
em_rx_queue_release(rxq);
return (-ENOMEM);
}
/* First allocate the tx queue data structure */
txq = rte_zmalloc("ethdev TX queue", sizeof(struct igb_tx_queue),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (txq == NULL)
return (-ENOMEM);
/* Allocate software ring */
txq->sw_ring = rte_zmalloc("txq->sw_ring",
sizeof(struct igb_tx_entry) * nb_desc,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (txq->sw_ring == NULL) {
igb_tx_queue_release(txq);
return (-ENOMEM);
/* First allocate the RX queue data structure. */
rxq = rte_zmalloc("ethdev RX queue", sizeof(struct igb_rx_queue),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (rxq == NULL)
return (-ENOMEM);
rxq->mb_pool = mp;
/* Allocate software ring. */
rxq->sw_ring = rte_zmalloc("rxq->sw_ring",
sizeof(struct igb_rx_entry) * nb_desc,
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
if (rxq->sw_ring == NULL) {
igb_rx_queue_release(rxq);
return (-ENOMEM);
/* Allocate the rx queue data structure */
rxq = rte_zmalloc_socket("i40e rx queue",
sizeof(struct i40e_rx_queue),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
socket_id);
if (!rxq) {
PMD_DRV_LOG(ERR, "Failed to allocate memory for "
rxq->sw_ring =
rte_zmalloc_socket("i40e rx sw ring",
sizeof(struct i40e_rx_entry) * len,
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
socket_id);
if (!rxq->sw_ring) {
i40e_dev_rx_queue_release(rxq);
/* Allocate the TX queue data structure. */
txq = rte_zmalloc_socket("i40e tx queue",
sizeof(struct i40e_tx_queue),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
socket_id);
if (!txq) {
PMD_DRV_LOG(ERR, "Failed to allocate memory for "
txq->sw_ring =
rte_zmalloc_socket("i40e tx sw ring",
sizeof(struct i40e_tx_entry) * nb_desc,
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
socket_id);
if (!txq->sw_ring) {
i40e_dev_tx_queue_release(txq);
/* Allocate the TX queue data structure. */
txq = rte_zmalloc_socket("i40e fdir tx queue",
sizeof(struct i40e_tx_queue),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
if (!txq) {
PMD_DRV_LOG(ERR, "Failed to allocate memory for "
/* Allocate the RX queue data structure. */
rxq = rte_zmalloc_socket("i40e fdir rx queue",
sizeof(struct i40e_rx_queue),
- CACHE_LINE_SIZE,
+ RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
if (!rxq) {
PMD_DRV_LOG(ERR, "Failed to allocate memory for "
/* First allocate the tx queue data structure */
txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct igb_tx_queue),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (txq == NULL)
return (-ENOMEM);
/* Allocate software ring */
txq->sw_ring = rte_zmalloc_socket("txq->sw_ring",
sizeof(struct igb_tx_entry) * nb_desc,
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (txq->sw_ring == NULL) {
ixgbe_tx_queue_release(txq);
return (-ENOMEM);
/* First allocate the rx queue data structure */
rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct igb_rx_queue),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (rxq == NULL)
return (-ENOMEM);
rxq->mb_pool = mp;
#endif
rxq->sw_ring = rte_zmalloc_socket("rxq->sw_ring",
sizeof(struct igb_rx_entry) * len,
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (rxq->sw_ring == NULL) {
ixgbe_rx_queue_release(rxq);
return (-ENOMEM);
snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
dev->data->port_id, queue_idx);
vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
- vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
+ vq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);
} else if (queue_type == VTNET_TQ) {
snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d",
dev->data->port_id, queue_idx);
vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
- vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
+ vq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);
} else if (queue_type == VTNET_CQ) {
snprintf(vq_name, sizeof(vq_name), "port%d_cvq",
dev->data->port_id);
vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
vq_size * sizeof(struct vq_desc_extra),
- CACHE_LINE_SIZE);
+ RTE_CACHE_LINE_SIZE);
}
if (vq == NULL) {
PMD_INIT_LOG(ERR, "%s: Can not allocate virtqueue", __func__);
dev->data->port_id, queue_idx);
vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
vq_size * hw->vtnet_hdr_size,
- socket_id, 0, CACHE_LINE_SIZE);
+ socket_id, 0, RTE_CACHE_LINE_SIZE);
if (vq->virtio_net_hdr_mz == NULL) {
rte_free(vq);
return -ENOMEM;
snprintf(vq_name, sizeof(vq_name), "port%d_cvq_hdrzone",
dev->data->port_id);
vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
- PAGE_SIZE, socket_id, 0, CACHE_LINE_SIZE);
+ PAGE_SIZE, socket_id, 0, RTE_CACHE_LINE_SIZE);
if (vq->virtio_net_hdr_mz == NULL) {
rte_free(vq);
return -ENOMEM;
}
#define VIRTIO_MBUF_BURST_SZ 64
-#define DESC_PER_CACHELINE (CACHE_LINE_SIZE / sizeof(struct vring_desc))
+#define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))
uint16_t
virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
/* Allocate memory structure for UPT1_RSSConf and configure */
mz = gpa_zone_reserve(dev, sizeof(struct VMXNET3_RSSConf), "rss_conf",
- rte_socket_id(), CACHE_LINE_SIZE);
+ rte_socket_id(), RTE_CACHE_LINE_SIZE);
if (mz == NULL) {
PMD_INIT_LOG(ERR,
"ERROR: Creating rss_conf structure zone");
return -EINVAL;
}
- txq = rte_zmalloc("ethdev_tx_queue", sizeof(struct vmxnet3_tx_queue), CACHE_LINE_SIZE);
+ txq = rte_zmalloc("ethdev_tx_queue", sizeof(struct vmxnet3_tx_queue), RTE_CACHE_LINE_SIZE);
if (txq == NULL) {
PMD_INIT_LOG(ERR, "Can not allocate tx queue structure");
return -ENOMEM;
/* cmd_ring0 buf_info allocation */
ring->buf_info = rte_zmalloc("tx_ring_buf_info",
- ring->size * sizeof(vmxnet3_buf_info_t), CACHE_LINE_SIZE);
+ ring->size * sizeof(vmxnet3_buf_info_t), RTE_CACHE_LINE_SIZE);
if (ring->buf_info == NULL) {
PMD_INIT_LOG(ERR, "ERROR: Creating tx_buf_info structure");
return -ENOMEM;
return -EINVAL;
}
- rxq = rte_zmalloc("ethdev_rx_queue", sizeof(struct vmxnet3_rx_queue), CACHE_LINE_SIZE);
+ rxq = rte_zmalloc("ethdev_rx_queue", sizeof(struct vmxnet3_rx_queue), RTE_CACHE_LINE_SIZE);
if (rxq == NULL) {
PMD_INIT_LOG(ERR, "Can not allocate rx queue structure");
return -ENOMEM;
ring->rid = i;
snprintf(mem_name, sizeof(mem_name), "rx_ring_%d_buf_info", i);
- ring->buf_info = rte_zmalloc(mem_name, ring->size * sizeof(vmxnet3_buf_info_t), CACHE_LINE_SIZE);
+ ring->buf_info = rte_zmalloc(mem_name, ring->size * sizeof(vmxnet3_buf_info_t), RTE_CACHE_LINE_SIZE);
if (ring->buf_info == NULL) {
PMD_INIT_LOG(ERR, "ERROR: Creating rx_buf_info structure");
return -ENOMEM;
snprintf(vq_name, sizeof(vq_name), "port%d_rvq",
dev->data->port_id);
vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
- vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
+ vq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);
if (vq == NULL) {
RTE_LOG(ERR, PMD, "%s: unabled to allocate virtqueue\n", __func__);
return NULL;
snprintf(vq_name, sizeof(vq_name), "port%d_tvq",
dev->data->port_id);
vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
- vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
+ vq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);
if (vq == NULL) {
RTE_LOG(ERR, PMD, "%s: unabled to allocate virtqueue\n", __func__);
return NULL;
if (params == NULL)
return 0;
- args = rte_zmalloc(NULL, strlen(params) + 1, CACHE_LINE_SIZE);
+ args = rte_zmalloc(NULL, strlen(params) + 1, RTE_CACHE_LINE_SIZE);
if (args == NULL) {
RTE_LOG(ERR, PMD, "Couldn't parse %s device \n", name);
return -1;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
}
/* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port), CACHE_LINE_SIZE,
+ port = rte_zmalloc_socket("PORT", sizeof(*port), RTE_CACHE_LINE_SIZE,
socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: port is NULL\n", __func__);
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate socket\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
/* Memory allocation */
port = rte_zmalloc_socket("PORT", sizeof(*port),
- CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE, socket_id);
if (port == NULL) {
RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__);
return NULL;
}
sz = sizeof(struct rte_ring) + count * sizeof(void *);
- sz = RTE_ALIGN(sz, CACHE_LINE_SIZE);
+ sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
return sz;
}
{
/* compilation-time checks */
RTE_BUILD_BUG_ON((sizeof(struct rte_ring) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#ifdef RTE_RING_SPLIT_PROD_CONS
RTE_BUILD_BUG_ON((offsetof(struct rte_ring, cons) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#endif
RTE_BUILD_BUG_ON((offsetof(struct rte_ring, prod) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#ifdef RTE_LIBRTE_RING_DEBUG
RTE_BUILD_BUG_ON((sizeof(struct rte_ring_debug_stats) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
RTE_BUILD_BUG_ON((offsetof(struct rte_ring, stats) &
- CACHE_LINE_MASK) != 0);
+ RTE_CACHE_LINE_MASK) != 0);
#endif
/* init the ring structure */
#define RTE_BITMAP_SLAB_BIT_MASK (RTE_BITMAP_SLAB_BIT_SIZE - 1)
/* Cache line (CL) */
-#define RTE_BITMAP_CL_BIT_SIZE (CACHE_LINE_SIZE * 8)
+#define RTE_BITMAP_CL_BIT_SIZE (RTE_CACHE_LINE_SIZE * 8)
#define RTE_BITMAP_CL_BIT_SIZE_LOG2 9
#define RTE_BITMAP_CL_BIT_MASK (RTE_BITMAP_CL_BIT_SIZE - 1)
n_slabs_array1 = rte_align32pow2(n_slabs_array1);
n_slabs_context = (sizeof(struct rte_bitmap) + (RTE_BITMAP_SLAB_BIT_SIZE / 8) - 1) / (RTE_BITMAP_SLAB_BIT_SIZE / 8);
n_cache_lines_context_and_array1 = (n_slabs_context + n_slabs_array1 + RTE_BITMAP_CL_SLAB_SIZE - 1) / RTE_BITMAP_CL_SLAB_SIZE;
- n_bytes_total = (n_cache_lines_context_and_array1 + n_cache_lines_array2) * CACHE_LINE_SIZE;
+ n_bytes_total = (n_cache_lines_context_and_array1 + n_cache_lines_array2) * RTE_CACHE_LINE_SIZE;
if (array1_byte_offset) {
*array1_byte_offset = n_slabs_context * (RTE_BITMAP_SLAB_BIT_SIZE / 8);
*array1_slabs = n_slabs_array1;
}
if (array2_byte_offset) {
- *array2_byte_offset = n_cache_lines_context_and_array1 * CACHE_LINE_SIZE;
+ *array2_byte_offset = n_cache_lines_context_and_array1 * RTE_CACHE_LINE_SIZE;
}
if (array2_slabs) {
*array2_slabs = n_cache_lines_array2 * RTE_BITMAP_CL_SLAB_SIZE;
return NULL;
}
- if ((mem == NULL) || (((uintptr_t) mem) & CACHE_LINE_MASK)) {
+ if ((mem == NULL) || (((uintptr_t) mem) & RTE_CACHE_LINE_MASK)) {
return NULL;
}
base = 0;
if (array == e_RTE_SCHED_PORT_ARRAY_SUBPORT) return base;
- base += CACHE_LINE_ROUNDUP(size_subport);
+ base += RTE_CACHE_LINE_ROUNDUP(size_subport);
if (array == e_RTE_SCHED_PORT_ARRAY_PIPE) return base;
- base += CACHE_LINE_ROUNDUP(size_pipe);
+ base += RTE_CACHE_LINE_ROUNDUP(size_pipe);
if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE) return base;
- base += CACHE_LINE_ROUNDUP(size_queue);
+ base += RTE_CACHE_LINE_ROUNDUP(size_queue);
if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE_EXTRA) return base;
- base += CACHE_LINE_ROUNDUP(size_queue_extra);
+ base += RTE_CACHE_LINE_ROUNDUP(size_queue_extra);
if (array == e_RTE_SCHED_PORT_ARRAY_PIPE_PROFILES) return base;
- base += CACHE_LINE_ROUNDUP(size_pipe_profiles);
+ base += RTE_CACHE_LINE_ROUNDUP(size_pipe_profiles);
if (array == e_RTE_SCHED_PORT_ARRAY_BMP_ARRAY) return base;
- base += CACHE_LINE_ROUNDUP(size_bmp_array);
+ base += RTE_CACHE_LINE_ROUNDUP(size_bmp_array);
if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE_ARRAY) return base;
- base += CACHE_LINE_ROUNDUP(size_queue_array);
+ base += RTE_CACHE_LINE_ROUNDUP(size_queue_array);
return base;
}
}
/* Allocate memory to store the data structures */
- port = rte_zmalloc("qos_params", mem_size, CACHE_LINE_SIZE);
+ port = rte_zmalloc("qos_params", mem_size, RTE_CACHE_LINE_SIZE);
if (port == NULL) {
return NULL;
}
uint32_t action_table_size, acl_rule_list_size, acl_rule_memory_size;
uint32_t total_size;
- RTE_BUILD_BUG_ON(((sizeof(struct rte_table_acl) % CACHE_LINE_SIZE)
+ RTE_BUILD_BUG_ON(((sizeof(struct rte_table_acl) % RTE_CACHE_LINE_SIZE)
!= 0));
/* Check input parameters */
entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t));
/* Memory allocation */
- action_table_size = CACHE_LINE_ROUNDUP(p->n_rules * entry_size);
+ action_table_size = RTE_CACHE_LINE_ROUNDUP(p->n_rules * entry_size);
acl_rule_list_size =
- CACHE_LINE_ROUNDUP(p->n_rules * sizeof(struct rte_acl_rule *));
- acl_rule_memory_size = CACHE_LINE_ROUNDUP(p->n_rules *
+ RTE_CACHE_LINE_ROUNDUP(p->n_rules * sizeof(struct rte_acl_rule *));
+ acl_rule_memory_size = RTE_CACHE_LINE_ROUNDUP(p->n_rules *
RTE_ACL_RULE_SZ(p->n_rule_fields));
total_size = sizeof(struct rte_table_acl) + action_table_size +
acl_rule_list_size + acl_rule_memory_size;
- acl = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE,
+ acl = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE,
socket_id);
if (acl == NULL) {
RTE_LOG(ERR, TABLE,
/* Memory allocation */
total_cl_size = (sizeof(struct rte_table_array) +
- CACHE_LINE_SIZE) / CACHE_LINE_SIZE;
+ RTE_CACHE_LINE_SIZE) / RTE_CACHE_LINE_SIZE;
total_cl_size += (p->n_entries * entry_size +
- CACHE_LINE_SIZE) / CACHE_LINE_SIZE;
- total_size = total_cl_size * CACHE_LINE_SIZE;
- t = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE) / RTE_CACHE_LINE_SIZE;
+ total_size = total_cl_size * RTE_CACHE_LINE_SIZE;
+ t = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (t == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for array table\n",
/* Check input parameters */
if ((check_params_create(p) != 0) ||
(!rte_is_power_of_2(entry_size)) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- (sizeof(struct bucket) != (CACHE_LINE_SIZE / 2)))
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ (sizeof(struct bucket) != (RTE_CACHE_LINE_SIZE / 2)))
return NULL;
/* Memory allocation */
- table_meta_sz = CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash));
- bucket_sz = CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket));
+ table_meta_sz = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash));
+ bucket_sz = RTE_CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket));
bucket_ext_sz =
- CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(struct bucket));
- key_sz = CACHE_LINE_ROUNDUP(p->n_keys * p->key_size);
- key_stack_sz = CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t));
+ RTE_CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(struct bucket));
+ key_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * p->key_size);
+ key_stack_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t));
bkt_ext_stack_sz =
- CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(uint32_t));
- data_sz = CACHE_LINE_ROUNDUP(p->n_keys * entry_size);
+ RTE_CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(uint32_t));
+ data_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * entry_size);
total_size = table_meta_sz + bucket_sz + bucket_ext_sz + key_sz +
key_stack_sz + bkt_ext_stack_sz + data_sz;
- t = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ t = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (t == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_16) % CACHE_LINE_SIZE) != 0))
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_16) % RTE_CACHE_LINE_SIZE) != 0))
return NULL;
n_entries_per_bucket = 4;
key_size = 16;
n_buckets = rte_align32pow2((p->n_entries + n_entries_per_bucket - 1) /
n_entries_per_bucket);
bucket_size_cl = (sizeof(struct rte_bucket_4_16) + n_entries_per_bucket
- * entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
+ * entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) + n_buckets *
- bucket_size_cl * CACHE_LINE_SIZE;
+ bucket_size_cl * RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_16) % CACHE_LINE_SIZE) != 0))
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_16) % RTE_CACHE_LINE_SIZE) != 0))
return NULL;
n_entries_per_bucket = 4;
n_buckets_ext = (p->n_entries_ext + n_entries_per_bucket - 1) /
n_entries_per_bucket;
bucket_size_cl = (sizeof(struct rte_bucket_4_16) + n_entries_per_bucket
- * entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
- stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + CACHE_LINE_SIZE - 1)
- / CACHE_LINE_SIZE;
+ * entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
+ stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + RTE_CACHE_LINE_SIZE - 1)
+ / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) +
((n_buckets + n_buckets_ext) * bucket_size_cl + stack_size_cl) *
- CACHE_LINE_SIZE;
+ RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
bucket1 = (struct rte_bucket_4_16 *) \
&f->memory[bucket_index * f->bucket_size]; \
rte_prefetch0(bucket1); \
- rte_prefetch0((void *)(((uintptr_t) bucket1) + CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\
}
#define lookup1_stage2_lru(pkt2_index, mbuf2, bucket2, \
buckets_mask |= bucket_mask; \
bucket_next = bucket->next; \
rte_prefetch0(bucket_next); \
- rte_prefetch0((void *)(((uintptr_t) bucket_next) + CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket_next) + RTE_CACHE_LINE_SIZE));\
buckets[pkt_index] = bucket_next; \
keys[pkt_index] = key; \
}
bucket10 = (struct rte_bucket_4_16 *) \
&f->memory[bucket10_index * f->bucket_size]; \
rte_prefetch0(bucket10); \
- rte_prefetch0((void *)(((uintptr_t) bucket10) + CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket10) + RTE_CACHE_LINE_SIZE));\
\
signature11 = RTE_MBUF_METADATA_UINT32(mbuf11, f->signature_offset);\
bucket11_index = signature11 & (f->n_buckets - 1); \
bucket11 = (struct rte_bucket_4_16 *) \
&f->memory[bucket11_index * f->bucket_size]; \
rte_prefetch0(bucket11); \
- rte_prefetch0((void *)(((uintptr_t) bucket11) + CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket11) + RTE_CACHE_LINE_SIZE));\
}
#define lookup2_stage2_lru(pkt20_index, pkt21_index, mbuf20, mbuf21,\
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_32) % CACHE_LINE_SIZE) != 0)) {
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_32) % RTE_CACHE_LINE_SIZE) != 0)) {
return NULL;
}
n_entries_per_bucket = 4;
n_buckets = rte_align32pow2((p->n_entries + n_entries_per_bucket - 1) /
n_entries_per_bucket);
bucket_size_cl = (sizeof(struct rte_bucket_4_32) + n_entries_per_bucket
- * entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
+ * entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) + n_buckets *
- bucket_size_cl * CACHE_LINE_SIZE;
+ bucket_size_cl * RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_32) % CACHE_LINE_SIZE) != 0))
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_32) % RTE_CACHE_LINE_SIZE) != 0))
return NULL;
n_entries_per_bucket = 4;
n_buckets_ext = (p->n_entries_ext + n_entries_per_bucket - 1) /
n_entries_per_bucket;
bucket_size_cl = (sizeof(struct rte_bucket_4_32) + n_entries_per_bucket
- * entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
- stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + CACHE_LINE_SIZE - 1)
- / CACHE_LINE_SIZE;
+ * entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
+ stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + RTE_CACHE_LINE_SIZE - 1)
+ / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) +
((n_buckets + n_buckets_ext) * bucket_size_cl + stack_size_cl) *
- CACHE_LINE_SIZE;
+ RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
bucket1 = (struct rte_bucket_4_32 *) \
&f->memory[bucket_index * f->bucket_size]; \
rte_prefetch0(bucket1); \
- rte_prefetch0((void *)(((uintptr_t) bucket1) + CACHE_LINE_SIZE));\
- rte_prefetch0((void *)(((uintptr_t) bucket1) + 2 * CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket1) + 2 * RTE_CACHE_LINE_SIZE));\
}
#define lookup1_stage2_lru(pkt2_index, mbuf2, bucket2, \
buckets_mask |= bucket_mask; \
bucket_next = bucket->next; \
rte_prefetch0(bucket_next); \
- rte_prefetch0((void *)(((uintptr_t) bucket_next) + CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket_next) + RTE_CACHE_LINE_SIZE));\
rte_prefetch0((void *)(((uintptr_t) bucket_next) + \
- 2 * CACHE_LINE_SIZE)); \
+ 2 * RTE_CACHE_LINE_SIZE)); \
buckets[pkt_index] = bucket_next; \
keys[pkt_index] = key; \
}
bucket10 = (struct rte_bucket_4_32 *) \
&f->memory[bucket10_index * f->bucket_size]; \
rte_prefetch0(bucket10); \
- rte_prefetch0((void *)(((uintptr_t) bucket10) + CACHE_LINE_SIZE));\
- rte_prefetch0((void *)(((uintptr_t) bucket10) + 2 * CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket10) + RTE_CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket10) + 2 * RTE_CACHE_LINE_SIZE));\
\
signature11 = RTE_MBUF_METADATA_UINT32(mbuf11, f->signature_offset);\
bucket11_index = signature11 & (f->n_buckets - 1); \
bucket11 = (struct rte_bucket_4_32 *) \
&f->memory[bucket11_index * f->bucket_size]; \
rte_prefetch0(bucket11); \
- rte_prefetch0((void *)(((uintptr_t) bucket11) + CACHE_LINE_SIZE));\
- rte_prefetch0((void *)(((uintptr_t) bucket11) + 2 * CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket11) + RTE_CACHE_LINE_SIZE));\
+ rte_prefetch0((void *)(((uintptr_t) bucket11) + 2 * RTE_CACHE_LINE_SIZE));\
}
#define lookup2_stage2_lru(pkt20_index, pkt21_index, mbuf20, mbuf21,\
/* Check input parameters */
if ((check_params_create_lru(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_8) % CACHE_LINE_SIZE) != 0)) {
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_8) % RTE_CACHE_LINE_SIZE) != 0)) {
return NULL;
}
n_entries_per_bucket = 4;
n_buckets = rte_align32pow2((p->n_entries + n_entries_per_bucket - 1) /
n_entries_per_bucket);
bucket_size_cl = (sizeof(struct rte_bucket_4_8) + n_entries_per_bucket *
- entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
+ entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) + n_buckets *
- bucket_size_cl * CACHE_LINE_SIZE;
+ bucket_size_cl * RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
/* Check input parameters */
if ((check_params_create_ext(p) != 0) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- ((sizeof(struct rte_bucket_4_8) % CACHE_LINE_SIZE) != 0))
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ ((sizeof(struct rte_bucket_4_8) % RTE_CACHE_LINE_SIZE) != 0))
return NULL;
n_entries_per_bucket = 4;
n_buckets_ext = (p->n_entries_ext + n_entries_per_bucket - 1) /
n_entries_per_bucket;
bucket_size_cl = (sizeof(struct rte_bucket_4_8) + n_entries_per_bucket *
- entry_size + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE;
- stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + CACHE_LINE_SIZE - 1)
- / CACHE_LINE_SIZE;
+ entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;
+ stack_size_cl = (n_buckets_ext * sizeof(uint32_t) + RTE_CACHE_LINE_SIZE - 1)
+ / RTE_CACHE_LINE_SIZE;
total_size = sizeof(struct rte_table_hash) + ((n_buckets +
n_buckets_ext) * bucket_size_cl + stack_size_cl) *
- CACHE_LINE_SIZE;
+ RTE_CACHE_LINE_SIZE;
- f = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ f = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (f == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
f->n_entries_per_bucket = n_entries_per_bucket;
f->key_size = key_size;
f->entry_size = entry_size;
- f->bucket_size = bucket_size_cl * CACHE_LINE_SIZE;
+ f->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;
f->signature_offset = p->signature_offset;
f->key_offset = p->key_offset;
f->f_hash = p->f_hash;
/* Check input parameters */
if ((check_params_create(p) != 0) ||
(!rte_is_power_of_2(entry_size)) ||
- ((sizeof(struct rte_table_hash) % CACHE_LINE_SIZE) != 0) ||
- (sizeof(struct bucket) != (CACHE_LINE_SIZE / 2))) {
+ ((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||
+ (sizeof(struct bucket) != (RTE_CACHE_LINE_SIZE / 2))) {
return NULL;
}
/* Memory allocation */
- table_meta_sz = CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash));
- bucket_sz = CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket));
- key_sz = CACHE_LINE_ROUNDUP(p->n_keys * p->key_size);
- key_stack_sz = CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t));
- data_sz = CACHE_LINE_ROUNDUP(p->n_keys * entry_size);
+ table_meta_sz = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash));
+ bucket_sz = RTE_CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket));
+ key_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * p->key_size);
+ key_stack_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t));
+ data_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * entry_size);
total_size = table_meta_sz + bucket_sz + key_sz + key_stack_sz +
data_sz;
- t = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE, socket_id);
+ t = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE, socket_id);
if (t == NULL) {
RTE_LOG(ERR, TABLE,
"%s: Cannot allocate %u bytes for hash table\n",
/* Memory allocation */
nht_size = RTE_TABLE_LPM_MAX_NEXT_HOPS * entry_size;
total_size = sizeof(struct rte_table_lpm) + nht_size;
- lpm = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE,
+ lpm = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE,
socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, TABLE,
/* Memory allocation */
nht_size = RTE_TABLE_LPM_MAX_NEXT_HOPS * entry_size;
total_size = sizeof(struct rte_table_lpm_ipv6) + nht_size;
- lpm = rte_zmalloc_socket("TABLE", total_size, CACHE_LINE_SIZE,
+ lpm = rte_zmalloc_socket("TABLE", total_size, RTE_CACHE_LINE_SIZE,
socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, TABLE,
ARCH ?= powerpc
CROSS ?=
-CPU_CFLAGS ?= -m64 -DCACHE_LINE_SIZE=128
+CPU_CFLAGS ?= -m64 -DRTE_CACHE_LINE_SIZE=128
CPU_LDFLAGS ?=
CPU_ASFLAGS ?= -felf64