New upstream version 18.05
[deb_dpdk.git] / lib / librte_table / rte_table_hash_cuckoo.c
index f3845c7..f024303 100644 (file)
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2017 Intel Corporation
  */
 #include <string.h>
 #include <stdio.h>
@@ -39,8 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 
-#include <rte_hash.h>
-#include "rte_table_hash.h"
+#include "rte_table_hash_cuckoo.h"
 
 #ifdef RTE_TABLE_STATS_COLLECT
 
@@ -64,7 +34,7 @@ struct rte_table_hash {
        uint32_t key_size;
        uint32_t entry_size;
        uint32_t n_keys;
-       rte_table_hash_op_hash f_hash;
+       rte_hash_function f_hash;
        uint32_t seed;
        uint32_t key_offset;
 
@@ -76,7 +46,7 @@ struct rte_table_hash {
 };
 
 static int
-check_params_create_hash_cuckoo(struct rte_table_hash_params *params)
+check_params_create_hash_cuckoo(struct rte_table_hash_cuckoo_params *params)
 {
        if (params == NULL) {
                RTE_LOG(ERR, TABLE, "NULL Input Parameters.\n");
@@ -111,7 +81,7 @@ rte_table_hash_cuckoo_create(void *params,
                        int socket_id,
                        uint32_t entry_size)
 {
-       struct rte_table_hash_params *p = params;
+       struct rte_table_hash_cuckoo_params *p = params;
        struct rte_hash *h_table;
        struct rte_table_hash *t;
        uint32_t total_size;
@@ -136,7 +106,7 @@ rte_table_hash_cuckoo_create(void *params,
        struct rte_hash_parameters hash_cuckoo_params = {
                .entries = p->n_keys,
                .key_len = p->key_size,
-               .hash_func = (rte_hash_function)(p->f_hash),
+               .hash_func = p->f_hash,
                .hash_func_init_val = p->seed,
                .socket_id = socket_id,
                .name = p->name