table: remove deprecated variable size key lru hash tables
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>
Wed, 18 Oct 2017 15:03:41 +0000 (16:03 +0100)
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>
Tue, 24 Oct 2017 11:07:04 +0000 (13:07 +0200)
The non-dosig version of the variable size key Least Recently Used
(LRU) hash tables are removed. The remaining hash tables are renamed
to eliminate the dosig particle from their name.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/librte_table/rte_table_hash.h
lib/librte_table/rte_table_hash_lru.c
test/test-pipeline/pipeline_hash.c

index 0eb23a7..f983518 100644 (file)
@@ -163,12 +163,8 @@ struct rte_table_hash_lru_params {
        uint32_t key_offset;
 };
 
-/** LRU hash table operations for pre-computed key signature */
 extern struct rte_table_ops rte_table_hash_lru_ops;
 
-/** LRU hash table operations for key signature computed on lookup ("do-sig") */
-extern struct rte_table_ops rte_table_hash_lru_dosig_ops;
-
 /**
  * 8-byte key hash tables
  *
index 5a4864e..0a85123 100644 (file)
@@ -365,8 +365,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
        struct rte_mbuf **pkts,
        uint64_t pkts_mask,
        uint64_t *lookup_hit_mask,
-       void **entries,
-       int dosig)
+       void **entries)
 {
        struct rte_table_hash *t = (struct rte_table_hash *) table;
        uint64_t pkts_mask_out = 0;
@@ -387,11 +386,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
 
                pkt = pkts[pkt_index];
                key = RTE_MBUF_METADATA_UINT8_PTR(pkt, t->key_offset);
-               if (dosig)
-                       sig = (uint64_t) t->f_hash(key, t->key_size, t->seed);
-               else
-                       sig = RTE_MBUF_METADATA_UINT32(pkt,
-                               t->signature_offset);
+               sig = (uint64_t) t->f_hash(key, t->key_size, t->seed);
 
                bkt_index = sig & t->bucket_mask;
                bkt = &t->buckets[bkt_index];
@@ -616,38 +611,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
        rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf01, key_offset));\
 }
 
-#define lookup2_stage1(t, g, pkts, pkt10_index, pkt11_index)   \
-{                                                              \
-       struct grinder *g10, *g11;                              \
-       uint64_t sig10, sig11, bkt10_index, bkt11_index;        \
-       struct rte_mbuf *mbuf10, *mbuf11;                       \
-       struct bucket *bkt10, *bkt11, *buckets = t->buckets;    \
-       uint64_t bucket_mask = t->bucket_mask;                  \
-       uint32_t signature_offset = t->signature_offset;        \
-                                                               \
-       mbuf10 = pkts[pkt10_index];                             \
-       sig10 = (uint64_t) RTE_MBUF_METADATA_UINT32(mbuf10, signature_offset);\
-       bkt10_index = sig10 & bucket_mask;                      \
-       bkt10 = &buckets[bkt10_index];                          \
-                                                               \
-       mbuf11 = pkts[pkt11_index];                             \
-       sig11 = (uint64_t) RTE_MBUF_METADATA_UINT32(mbuf11, signature_offset);\
-       bkt11_index = sig11 & bucket_mask;                      \
-       bkt11 = &buckets[bkt11_index];                          \
-                                                               \
-       rte_prefetch0(bkt10);                                   \
-       rte_prefetch0(bkt11);                                   \
-                                                               \
-       g10 = &g[pkt10_index];                                  \
-       g10->sig = sig10;                                       \
-       g10->bkt = bkt10;                                       \
-                                                               \
-       g11 = &g[pkt11_index];                                  \
-       g11->sig = sig11;                                       \
-       g11->bkt = bkt11;                                       \
-}
-
-#define lookup2_stage1_dosig(t, g, pkts, pkt10_index, pkt11_index)\
+#define lookup2_stage1(t, g, pkts, pkt10_index, pkt11_index)\
 {                                                              \
        struct grinder *g10, *g11;                              \
        uint64_t sig10, sig11, bkt10_index, bkt11_index;        \
@@ -819,7 +783,7 @@ static int rte_table_hash_lru_lookup(
        /* Cannot run the pipeline with less than 7 packets */
        if (__builtin_popcountll(pkts_mask) < 7)
                return rte_table_hash_lru_lookup_unoptimized(table, pkts,
-                       pkts_mask, lookup_hit_mask, entries, 0);
+                       pkts_mask, lookup_hit_mask, entries);
 
        /* Pipeline stage 0 */
        lookup2_stage0(t, g, pkts, pkts_mask, pkt00_index, pkt01_index);
