da65740a16
Add key comparison functions to be used by the exact match and the learner table types as part of the performance critical lookup operation. Since the key size is fixed, it is possible to select a specialized memory copy function as opposed to using the variable size version, resulting in a performance improvement of around 5%. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
50 lines
926 B
C
50 lines
926 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2022 Intel Corporation
|
|
*/
|
|
#ifndef __INCLUDE_RTE_SWX_KEYCMP_H__
|
|
#define __INCLUDE_RTE_SWX_KEYCMP_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @file
|
|
* RTE SWX Key Comparison Functions
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
/**
|
|
* Key comparison function prototype
|
|
*
|
|
* @param[in] key1
|
|
* First key to compare. Must be non-NULL.
|
|
* @param[in] key2
|
|
* Second key to compare. Must be non-NULL.
|
|
* @param[in] key_size
|
|
* Key size in bytes.
|
|
* @return
|
|
* 0 when keys are different, 1 when keys are equal.
|
|
*/
|
|
typedef uint32_t
|
|
(*rte_swx_keycmp_func_t)(void *key1, void *key2, uint32_t key_size);
|
|
|
|
/**
|
|
* Key comparison function get
|
|
*
|
|
* @param[in] key_size
|
|
* Key size in bytes.
|
|
* @return
|
|
* Key comparison function for the given key size
|
|
*/
|
|
rte_swx_keycmp_func_t
|
|
rte_swx_keycmp_func_get(uint32_t key_size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|