get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/30538/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 30538,
    "url": "http://patches.dpdk.org/api/patches/30538/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1508339034-171115-12-git-send-email-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1508339034-171115-12-git-send-email-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1508339034-171115-12-git-send-email-cristian.dumitrescu@intel.com",
    "date": "2017-10-18T15:03:28",
    "name": "[dpdk-dev,v3,11/18] librte_table: rework 16-byte key hash tables",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "82deae7f6a31612f70da22b6774c3c45a2b3373b",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1508339034-171115-12-git-send-email-cristian.dumitrescu@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/30538/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/30538/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C0D871B205;\n\tWed, 18 Oct 2017 17:04:32 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id C12831B1B7\n\tfor <dev@dpdk.org>; Wed, 18 Oct 2017 17:04:09 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t18 Oct 2017 08:04:09 -0700",
            "from silpixa00382658.ir.intel.com ([10.237.223.29])\n\tby orsmga004.jf.intel.com with ESMTP; 18 Oct 2017 08:04:08 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.43,397,1503385200\"; d=\"scan'208\";a=\"139673055\"",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net",
        "Date": "Wed, 18 Oct 2017 16:03:28 +0100",
        "Message-Id": "<1508339034-171115-12-git-send-email-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1508339034-171115-1-git-send-email-cristian.dumitrescu@intel.com>",
        "References": "<1507634341-72277-2-git-send-email-cristian.dumitrescu@intel.com>\n\t<1508339034-171115-1-git-send-email-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 11/18] librte_table: rework 16-byte key hash\n\ttables",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Rework for the 16-byte key hash tables (both the extendible\nbucket and LRU)to use the mask-based hash function and the\nunified parameter structure.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n .../pipeline/pipeline_flow_classification_be.c     |  14 +-\n lib/librte_table/rte_table_hash.h                  |  54 ---\n lib/librte_table/rte_table_hash_key16.c            | 366 +++++++++++----------\n test/test-pipeline/pipeline_hash.c                 |  25 +-\n test/test/test_table_combined.c                    |  40 +--\n test/test/test_table_tables.c                      |   8 +\n 6 files changed, 233 insertions(+), 274 deletions(-)",
    "diff": "diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c\nindex 47e6d35..e4a18e4 100755\n--- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c\n+++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c\n@@ -492,18 +492,6 @@ static void *pipeline_fc_init(struct pipeline_params *params,\n \t/* Tables */\n \tp->n_tables = 1;\n \t{\n-\t\tstruct rte_table_hash_key16_ext_params\n-\t\t\ttable_hash_key16_params = {\n-\t\t\t.n_entries = p_fc->n_flows,\n-\t\t\t.n_entries_ext = p_fc->n_flows,\n-\t\t\t.signature_offset = p_fc->hash_offset,\n-\t\t\t.key_offset = p_fc->key_offset,\n-\t\t\t.f_hash = hash_func[(p_fc->key_size / 8) - 1],\n-\t\t\t.key_mask = (p_fc->key_mask_present) ?\n-\t\t\t\tp_fc->key_mask : NULL,\n-\t\t\t.seed = 0,\n-\t\t};\n-\n \t\tstruct rte_table_hash_params table_hash_params = {\n \t\t\t.name = p->name,\n \t\t\t.key_size = p_fc->key_size,\n@@ -536,7 +524,7 @@ static void *pipeline_fc_init(struct pipeline_params *params,\n \n \t\tcase 16:\n \t\t\ttable_params.ops = &rte_table_hash_key16_ext_ops;\n-\t\t\ttable_params.arg_create = &table_hash_key16_params;\n+\t\t\ttable_params.arg_create = &table_hash_params;\n \t\t\tbreak;\n \n \t\tdefault:\ndiff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h\nindex 6e25054..079dc93 100755\n--- a/lib/librte_table/rte_table_hash.h\n+++ b/lib/librte_table/rte_table_hash.h\n@@ -143,62 +143,8 @@ extern struct rte_table_ops rte_table_hash_key8_lru_ops;\n \n extern struct rte_table_ops rte_table_hash_key8_ext_ops;\n \n-/**\n- * 16-byte key hash tables\n- *\n- */\n-/** LRU hash table parameters */\n-struct rte_table_hash_key16_lru_params {\n-\t/** Maximum number of entries (and keys) in the table */\n-\tuint32_t n_entries;\n-\n-\t/** Hash function */\n-\trte_table_hash_op_hash_nomask f_hash;\n-\n-\t/** Seed for the hash function */\n-\tuint64_t seed;\n-\n-\t/** Byte offset within packet meta-data where the 4-byte key signature\n-\tis located. Valid for pre-computed key signature tables, ignored for\n-\tdo-sig tables. */\n-\tuint32_t signature_offset;\n-\n-\t/** Byte offset within packet meta-data where the key is located */\n-\tuint32_t key_offset;\n-\n-\t/** Bit-mask to be AND-ed to the key on lookup */\n-\tuint8_t *key_mask;\n-};\n-\n extern struct rte_table_ops rte_table_hash_key16_lru_ops;\n \n-/** Extendible bucket hash table parameters */\n-struct rte_table_hash_key16_ext_params {\n-\t/** Maximum number of entries (and keys) in the table */\n-\tuint32_t n_entries;\n-\n-\t/** Number of entries (and keys) for hash table bucket extensions. Each\n-\tbucket is extended in increments of 4 keys. */\n-\tuint32_t n_entries_ext;\n-\n-\t/** Hash function */\n-\trte_table_hash_op_hash_nomask f_hash;\n-\n-\t/** Seed for the hash function */\n-\tuint64_t seed;\n-\n-\t/** Byte offset within packet meta-data where the 4-byte key signature\n-\tis located. Valid for pre-computed key signature tables, ignored for\n-\tdo-sig tables. */\n-\tuint32_t signature_offset;\n-\n-\t/** Byte offset within packet meta-data where the key is located */\n-\tuint32_t key_offset;\n-\n-\t/** Bit-mask to be AND-ed to the key on lookup */\n-\tuint8_t *key_mask;\n-};\n-\n extern struct rte_table_ops rte_table_hash_key16_ext_ops;\n \n /**\ndiff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c\nindex 7f6651c..84b59cc 100644\n--- a/lib/librte_table/rte_table_hash_key16.c\n+++ b/lib/librte_table/rte_table_hash_key16.c\n@@ -42,7 +42,9 @@\n #include \"rte_table_hash.h\"\n #include \"rte_lru.h\"\n \n-#define RTE_TABLE_HASH_KEY_SIZE\t\t\t\t\t\t16\n+#define KEY_SIZE\t\t\t\t\t\t16\n+\n+#define KEYS_PER_BUCKET\t\t\t\t\t4\n \n #define RTE_BUCKET_ENTRY_VALID\t\t\t\t\t\t0x1LLU\n \n@@ -79,14 +81,12 @@ struct rte_table_hash {\n \n \t/* Input parameters */\n \tuint32_t n_buckets;\n-\tuint32_t n_entries_per_bucket;\n \tuint32_t key_size;\n \tuint32_t entry_size;\n \tuint32_t bucket_size;\n-\tuint32_t signature_offset;\n \tuint32_t key_offset;\n \tuint64_t key_mask[2];\n-\trte_table_hash_op_hash_nomask f_hash;\n+\trte_table_hash_op_hash f_hash;\n \tuint64_t seed;\n \n \t/* Extendible buckets */\n@@ -99,17 +99,55 @@ struct rte_table_hash {\n };\n \n static int\n-check_params_create_lru(struct rte_table_hash_key16_lru_params *params) {\n-\t/* n_entries */\n-\tif (params->n_entries == 0) {\n-\t\tRTE_LOG(ERR, TABLE, \"%s: n_entries is zero\\n\", __func__);\n+keycmp(void *a, void *b, void *b_mask)\n+{\n+\tuint64_t *a64 = a, *b64 = b, *b_mask64 = b_mask;\n+\n+\treturn (a64[0] != (b64[0] & b_mask64[0])) ||\n+\t\t(a64[1] != (b64[1] & b_mask64[1]));\n+}\n+\n+static void\n+keycpy(void *dst, void *src, void *src_mask)\n+{\n+\tuint64_t *dst64 = dst, *src64 = src, *src_mask64 = src_mask;\n+\n+\tdst64[0] = src64[0] & src_mask64[0];\n+\tdst64[1] = src64[1] & src_mask64[1];\n+}\n+\n+static int\n+check_params_create(struct rte_table_hash_params *params)\n+{\n+\t/* name */\n+\tif (params->name == NULL) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: name invalid value\\n\", __func__);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* key_size */\n+\tif (params->key_size != KEY_SIZE) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: key_size invalid value\\n\", __func__);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* n_keys */\n+\tif (params->n_keys == 0) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: n_keys is zero\\n\", __func__);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* n_buckets */\n+\tif ((params->n_buckets == 0) ||\n+\t\t(!rte_is_power_of_2(params->n_buckets))) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: n_buckets invalid value\\n\", __func__);\n \t\treturn -EINVAL;\n \t}\n \n \t/* f_hash */\n \tif (params->f_hash == NULL) {\n-\t\tRTE_LOG(ERR, TABLE,\n-\t\t\t\"%s: f_hash function pointer is NULL\\n\", __func__);\n+\t\tRTE_LOG(ERR, TABLE, \"%s: f_hash function pointer is NULL\\n\",\n+\t\t\t__func__);\n \t\treturn -EINVAL;\n \t}\n \n@@ -121,46 +159,67 @@ rte_table_hash_create_key16_lru(void *params,\n \t\tint socket_id,\n \t\tuint32_t entry_size)\n {\n-\tstruct rte_table_hash_key16_lru_params *p =\n-\t\t\t(struct rte_table_hash_key16_lru_params *) params;\n+\tstruct rte_table_hash_params *p = params;\n \tstruct rte_table_hash *f;\n-\tuint32_t n_buckets, n_entries_per_bucket,\n-\t\t\tkey_size, bucket_size_cl, total_size, i;\n+\tuint64_t bucket_size, total_size;\n+\tuint32_t n_buckets, i;\n \n \t/* Check input parameters */\n-\tif ((check_params_create_lru(p) != 0) ||\n+\tif ((check_params_create(p) != 0) ||\n \t\t((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||\n \t\t((sizeof(struct rte_bucket_4_16) % 64) != 0))\n \t\treturn NULL;\n-\tn_entries_per_bucket = 4;\n-\tkey_size = 16;\n+\n+\t/*\n+\t * Table dimensioning\n+\t *\n+\t * Objective: Pick the number of buckets (n_buckets) so that there a chance\n+\t * to store n_keys keys in the table.\n+\t *\n+\t * Note: Since the buckets do not get extended, it is not possible to\n+\t * guarantee that n_keys keys can be stored in the table at any time. In the\n+\t * worst case scenario when all the n_keys fall into the same bucket, only\n+\t * a maximum of KEYS_PER_BUCKET keys will be stored in the table. This case\n+\t * defeats the purpose of the hash table. It indicates unsuitable f_hash or\n+\t * n_keys to n_buckets ratio.\n+\t *\n+\t * MIN(n_buckets) = (n_keys + KEYS_PER_BUCKET - 1) / KEYS_PER_BUCKET\n+\t */\n+\tn_buckets = rte_align32pow2(\n+\t\t(p->n_keys + KEYS_PER_BUCKET - 1) / KEYS_PER_BUCKET);\n+\tn_buckets = RTE_MAX(n_buckets, p->n_buckets);\n \n \t/* Memory allocation */\n-\tn_buckets = rte_align32pow2((p->n_entries + n_entries_per_bucket - 1) /\n-\t\tn_entries_per_bucket);\n-\tbucket_size_cl = (sizeof(struct rte_bucket_4_16) + n_entries_per_bucket\n-\t\t* entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;\n-\ttotal_size = sizeof(struct rte_table_hash) + n_buckets *\n-\t\tbucket_size_cl * RTE_CACHE_LINE_SIZE;\n-\n-\tf = rte_zmalloc_socket(\"TABLE\", total_size, RTE_CACHE_LINE_SIZE, socket_id);\n+\tbucket_size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_bucket_4_16) +\n+\t\tKEYS_PER_BUCKET * entry_size);\n+\ttotal_size = sizeof(struct rte_table_hash) + n_buckets * bucket_size;\n+\n+\tif (total_size > SIZE_MAX) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: Cannot allocate %\" PRIu64 \" bytes \"\n+\t\t\"for hash table %s\\n\",\n+\t\t__func__, total_size, p->name);\n+\t\treturn NULL;\n+\t}\n+\n+\tf = rte_zmalloc_socket(p->name,\n+\t\t(size_t)total_size,\n+\t\tRTE_CACHE_LINE_SIZE,\n+\t\tsocket_id);\n \tif (f == NULL) {\n-\t\tRTE_LOG(ERR, TABLE,\n-\t\t\"%s: Cannot allocate %u bytes for hash table\\n\",\n-\t\t__func__, total_size);\n+\t\tRTE_LOG(ERR, TABLE, \"%s: Cannot allocate %\" PRIu64 \" bytes \"\n+\t\t\"for hash table %s\\n\",\n+\t\t__func__, total_size, p->name);\n \t\treturn NULL;\n \t}\n-\tRTE_LOG(INFO, TABLE,\n-\t\t\"%s: Hash table memory footprint is %u bytes\\n\",\n-\t\t__func__, total_size);\n+\tRTE_LOG(INFO, TABLE, \"%s: Hash table %s memory footprint \"\n+\t\t\"is %\" PRIu64 \" bytes\\n\",\n+\t\t__func__, p->name, total_size);\n \n \t/* Memory initialization */\n \tf->n_buckets = n_buckets;\n-\tf->n_entries_per_bucket = n_entries_per_bucket;\n-\tf->key_size = key_size;\n+\tf->key_size = KEY_SIZE;\n \tf->entry_size = entry_size;\n-\tf->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;\n-\tf->signature_offset = p->signature_offset;\n+\tf->bucket_size = bucket_size;\n \tf->key_offset = p->key_offset;\n \tf->f_hash = p->f_hash;\n \tf->seed = p->seed;\n@@ -212,19 +271,19 @@ rte_table_hash_entry_add_key16_lru(\n \tuint64_t signature, pos;\n \tuint32_t bucket_index, i;\n \n-\tsignature = f->f_hash(key, f->key_size, f->seed);\n+\tsignature = f->f_hash(key, f->key_mask, f->key_size, f->seed);\n \tbucket_index = signature & (f->n_buckets - 1);\n \tbucket = (struct rte_bucket_4_16 *)\n-\t\t\t&f->memory[bucket_index * f->bucket_size];\n+\t\t&f->memory[bucket_index * f->bucket_size];\n \tsignature |= RTE_BUCKET_ENTRY_VALID;\n \n \t/* Key is present in the bucket */\n \tfor (i = 0; i < 4; i++) {\n \t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\tif ((bucket_signature == signature) &&\n-\t\t\t\t(memcmp(key, bucket_key, f->key_size) == 0)) {\n+\t\t\t(keycmp(bucket_key, key, f->key_mask) == 0)) {\n \t\t\tuint8_t *bucket_data = &bucket->data[i * f->entry_size];\n \n \t\t\tmemcpy(bucket_data, entry, f->entry_size);\n@@ -238,13 +297,13 @@ rte_table_hash_entry_add_key16_lru(\n \t/* Key is not present in the bucket */\n \tfor (i = 0; i < 4; i++) {\n \t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\tif (bucket_signature == 0) {\n \t\t\tuint8_t *bucket_data = &bucket->data[i * f->entry_size];\n \n \t\t\tbucket->signature[i] = signature;\n-\t\t\tmemcpy(bucket_key, key, f->key_size);\n+\t\t\tkeycpy(bucket_key, key, f->key_mask);\n \t\t\tmemcpy(bucket_data, entry, f->entry_size);\n \t\t\tlru_update(bucket, i);\n \t\t\t*key_found = 0;\n@@ -257,7 +316,7 @@ rte_table_hash_entry_add_key16_lru(\n \t/* Bucket full: replace LRU entry */\n \tpos = lru_pos(bucket);\n \tbucket->signature[pos] = signature;\n-\tmemcpy(bucket->key[pos], key, f->key_size);\n+\tkeycpy(&bucket->key[pos], key, f->key_mask);\n \tmemcpy(&bucket->data[pos * f->entry_size], entry, f->entry_size);\n \tlru_update(bucket, pos);\n \t*key_found = 0;\n@@ -278,19 +337,19 @@ rte_table_hash_entry_delete_key16_lru(\n \tuint64_t signature;\n \tuint32_t bucket_index, i;\n \n-\tsignature = f->f_hash(key, f->key_size, f->seed);\n+\tsignature = f->f_hash(key, f->key_mask, f->key_size, f->seed);\n \tbucket_index = signature & (f->n_buckets - 1);\n \tbucket = (struct rte_bucket_4_16 *)\n-\t\t\t&f->memory[bucket_index * f->bucket_size];\n+\t\t&f->memory[bucket_index * f->bucket_size];\n \tsignature |= RTE_BUCKET_ENTRY_VALID;\n \n \t/* Key is present in the bucket */\n \tfor (i = 0; i < 4; i++) {\n \t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\tif ((bucket_signature == signature) &&\n-\t\t\t\t(memcmp(key, bucket_key, f->key_size) == 0)) {\n+\t\t\t(keycmp(bucket_key, key, f->key_mask) == 0)) {\n \t\t\tuint8_t *bucket_data = &bucket->data[i * f->entry_size];\n \n \t\t\tbucket->signature[i] = 0;\n@@ -306,81 +365,71 @@ rte_table_hash_entry_delete_key16_lru(\n \treturn 0;\n }\n \n-static int\n-check_params_create_ext(struct rte_table_hash_key16_ext_params *params) {\n-\t/* n_entries */\n-\tif (params->n_entries == 0) {\n-\t\tRTE_LOG(ERR, TABLE, \"%s: n_entries is zero\\n\", __func__);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\t/* n_entries_ext */\n-\tif (params->n_entries_ext == 0) {\n-\t\tRTE_LOG(ERR, TABLE, \"%s: n_entries_ext is zero\\n\", __func__);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\t/* f_hash */\n-\tif (params->f_hash == NULL) {\n-\t\tRTE_LOG(ERR, TABLE,\n-\t\t\t\"%s: f_hash function pointer is NULL\\n\", __func__);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\treturn 0;\n-}\n-\n static void *\n rte_table_hash_create_key16_ext(void *params,\n \t\tint socket_id,\n \t\tuint32_t entry_size)\n {\n-\tstruct rte_table_hash_key16_ext_params *p =\n-\t\t\t(struct rte_table_hash_key16_ext_params *) params;\n+\tstruct rte_table_hash_params *p = params;\n \tstruct rte_table_hash *f;\n-\tuint32_t n_buckets, n_buckets_ext, n_entries_per_bucket, key_size,\n-\t\t\tbucket_size_cl, stack_size_cl, total_size, i;\n+\tuint64_t bucket_size, stack_size, total_size;\n+\tuint32_t n_buckets_ext, i;\n \n \t/* Check input parameters */\n-\tif ((check_params_create_ext(p) != 0) ||\n+\tif ((check_params_create(p) != 0) ||\n \t\t((sizeof(struct rte_table_hash) % RTE_CACHE_LINE_SIZE) != 0) ||\n \t\t((sizeof(struct rte_bucket_4_16) % 64) != 0))\n \t\treturn NULL;\n \n-\tn_entries_per_bucket = 4;\n-\tkey_size = 16;\n+\t/*\n+\t * Table dimensioning\n+\t *\n+\t * Objective: Pick the number of bucket extensions (n_buckets_ext) so that\n+\t * it is guaranteed that n_keys keys can be stored in the table at any time.\n+\t *\n+\t * The worst case scenario takes place when all the n_keys keys fall into\n+\t * the same bucket. Actually, due to the KEYS_PER_BUCKET scheme, the worst\n+\t * case takes place when (n_keys - KEYS_PER_BUCKET + 1) keys fall into the\n+\t * same bucket, while the remaining (KEYS_PER_BUCKET - 1) keys each fall\n+\t * into a different bucket. This case defeats the purpose of the hash table.\n+\t * It indicates unsuitable f_hash or n_keys to n_buckets ratio.\n+\t *\n+\t * n_buckets_ext = n_keys / KEYS_PER_BUCKET + KEYS_PER_BUCKET - 1\n+\t */\n+\tn_buckets_ext = p->n_keys / KEYS_PER_BUCKET + KEYS_PER_BUCKET - 1;\n \n \t/* Memory allocation */\n-\tn_buckets = rte_align32pow2((p->n_entries + n_entries_per_bucket - 1) /\n-\t\tn_entries_per_bucket);\n-\tn_buckets_ext = (p->n_entries_ext + n_entries_per_bucket - 1) /\n-\t\tn_entries_per_bucket;\n-\tbucket_size_cl = (sizeof(struct rte_bucket_4_16) + n_entries_per_bucket\n-\t\t* entry_size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE;\n-\tstack_size_cl = (n_buckets_ext * sizeof(uint32_t) + RTE_CACHE_LINE_SIZE - 1)\n-\t\t/ RTE_CACHE_LINE_SIZE;\n+\tbucket_size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_bucket_4_16) +\n+\t\tKEYS_PER_BUCKET * entry_size);\n+\tstack_size = RTE_CACHE_LINE_ROUNDUP(n_buckets_ext * sizeof(uint32_t));\n \ttotal_size = sizeof(struct rte_table_hash) +\n-\t\t((n_buckets + n_buckets_ext) * bucket_size_cl + stack_size_cl) *\n-\t\tRTE_CACHE_LINE_SIZE;\n+\t\t(p->n_buckets + n_buckets_ext) * bucket_size + stack_size;\n+\tif (total_size > SIZE_MAX) {\n+\t\tRTE_LOG(ERR, TABLE, \"%s: Cannot allocate %\" PRIu64 \" bytes \"\n+\t\t\t\"for hash table %s\\n\",\n+\t\t\t__func__, total_size, p->name);\n+\t\treturn NULL;\n+\t}\n \n-\tf = rte_zmalloc_socket(\"TABLE\", total_size, RTE_CACHE_LINE_SIZE, socket_id);\n+\tf = rte_zmalloc_socket(p->name,\n+\t\t(size_t)total_size,\n+\t\tRTE_CACHE_LINE_SIZE,\n+\t\tsocket_id);\n \tif (f == NULL) {\n-\t\tRTE_LOG(ERR, TABLE,\n-\t\t\t\"%s: Cannot allocate %u bytes for hash table\\n\",\n-\t\t\t__func__, total_size);\n+\t\tRTE_LOG(ERR, TABLE, \"%s: Cannot allocate %\" PRIu64 \" bytes \"\n+\t\t\t\"for hash table %s\\n\",\n+\t\t\t__func__, total_size, p->name);\n \t\treturn NULL;\n \t}\n-\tRTE_LOG(INFO, TABLE,\n-\t\t\"%s: Hash table memory footprint is %u bytes\\n\",\n-\t\t__func__, total_size);\n+\tRTE_LOG(INFO, TABLE, \"%s: Hash table %s memory footprint \"\n+\t\t\"is %\" PRIu64 \" bytes\\n\",\n+\t\t__func__, p->name, total_size);\n \n \t/* Memory initialization */\n-\tf->n_buckets = n_buckets;\n-\tf->n_entries_per_bucket = n_entries_per_bucket;\n-\tf->key_size = key_size;\n+\tf->n_buckets = p->n_buckets;\n+\tf->key_size = KEY_SIZE;\n \tf->entry_size = entry_size;\n-\tf->bucket_size = bucket_size_cl * RTE_CACHE_LINE_SIZE;\n-\tf->signature_offset = p->signature_offset;\n+\tf->bucket_size = bucket_size;\n \tf->key_offset = p->key_offset;\n \tf->f_hash = p->f_hash;\n \tf->seed = p->seed;\n@@ -388,10 +437,7 @@ rte_table_hash_create_key16_ext(void *params,\n \tf->n_buckets_ext = n_buckets_ext;\n \tf->stack_pos = n_buckets_ext;\n \tf->stack = (uint32_t *)\n-\t\t&f->memory[(n_buckets + n_buckets_ext) * f->bucket_size];\n-\n-\tfor (i = 0; i < n_buckets_ext; i++)\n-\t\tf->stack[i] = i;\n+\t\t&f->memory[(p->n_buckets + n_buckets_ext) * f->bucket_size];\n \n \tif (p->key_mask != NULL) {\n \t\tf->key_mask[0] = (((uint64_t *)p->key_mask)[0]);\n@@ -401,6 +447,9 @@ rte_table_hash_create_key16_ext(void *params,\n \t\tf->key_mask[1] = 0xFFFFFFFFFFFFFFFFLLU;\n \t}\n \n+\tfor (i = 0; i < n_buckets_ext; i++)\n+\t\tf->stack[i] = i;\n+\n \treturn f;\n }\n \n@@ -432,20 +481,20 @@ rte_table_hash_entry_add_key16_ext(\n \tuint64_t signature;\n \tuint32_t bucket_index, i;\n \n-\tsignature = f->f_hash(key, f->key_size, f->seed);\n+\tsignature = f->f_hash(key, f->key_mask, f->key_size, f->seed);\n \tbucket_index = signature & (f->n_buckets - 1);\n \tbucket0 = (struct rte_bucket_4_16 *)\n-\t\t\t&f->memory[bucket_index * f->bucket_size];\n+\t\t&f->memory[bucket_index * f->bucket_size];\n \tsignature |= RTE_BUCKET_ENTRY_VALID;\n \n \t/* Key is present in the bucket */\n \tfor (bucket = bucket0; bucket != NULL; bucket = bucket->next)\n \t\tfor (i = 0; i < 4; i++) {\n \t\t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\t\tif ((bucket_signature == signature) &&\n-\t\t\t\t(memcmp(key, bucket_key, f->key_size) == 0)) {\n+\t\t\t\t(keycmp(bucket_key, key, f->key_mask) == 0)) {\n \t\t\t\tuint8_t *bucket_data = &bucket->data[i *\n \t\t\t\t\tf->entry_size];\n \n@@ -458,17 +507,17 @@ rte_table_hash_entry_add_key16_ext(\n \n \t/* Key is not present in the bucket */\n \tfor (bucket_prev = NULL, bucket = bucket0; bucket != NULL;\n-\t\t\t bucket_prev = bucket, bucket = bucket->next)\n+\t\tbucket_prev = bucket, bucket = bucket->next)\n \t\tfor (i = 0; i < 4; i++) {\n \t\t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\t\tif (bucket_signature == 0) {\n \t\t\t\tuint8_t *bucket_data = &bucket->data[i *\n \t\t\t\t\tf->entry_size];\n \n \t\t\t\tbucket->signature[i] = signature;\n-\t\t\t\tmemcpy(bucket_key, key, f->key_size);\n+\t\t\t\tkeycpy(bucket_key, key, f->key_mask);\n \t\t\t\tmemcpy(bucket_data, entry, f->entry_size);\n \t\t\t\t*key_found = 0;\n \t\t\t\t*entry_ptr = (void *) bucket_data;\n@@ -487,7 +536,7 @@ rte_table_hash_entry_add_key16_ext(\n \t\tbucket_prev->next_valid = 1;\n \n \t\tbucket->signature[0] = signature;\n-\t\tmemcpy(bucket->key[0], key, f->key_size);\n+\t\tkeycpy(&bucket->key[0], key, f->key_mask);\n \t\tmemcpy(&bucket->data[0], entry, f->entry_size);\n \t\t*key_found = 0;\n \t\t*entry_ptr = (void *) &bucket->data[0];\n@@ -509,7 +558,7 @@ rte_table_hash_entry_delete_key16_ext(\n \tuint64_t signature;\n \tuint32_t bucket_index, i;\n \n-\tsignature = f->f_hash(key, f->key_size, f->seed);\n+\tsignature = f->f_hash(key, f->key_mask, f->key_size, f->seed);\n \tbucket_index = signature & (f->n_buckets - 1);\n \tbucket0 = (struct rte_bucket_4_16 *)\n \t\t&f->memory[bucket_index * f->bucket_size];\n@@ -520,18 +569,17 @@ rte_table_hash_entry_delete_key16_ext(\n \t\tbucket_prev = bucket, bucket = bucket->next)\n \t\tfor (i = 0; i < 4; i++) {\n \t\t\tuint64_t bucket_signature = bucket->signature[i];\n-\t\t\tuint8_t *bucket_key = (uint8_t *) bucket->key[i];\n+\t\t\tuint8_t *bucket_key = (uint8_t *) &bucket->key[i];\n \n \t\t\tif ((bucket_signature == signature) &&\n-\t\t\t\t(memcmp(key, bucket_key, f->key_size) == 0)) {\n+\t\t\t\t(keycmp(bucket_key, key, f->key_mask) == 0)) {\n \t\t\t\tuint8_t *bucket_data = &bucket->data[i *\n \t\t\t\t\tf->entry_size];\n \n \t\t\t\tbucket->signature[i] = 0;\n \t\t\t\t*key_found = 1;\n \t\t\t\tif (entry)\n-\t\t\t\t\tmemcpy(entry, bucket_data,\n-\t\t\t\t\tf->entry_size);\n+\t\t\t\t\tmemcpy(entry, bucket_data, f->entry_size);\n \n \t\t\t\tif ((bucket->signature[0] == 0) &&\n \t\t\t\t\t(bucket->signature[1] == 0) &&\n@@ -558,26 +606,28 @@ rte_table_hash_entry_delete_key16_ext(\n \treturn 0;\n }\n \n-#define lookup_key16_cmp(key_in, bucket, pos)\t\t\t\\\n+#define lookup_key16_cmp(key_in, bucket, pos, f)\t\t\t\\\n {\t\t\t\t\t\t\t\t\\\n-\tuint64_t xor[4][2], or[4], signature[4];\t\t\\\n+\tuint64_t xor[4][2], or[4], signature[4], k[2];\t\t\\\n \t\t\t\t\t\t\t\t\\\n+\tk[0] = key_in[0] & f->key_mask[0];\t\t\t\t\\\n+\tk[1] = key_in[1] & f->key_mask[1];\t\t\t\t\\\n \tsignature[0] = (~bucket->signature[0]) & 1;\t\t\\\n \tsignature[1] = (~bucket->signature[1]) & 1;\t\t\\\n \tsignature[2] = (~bucket->signature[2]) & 1;\t\t\\\n \tsignature[3] = (~bucket->signature[3]) & 1;\t\t\\\n \t\t\t\t\t\t\t\t\\\n-\txor[0][0] = key_in[0] ^\t bucket->key[0][0];\t\t\\\n-\txor[0][1] = key_in[1] ^\t bucket->key[0][1];\t\t\\\n+\txor[0][0] = k[0] ^ bucket->key[0][0];\t\t\t\\\n+\txor[0][1] = k[1] ^ bucket->key[0][1];\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n-\txor[1][0] = key_in[0] ^\t bucket->key[1][0];\t\t\\\n-\txor[1][1] = key_in[1] ^\t bucket->key[1][1];\t\t\\\n+\txor[1][0] = k[0] ^ bucket->key[1][0];\t\t\t\\\n+\txor[1][1] = k[1] ^ bucket->key[1][1];\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n-\txor[2][0] = key_in[0] ^\t bucket->key[2][0];\t\t\\\n-\txor[2][1] = key_in[1] ^\t bucket->key[2][1];\t\t\\\n+\txor[2][0] = k[0] ^ bucket->key[2][0];\t\t\t\\\n+\txor[2][1] = k[1] ^ bucket->key[2][1];\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n-\txor[3][0] = key_in[0] ^\t bucket->key[3][0];\t\t\\\n-\txor[3][1] = key_in[1] ^\t bucket->key[3][1];\t\t\\\n+\txor[3][0] = k[0] ^ bucket->key[3][0];\t\t\t\\\n+\txor[3][1] = k[1] ^ bucket->key[3][1];\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tor[0] = xor[0][0] | xor[0][1] | signature[0];\t\t\\\n \tor[1] = xor[1][0] | xor[1][1] | signature[1];\t\t\\\n@@ -613,14 +663,9 @@ rte_table_hash_entry_delete_key16_ext(\n \tuint64_t *key;\t\t\t\t\t\t\\\n \tuint64_t signature = 0;\t\t\t\t\\\n \tuint32_t bucket_index;\t\t\t\t\\\n-\tuint64_t hash_key_buffer[2];\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey = RTE_MBUF_METADATA_UINT64_PTR(mbuf1, f->key_offset);\\\n-\t\t\t\t\t\t\t\t\\\n-\thash_key_buffer[0] = key[0] & f->key_mask[0];\t\\\n-\thash_key_buffer[1] = key[1] & f->key_mask[1];\t\\\n-\tsignature = f->f_hash(hash_key_buffer,\t\t\t\\\n-\t\t\tRTE_TABLE_HASH_KEY_SIZE, f->seed);\t\t\\\n+\tsignature = f->f_hash(key, f->key_mask, KEY_SIZE, f->seed);\t\\\n \t\t\t\t\t\t\t\t\\\n \tbucket_index = signature & (f->n_buckets - 1);\t\t\\\n \tbucket1 = (struct rte_bucket_4_16 *)\t\t\t\\\n@@ -635,14 +680,10 @@ rte_table_hash_entry_delete_key16_ext(\n \tvoid *a;\t\t\t\t\t\t\\\n \tuint64_t pkt_mask;\t\t\t\t\t\\\n \tuint64_t *key;\t\t\t\t\t\t\\\n-\tuint64_t hash_key_buffer[2];\t\t\\\n \tuint32_t pos;\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\\\n-\thash_key_buffer[0] = key[0] & f->key_mask[0];\t\\\n-\thash_key_buffer[1] = key[1] & f->key_mask[1];\t\\\n-\t\t\t\t\t\t\t\t\\\n-\tlookup_key16_cmp(hash_key_buffer, bucket2, pos);\t\\\n+\tlookup_key16_cmp(key, bucket2, pos, f);\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tpkt_mask = (bucket2->signature[pos] & 1LLU) << pkt2_index;\\\n \tpkts_mask_out |= pkt_mask;\t\t\t\t\\\n@@ -660,14 +701,10 @@ rte_table_hash_entry_delete_key16_ext(\n \tvoid *a;\t\t\t\t\t\t\\\n \tuint64_t pkt_mask, bucket_mask;\t\t\t\t\\\n \tuint64_t *key;\t\t\t\t\t\t\\\n-\tuint64_t hash_key_buffer[2];\t\t\\\n \tuint32_t pos;\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\\\n-\thash_key_buffer[0] = key[0] & f->key_mask[0];\t\\\n-\thash_key_buffer[1] = key[1] & f->key_mask[1];\t\\\n-\t\t\t\t\t\t\t\t\\\n-\tlookup_key16_cmp(hash_key_buffer, bucket2, pos);\t\\\n+\tlookup_key16_cmp(key, bucket2, pos, f);\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tpkt_mask = (bucket2->signature[pos] & 1LLU) << pkt2_index;\\\n \tpkts_mask_out |= pkt_mask;\t\t\t\t\\\n@@ -690,15 +727,11 @@ rte_table_hash_entry_delete_key16_ext(\n \tvoid *a;\t\t\t\t\t\t\\\n \tuint64_t pkt_mask, bucket_mask;\t\t\t\t\\\n \tuint64_t *key;\t\t\t\t\t\t\\\n-\tuint64_t hash_key_buffer[2];\t\t\\\n \tuint32_t pos;\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tbucket = buckets[pkt_index];\t\t\t\t\\\n \tkey = keys[pkt_index];\t\t\t\t\t\\\n-\thash_key_buffer[0] = key[0] & f->key_mask[0];\t\\\n-\thash_key_buffer[1] = key[1] & f->key_mask[1];\t\\\n-\t\t\t\t\t\t\t\t\\\n-\tlookup_key16_cmp(hash_key_buffer, bucket, pos);\t\\\n+\tlookup_key16_cmp(key, bucket, pos, f);\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tpkt_mask = (bucket->signature[pos] & 1LLU) << pkt_index;\\\n \tpkts_mask_out |= pkt_mask;\t\t\t\t\\\n@@ -763,15 +796,11 @@ rte_table_hash_entry_delete_key16_ext(\n #define lookup2_stage1(mbuf10, mbuf11, bucket10, bucket11, f)\t\\\n {\t\t\t\t\t\t\t\t\\\n \tuint64_t *key10, *key11;\t\t\t\t\t\\\n-\tuint64_t hash_offset_buffer[2];\t\t\t\t\\\n \tuint64_t signature10, signature11;\t\t\t\\\n \tuint32_t bucket10_index, bucket11_index;\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey10 = RTE_MBUF_METADATA_UINT64_PTR(mbuf10, f->key_offset);\\\n-\thash_offset_buffer[0] = key10[0] & f->key_mask[0];\t\\\n-\thash_offset_buffer[1] = key10[1] & f->key_mask[1];\t\\\n-\tsignature10 = f->f_hash(hash_offset_buffer,\t\t\t\\\n-\t\t\tRTE_TABLE_HASH_KEY_SIZE, f->seed);\\\n+\tsignature10 = f->f_hash(key10, f->key_mask,\t KEY_SIZE, f->seed);\\\n \tbucket10_index = signature10 & (f->n_buckets - 1);\t\\\n \tbucket10 = (struct rte_bucket_4_16 *)\t\t\t\t\\\n \t\t&f->memory[bucket10_index * f->bucket_size];\t\\\n@@ -779,10 +808,7 @@ rte_table_hash_entry_delete_key16_ext(\n \trte_prefetch0((void *)(((uintptr_t) bucket10) + RTE_CACHE_LINE_SIZE));\\\n \t\t\t\t\t\t\t\t\\\n \tkey11 = RTE_MBUF_METADATA_UINT64_PTR(mbuf11, f->key_offset);\\\n-\thash_offset_buffer[0] = key11[0] & f->key_mask[0];\t\\\n-\thash_offset_buffer[1] = key11[1] & f->key_mask[1];\t\\\n-\tsignature11 = f->f_hash(hash_offset_buffer,\t\t\t\\\n-\t\t\tRTE_TABLE_HASH_KEY_SIZE, f->seed);\\\n+\tsignature11 = f->f_hash(key11, f->key_mask,\t KEY_SIZE, f->seed);\\\n \tbucket11_index = signature11 & (f->n_buckets - 1);\t\\\n \tbucket11 = (struct rte_bucket_4_16 *)\t\t\t\\\n \t\t&f->memory[bucket11_index * f->bucket_size];\t\\\n@@ -796,19 +822,13 @@ rte_table_hash_entry_delete_key16_ext(\n \tvoid *a20, *a21;\t\t\t\t\t\\\n \tuint64_t pkt20_mask, pkt21_mask;\t\t\t\\\n \tuint64_t *key20, *key21;\t\t\t\t\\\n-\tuint64_t hash_key_buffer20[2];\t\t\t\\\n-\tuint64_t hash_key_buffer21[2];\t\t\t\\\n \tuint32_t pos20, pos21;\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey20 = RTE_MBUF_METADATA_UINT64_PTR(mbuf20, f->key_offset);\\\n \tkey21 = RTE_MBUF_METADATA_UINT64_PTR(mbuf21, f->key_offset);\\\n-\thash_key_buffer20[0] = key20[0] & f->key_mask[0];\t\\\n-\thash_key_buffer20[1] = key20[1] & f->key_mask[1];\t\\\n-\thash_key_buffer21[0] = key21[0] & f->key_mask[0];\t\\\n-\thash_key_buffer21[1] = key21[1] & f->key_mask[1];\t\\\n \t\t\t\t\t\t\t\t\\\n-\tlookup_key16_cmp(hash_key_buffer20, bucket20, pos20);\t\\\n-\tlookup_key16_cmp(hash_key_buffer21, bucket21, pos21);\t\\\n+\tlookup_key16_cmp(key20, bucket20, pos20, f);\t\t\\\n+\tlookup_key16_cmp(key21, bucket21, pos21, f);\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tpkt20_mask = (bucket20->signature[pos20] & 1LLU) << pkt20_index;\\\n \tpkt21_mask = (bucket21->signature[pos21] & 1LLU) << pkt21_index;\\\n@@ -831,19 +851,13 @@ rte_table_hash_entry_delete_key16_ext(\n \tvoid *a20, *a21;\t\t\t\t\t\\\n \tuint64_t pkt20_mask, pkt21_mask, bucket20_mask, bucket21_mask;\\\n \tuint64_t *key20, *key21;\t\t\t\t\\\n-\tuint64_t hash_key_buffer20[2];\t\t\t\\\n-\tuint64_t hash_key_buffer21[2];\t\t\t\\\n \tuint32_t pos20, pos21;\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tkey20 = RTE_MBUF_METADATA_UINT64_PTR(mbuf20, f->key_offset);\\\n \tkey21 = RTE_MBUF_METADATA_UINT64_PTR(mbuf21, f->key_offset);\\\n-\thash_key_buffer20[0] = key20[0] & f->key_mask[0];\t\\\n-\thash_key_buffer20[1] = key20[1] & f->key_mask[1];\t\\\n-\thash_key_buffer21[0] = key21[0] & f->key_mask[0];\t\\\n-\thash_key_buffer21[1] = key21[1] & f->key_mask[1];\t\\\n \t\t\t\t\t\t\t\t\\\n-\tlookup_key16_cmp(hash_key_buffer20, bucket20, pos20);\t\\\n-\tlookup_key16_cmp(hash_key_buffer21, bucket21, pos21);\t\\\n+\tlookup_key16_cmp(key20, bucket20, pos20, f);\t\\\n+\tlookup_key16_cmp(key21, bucket21, pos21, f);\t\\\n \t\t\t\t\t\t\t\t\\\n \tpkt20_mask = (bucket20->signature[pos20] & 1LLU) << pkt20_index;\\\n \tpkt21_mask = (bucket21->signature[pos21] & 1LLU) << pkt21_index;\\\n@@ -994,7 +1008,7 @@ rte_table_hash_lookup_key16_lru(\n \tRTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in -\n \t\t__builtin_popcountll(pkts_mask_out));\n \treturn 0;\n-} /* rte_table_hash_lookup_key16_lru() */\n+} /* lookup LRU */\n \n static int\n rte_table_hash_lookup_key16_ext(\n@@ -1146,7 +1160,7 @@ rte_table_hash_lookup_key16_ext(\n \tRTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in -\n \t\t__builtin_popcountll(pkts_mask_out));\n \treturn 0;\n-} /* rte_table_hash_lookup_key16_ext() */\n+} /* lookup EXT */\n \n static int\n rte_table_hash_key16_stats_read(void *table, struct rte_table_stats *stats, int clear)\n@@ -1167,6 +1181,8 @@ struct rte_table_ops rte_table_hash_key16_lru_ops = {\n \t.f_free = rte_table_hash_free_key16_lru,\n \t.f_add = rte_table_hash_entry_add_key16_lru,\n \t.f_delete = rte_table_hash_entry_delete_key16_lru,\n+\t.f_add_bulk = NULL,\n+\t.f_delete_bulk = NULL,\n \t.f_lookup = rte_table_hash_lookup_key16_lru,\n \t.f_stats = rte_table_hash_key16_stats_read,\n };\n@@ -1176,6 +1192,8 @@ struct rte_table_ops rte_table_hash_key16_ext_ops = {\n \t.f_free = rte_table_hash_free_key16_ext,\n \t.f_add = rte_table_hash_entry_add_key16_ext,\n \t.f_delete = rte_table_hash_entry_delete_key16_ext,\n+\t.f_add_bulk = NULL,\n+\t.f_delete_bulk = NULL,\n \t.f_lookup = rte_table_hash_lookup_key16_ext,\n \t.f_stats = rte_table_hash_key16_stats_read,\n };\ndiff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c\nindex f542506..222c48c 100755\n--- a/test/test-pipeline/pipeline_hash.c\n+++ b/test/test-pipeline/pipeline_hash.c\n@@ -285,14 +285,15 @@ app_main_loop_worker_pipeline_hash(void) {\n \n \tcase e_APP_PIPELINE_HASH_SPEC_KEY16_EXT:\n \t{\n-\t\tstruct rte_table_hash_key16_ext_params table_hash_params = {\n-\t\t\t.n_entries = 1 << 24,\n-\t\t\t.n_entries_ext = 1 << 23,\n-\t\t\t.signature_offset = APP_METADATA_OFFSET(0),\n+\t\tstruct rte_table_hash_params table_hash_params = {\n+\t\t\t.name = \"TABLE\",\n+\t\t\t.key_size = key_size,\n \t\t\t.key_offset = APP_METADATA_OFFSET(32),\n-\t\t\t.f_hash = test_hash,\n-\t\t\t.seed = 0,\n \t\t\t.key_mask = NULL,\n+\t\t\t.n_keys = 1 << 24,\n+\t\t\t.n_buckets = 1 << 22,\n+\t\t\t.f_hash = (rte_table_hash_op_hash)test_hash,\n+\t\t\t.seed = 0,\n \t\t};\n \n \t\tstruct rte_pipeline_table_params table_params = {\n@@ -311,13 +312,15 @@ app_main_loop_worker_pipeline_hash(void) {\n \n \tcase e_APP_PIPELINE_HASH_SPEC_KEY16_LRU:\n \t{\n-\t\tstruct rte_table_hash_key16_lru_params table_hash_params = {\n-\t\t\t.n_entries = 1 << 24,\n-\t\t\t.signature_offset = APP_METADATA_OFFSET(0),\n+\t\tstruct rte_table_hash_params table_hash_params = {\n+\t\t\t.name = \"TABLE\",\n+\t\t\t.key_size = key_size,\n \t\t\t.key_offset = APP_METADATA_OFFSET(32),\n-\t\t\t.f_hash = test_hash,\n-\t\t\t.seed = 0,\n \t\t\t.key_mask = NULL,\n+\t\t\t.n_keys = 1 << 24,\n+\t\t\t.n_buckets = 1 << 22,\n+\t\t\t.f_hash = (rte_table_hash_op_hash)test_hash,\n+\t\t\t.seed = 0,\n \t\t};\n \n \t\tstruct rte_pipeline_table_params table_params = {\ndiff --git a/test/test/test_table_combined.c b/test/test/test_table_combined.c\nindex ddcd14b..4cfd955 100755\n--- a/test/test/test_table_combined.c\n+++ b/test/test/test_table_combined.c\n@@ -502,13 +502,15 @@ test_table_hash16lru(void)\n \tint status, i;\n \n \t/* Traffic flow */\n-\tstruct rte_table_hash_key16_lru_params key16lru_params = {\n-\t\t.n_entries = 1<<16,\n-\t\t.f_hash = pipeline_test_hash,\n-\t\t.seed = 0,\n-\t\t.signature_offset = APP_METADATA_OFFSET(0),\n+\tstruct rte_table_hash_params key16lru_params = {\n+\t\t.name = \"TABLE\",\n+\t\t.key_size = 16,\n \t\t.key_offset = APP_METADATA_OFFSET(32),\n \t\t.key_mask = NULL,\n+\t\t.n_keys = 1 << 16,\n+\t\t.n_buckets = 1 << 16,\n+\t\t.f_hash = (rte_table_hash_op_hash)pipeline_test_hash,\n+\t\t.seed = 0,\n \t};\n \n \tuint8_t key16lru[16];\n@@ -537,14 +539,14 @@ test_table_hash16lru(void)\n \tVERIFY(status, CHECK_TABLE_OK);\n \n \t/* Invalid parameters */\n-\tkey16lru_params.n_entries = 0;\n+\tkey16lru_params.n_keys = 0;\n \n \tstatus = test_table_type(&rte_table_hash_key16_lru_ops,\n \t\t(void *)&key16lru_params, (void *)key16lru, &table_packets,\n \t\t\tNULL, 0);\n \tVERIFY(status, CHECK_TABLE_TABLE_CONFIG);\n \n-\tkey16lru_params.n_entries = 1<<16;\n+\tkey16lru_params.n_keys = 1<<16;\n \tkey16lru_params.f_hash = NULL;\n \n \tstatus = test_table_type(&rte_table_hash_key16_lru_ops,\n@@ -680,14 +682,15 @@ test_table_hash16ext(void)\n \tint status, i;\n \n \t/* Traffic flow */\n-\tstruct rte_table_hash_key16_ext_params key16ext_params = {\n-\t\t.n_entries = 1<<16,\n-\t\t.n_entries_ext = 1<<15,\n-\t\t.f_hash = pipeline_test_hash,\n-\t\t.seed = 0,\n-\t\t.signature_offset = APP_METADATA_OFFSET(0),\n+\tstruct rte_table_hash_params key16ext_params = {\n+\t\t.name = \"TABLE\",\n+\t\t.key_size = 16,\n \t\t.key_offset = APP_METADATA_OFFSET(32),\n \t\t.key_mask = NULL,\n+\t\t.n_keys = 1 << 16,\n+\t\t.n_buckets = 1 << 16,\n+\t\t.f_hash = (rte_table_hash_op_hash)pipeline_test_hash,\n+\t\t.seed = 0,\n \t};\n \n \tuint8_t key16ext[16];\n@@ -716,14 +719,14 @@ test_table_hash16ext(void)\n \tVERIFY(status, CHECK_TABLE_OK);\n \n \t/* Invalid parameters */\n-\tkey16ext_params.n_entries = 0;\n+\tkey16ext_params.n_keys = 0;\n \n \tstatus = test_table_type(&rte_table_hash_key16_ext_ops,\n \t\t(void *)&key16ext_params, (void *)key16ext, &table_packets,\n \t\tNULL, 0);\n \tVERIFY(status, CHECK_TABLE_TABLE_CONFIG);\n \n-\tkey16ext_params.n_entries = 1<<16;\n+\tkey16ext_params.n_keys = 1<<16;\n \tkey16ext_params.f_hash = NULL;\n \n \tstatus = test_table_type(&rte_table_hash_key16_ext_ops,\n@@ -731,13 +734,6 @@ test_table_hash16ext(void)\n \t\tNULL, 0);\n \tVERIFY(status, CHECK_TABLE_TABLE_CONFIG);\n \n-\tkey16ext_params.f_hash = pipeline_test_hash;\n-\tkey16ext_params.n_entries_ext = 0;\n-\n-\tstatus = test_table_type(&rte_table_hash_key16_ext_ops,\n-\t(void *)&key16ext_params, (void *)key16ext, &table_packets, NULL, 0);\n-\tVERIFY(status, CHECK_TABLE_TABLE_CONFIG);\n-\n \treturn 0;\n }\n \ndiff --git a/test/test/test_table_tables.c b/test/test/test_table_tables.c\nindex 7f85587..2f916b7 100755\n--- a/test/test/test_table_tables.c\n+++ b/test/test/test_table_tables.c\n@@ -878,6 +878,11 @@ test_table_hash_lru(void)\n \tif (status < 0)\n \t\treturn status;\n \n+\tstatus = test_table_hash_lru_generic(\n+\t\t&rte_table_hash_key16_lru_ops,\n+\t\t16);\n+\tif (status < 0)\n+\t\treturn status;\n \tstatus = test_lru_update();\n \tif (status < 0)\n \t\treturn status;\n@@ -894,6 +899,9 @@ test_table_hash_ext(void)\n \tif (status < 0)\n \t\treturn status;\n \n+\tstatus = test_table_hash_ext_generic(&rte_table_hash_key16_ext_ops, 16);\n+\tif (status < 0)\n+\t\treturn status;\n \treturn 0;\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "11/18"
    ]
}