acl: move SSE dwords shuffle
[dpdk.git] / lib / librte_table / rte_table_hash_key8.c
index d60c96e..443ca7d 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <rte_common.h>
 #include <rte_mbuf.h>
+#include <rte_memory.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 
@@ -118,8 +119,8 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, uint32_t entry_size)
 
        /* 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;
@@ -129,11 +130,11 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, uint32_t entry_size)
        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",
@@ -149,7 +150,7 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, uint32_t entry_size)
        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;
@@ -332,8 +333,8 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, uint32_t entry_size)
 
        /* 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;
@@ -345,14 +346,14 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, uint32_t entry_size)
        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",
@@ -368,7 +369,7 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, uint32_t entry_size)
        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;
@@ -1104,8 +1105,7 @@ rte_table_hash_lookup_key8_ext(
                                keys, f);
                }
 
-               *lookup_hit_mask = pkts_mask_out;
-               return 0;
+               goto grind_next_buckets;
        }
 
        /*
@@ -1196,6 +1196,7 @@ rte_table_hash_lookup_key8_ext(
                bucket20, bucket21, pkts_mask_out, entries,
                buckets_mask, buckets, keys, f);
 
+grind_next_buckets:
        /* Grind next buckets */
        for ( ; buckets_mask; ) {
                uint64_t buckets_mask_next = 0;
@@ -1250,8 +1251,7 @@ rte_table_hash_lookup_key8_ext_dosig(
                                buckets, keys, f);
                }
 
-               *lookup_hit_mask = pkts_mask_out;
-               return 0;
+               goto grind_next_buckets;
        }
 
        /*
@@ -1342,6 +1342,7 @@ rte_table_hash_lookup_key8_ext_dosig(
                bucket20, bucket21, pkts_mask_out, entries,
                buckets_mask, buckets, keys, f);
 
+grind_next_buckets:
        /* Grind next buckets */
        for ( ; buckets_mask; ) {
                uint64_t buckets_mask_next = 0;