@@ -923,140 +887,7 @@ static int rte_table_hash_lru_lookup(
                uint64_t pkts_mask_out_slow = 0;
 
                status = rte_table_hash_lru_lookup_unoptimized(table, pkts,
-                       pkts_mask_match_many, &pkts_mask_out_slow, entries, 0);
-               pkts_mask_out |= pkts_mask_out_slow;
-       }
-
-       *lookup_hit_mask = pkts_mask_out;
-       RTE_TABLE_HASH_LRU_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out));
-       return status;
-}
-
-static int rte_table_hash_lru_lookup_dosig(
-       void *table,
-       struct rte_mbuf **pkts,
-       uint64_t pkts_mask,
-       uint64_t *lookup_hit_mask,
-       void **entries)
-{
-       struct rte_table_hash *t = (struct rte_table_hash *) table;
-       struct grinder *g = t->grinders;
-       uint64_t pkt00_index, pkt01_index, pkt10_index, pkt11_index;
-       uint64_t pkt20_index, pkt21_index, pkt30_index, pkt31_index;
-       uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0;
-       int status = 0;
-
-       __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
-       RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
-
-       /* Cannot run the pipeline with less than 7 packets */
-       if (__builtin_popcountll(pkts_mask) < 7)
-               return rte_table_hash_lru_lookup_unoptimized(table, pkts,
-                       pkts_mask, lookup_hit_mask, entries, 1);
-
-       /* Pipeline stage 0 */
-       lookup2_stage0(t, g, pkts, pkts_mask, pkt00_index, pkt01_index);
-
-       /* Pipeline feed */
-       pkt10_index = pkt00_index;
-       pkt11_index = pkt01_index;
-
-       /* Pipeline stage 0 */
-       lookup2_stage0(t, g, pkts, pkts_mask, pkt00_index, pkt01_index);
-
-       /* Pipeline stage 1 */
-       lookup2_stage1_dosig(t, g, pkts, pkt10_index, pkt11_index);
-
-       /* Pipeline feed */
-       pkt20_index = pkt10_index;
-       pkt21_index = pkt11_index;
-       pkt10_index = pkt00_index;
-       pkt11_index = pkt01_index;
-
-       /* Pipeline stage 0 */
-       lookup2_stage0(t, g, pkts, pkts_mask, pkt00_index, pkt01_index);
-
-       /* Pipeline stage 1 */
-       lookup2_stage1_dosig(t, g, pkts, pkt10_index, pkt11_index);
-
-       /* Pipeline stage 2 */
-       lookup2_stage2(t, g, pkt20_index, pkt21_index, pkts_mask_match_many);
-
-       /*
-       * Pipeline run
-       *
-       */
-       for ( ; pkts_mask; ) {
-               /* Pipeline feed */
-               pkt30_index = pkt20_index;
-               pkt31_index = pkt21_index;
-               pkt20_index = pkt10_index;
-               pkt21_index = pkt11_index;
-               pkt10_index = pkt00_index;
-               pkt11_index = pkt01_index;
-
-               /* Pipeline stage 0 */
-               lookup2_stage0_with_odd_support(t, g, pkts, pkts_mask,
-                       pkt00_index, pkt01_index);
-
-               /* Pipeline stage 1 */
-               lookup2_stage1_dosig(t, g, pkts, pkt10_index, pkt11_index);
-
-               /* Pipeline stage 2 */
-               lookup2_stage2(t, g, pkt20_index, pkt21_index,
-                       pkts_mask_match_many);
-
-               /* Pipeline stage 3 */
-               lookup2_stage3(t, g, pkts, pkt30_index, pkt31_index,
-                       pkts_mask_out, entries);
-       }
-
-       /* Pipeline feed */
-       pkt30_index = pkt20_index;
-       pkt31_index = pkt21_index;
-       pkt20_index = pkt10_index;
-       pkt21_index = pkt11_index;
-       pkt10_index = pkt00_index;
-       pkt11_index = pkt01_index;
-
-       /* Pipeline stage 1 */
-       lookup2_stage1_dosig(t, g, pkts, pkt10_index, pkt11_index);
-
-       /* Pipeline stage 2 */
-       lookup2_stage2(t, g, pkt20_index, pkt21_index, pkts_mask_match_many);
-
-       /* Pipeline stage 3 */
-       lookup2_stage3(t, g, pkts, pkt30_index, pkt31_index, pkts_mask_out,
-               entries);
-
-       /* Pipeline feed */
-       pkt30_index = pkt20_index;
-       pkt31_index = pkt21_index;
-       pkt20_index = pkt10_index;
-       pkt21_index = pkt11_index;
-
-       /* Pipeline stage 2 */
-       lookup2_stage2(t, g, pkt20_index, pkt21_index, pkts_mask_match_many);
-
-       /* Pipeline stage 3 */
-       lookup2_stage3(t, g, pkts, pkt30_index, pkt31_index, pkts_mask_out,
-               entries);
-
-       /* Pipeline feed */
-       pkt30_index = pkt20_index;
-       pkt31_index = pkt21_index;
-
-       /* Pipeline stage 3 */
-       lookup2_stage3(t, g, pkts, pkt30_index, pkt31_index, pkts_mask_out,
-               entries);
-
-       /* Slow path */
-       pkts_mask_match_many &= ~pkts_mask_out;
-       if (pkts_mask_match_many) {
-               uint64_t pkts_mask_out_slow = 0;
-
-               status = rte_table_hash_lru_lookup_unoptimized(table, pkts,
-                       pkts_mask_match_many, &pkts_mask_out_slow, entries, 1);
+                       pkts_mask_match_many, &pkts_mask_out_slow, entries);
                pkts_mask_out |= pkts_mask_out_slow;
        }
 
@@ -1089,14 +920,3 @@ struct rte_table_ops rte_table_hash_lru_ops = {
        .f_lookup = rte_table_hash_lru_lookup,
        .f_stats = rte_table_hash_lru_stats_read,
 };
-
-struct rte_table_ops rte_table_hash_lru_dosig_ops = {
-       .f_create = rte_table_hash_lru_create,
-       .f_free = rte_table_hash_lru_free,
-       .f_add = rte_table_hash_lru_entry_add,
-       .f_delete = rte_table_hash_lru_entry_delete,
-       .f_add_bulk = NULL,
-       .f_delete_bulk = NULL,
-       .f_lookup = rte_table_hash_lru_lookup_dosig,
-       .f_stats = rte_table_hash_lru_stats_read,
-};
index e473c42..991e381 100644 (file)
@@ -215,7 +215,7 @@ app_main_loop_worker_pipeline_hash(void) {
                };
 
                struct rte_pipeline_table_params table_params = {
-                       .ops = &rte_table_hash_lru_dosig_ops,
+                       .ops = &rte_table_hash_lru_ops,
                        .arg_create = &table_hash_params,
                        .f_action_hit = NULL,
                        .f_action_miss = NULL,