diff options
author | Jerin Jacob <jerinj@marvell.com> | 2020-07-29 22:26:31 +0530 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2020-08-25 10:55:49 +0300 |
commit | accc89eb28992d77d6ad46e65a3154b4221d0b0d (patch) | |
tree | 5ac5d44c9027ac22afe20192b5b020cfd8b1dc98 /helper | |
parent | 1ac7d066f6c5b0687af771721c51da620a90230a (diff) |
validation: pool: honor max_align capability
Honor the odp_pool_capability_t::buf.max_align attribute while
creating the pool.
Some implementation chooses to optimize odp_buffer_t handling in
such a way that implementation-specific metadata and actual
data can be in the same cache-line as a performance optimization
while accessing the odp_buffer_t.
As a fix, except helpers, let the application uses the default
alignment from odp_pool_param_init().
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/cuckootable.c | 3 | ||||
-rw-r--r-- | helper/iplookuptable.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 47dd90b6c..49b8a5c86 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -269,7 +269,8 @@ odph_cuckoo_table_create( odp_pool_param_init(¶m); param.type = ODP_POOL_BUFFER; param.buf.size = kv_entry_size; - param.buf.align = ODP_CACHE_LINE_SIZE; + if (pcapa.buf.max_align >= ODP_CACHE_LINE_SIZE) + param.buf.align = ODP_CACHE_LINE_SIZE; param.buf.num = capacity; pool = odp_pool_create(pool_name, ¶m); diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c index eacfcf5f8..c514ee362 100644 --- a/helper/iplookuptable.c +++ b/helper/iplookuptable.c @@ -216,7 +216,8 @@ cache_alloc_new_pool( /* Create new pool (new free buffers). */ odp_pool_param_init(¶m); param.type = ODP_POOL_BUFFER; - param.buf.align = ODP_CACHE_LINE_SIZE; + if (pool_capa.buf.max_align >= ODP_CACHE_LINE_SIZE) + param.buf.align = ODP_CACHE_LINE_SIZE; if (type == CACHE_TYPE_SUBTREE) { num = CACHE_NUM_SUBTREE; size = ENTRY_SIZE * ENTRY_NUM_SUBTREE; |