diff options
author | Damjan Marion <damarion@cisco.com> | 2021-12-23 13:19:15 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-12-24 23:18:15 +0000 |
commit | 9ff617c1ac83c9e4a376959afdac6ae1e3981671 (patch) | |
tree | 5ad1a9c5930c4a6515dab8cb283a3b7dddf7565d /src/vnet | |
parent | b32bd70c1e83fff90d060ea1bbb41eb55e3f62b1 (diff) |
ip: remove archaic vector code from mtrie
Type: improvement
Change-Id: Ib39478a2e6991d721c4ba3ea61c97bfb07238016
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/ip/ip4_mtrie.c | 76 | ||||
-rw-r--r-- | src/vnet/ip/ip4_mtrie.h | 22 |
2 files changed, 12 insertions, 86 deletions
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c index 0f4c47fe11a..e61b4aa577b 100644 --- a/src/vnet/ip/ip4_mtrie.c +++ b/src/vnet/ip/ip4_mtrie.c @@ -91,82 +91,24 @@ ip4_mtrie_leaf_set_next_ply_index (u32 i) return l; } -#ifndef __ALTIVEC__ -#define PLY_X4_SPLAT_INIT(init_x4, init) \ - init_x4 = u32x4_splat (init); -#else -#define PLY_X4_SPLAT_INIT(init_x4, init) \ -{ \ - u32x4_union_t y; \ - y.as_u32[0] = init; \ - y.as_u32[1] = init; \ - y.as_u32[2] = init; \ - y.as_u32[3] = init; \ - init_x4 = y.as_u32x4; \ -} -#endif - -#ifdef CLIB_HAVE_VEC128 -#define PLY_INIT_LEAVES(p) \ -{ \ - u32x4 *l, init_x4; \ - \ - PLY_X4_SPLAT_INIT(init_x4, init); \ - for (l = p->leaves_as_u32x4; \ - l < p->leaves_as_u32x4 + ARRAY_LEN (p->leaves_as_u32x4); \ - l += 4) \ - { \ - l[0] = init_x4; \ - l[1] = init_x4; \ - l[2] = init_x4; \ - l[3] = init_x4; \ - } \ -} -#else -#define PLY_INIT_LEAVES(p) \ -{ \ - u32 *l; \ - \ - for (l = p->leaves; l < p->leaves + ARRAY_LEN (p->leaves); l += 4) \ - { \ - l[0] = init; \ - l[1] = init; \ - l[2] = init; \ - l[3] = init; \ - } \ -} -#endif - -#define PLY_INIT(p, init, prefix_len, ply_base_len) \ -{ \ - /* \ - * A leaf is 'empty' if it represents a leaf from the covering PLY \ - * i.e. if the prefix length of the leaf is less than or equal to \ - * the prefix length of the PLY \ - */ \ - p->n_non_empty_leafs = (prefix_len > ply_base_len ? \ - ARRAY_LEN (p->leaves) : 0); \ - clib_memset (p->dst_address_bits_of_leaves, prefix_len, \ - sizeof (p->dst_address_bits_of_leaves)); \ - p->dst_address_bits_base = ply_base_len; \ - \ - /* Initialize leaves. */ \ - PLY_INIT_LEAVES(p); \ -} - static void ply_8_init (ip4_mtrie_8_ply_t *p, ip4_mtrie_leaf_t init, uword prefix_len, u32 ply_base_len) { - PLY_INIT (p, init, prefix_len, ply_base_len); + p->n_non_empty_leafs = prefix_len > ply_base_len ? ARRAY_LEN (p->leaves) : 0; + clib_memset_u8 (p->dst_address_bits_of_leaves, prefix_len, + sizeof (p->dst_address_bits_of_leaves)); + p->dst_address_bits_base = ply_base_len; + + clib_memset_u32 (p->leaves, init, ARRAY_LEN (p->leaves)); } static void ply_16_init (ip4_mtrie_16_ply_t *p, ip4_mtrie_leaf_t init, uword prefix_len) { - clib_memset (p->dst_address_bits_of_leaves, prefix_len, - sizeof (p->dst_address_bits_of_leaves)); - PLY_INIT_LEAVES (p); + clib_memset_u8 (p->dst_address_bits_of_leaves, prefix_len, + sizeof (p->dst_address_bits_of_leaves)); + clib_memset_u32 (p->leaves, init, ARRAY_LEN (p->leaves)); } static ip4_mtrie_leaf_t diff --git a/src/vnet/ip/ip4_mtrie.h b/src/vnet/ip/ip4_mtrie.h index ec417c9a9f7..16c524745be 100644 --- a/src/vnet/ip/ip4_mtrie.h +++ b/src/vnet/ip/ip4_mtrie.h @@ -65,14 +65,7 @@ typedef struct ip4_mtrie_16_ply_t_ /** * The leaves/slots/buckets to be filed with leafs */ - union - { - ip4_mtrie_leaf_t leaves[PLY_16_SIZE]; - -#ifdef CLIB_HAVE_VEC128 - u32x4 leaves_as_u32x4[PLY_16_SIZE / 4]; -#endif - }; + ip4_mtrie_leaf_t leaves[PLY_16_SIZE]; /** * Prefix length for terminal leaves. @@ -85,17 +78,11 @@ typedef struct ip4_mtrie_16_ply_t_ */ typedef struct ip4_mtrie_8_ply_t_ { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); /** * The leaves/slots/buckets to be filed with leafs */ - union - { - ip4_mtrie_leaf_t leaves[256]; - -#ifdef CLIB_HAVE_VEC128 - u32x4 leaves_as_u32x4[256 / 4]; -#endif - }; + ip4_mtrie_leaf_t leaves[256]; /** * Prefix length for leaves/ply. @@ -113,9 +100,6 @@ typedef struct ip4_mtrie_8_ply_t_ * 'non-empty'. Otherwise it is the value of the cover. */ i32 dst_address_bits_base; - - /* Pad to cache line boundary. */ - u8 pad[CLIB_CACHE_LINE_BYTES - 2 * sizeof (i32)]; } ip4_mtrie_8_ply_t; STATIC_ASSERT (0 == sizeof (ip4_mtrie_8_ply_t) % CLIB_CACHE_LINE_BYTES, |