On 6/5/23 02:24, Ivan Malov wrote:
From: Denis Pryazhennikov <denis.pryazhenni...@arknetworks.am>
The patch adds APIs to initialise, manipulate and finalise
HW tables API-specific context in NIC control structure.
The context itself will be used to store HW tables-related info,
like table descriptors and field descriptors.
Signed-off-by: Denis Pryazhennikov <denis.pryazhenni...@arknetworks.am>
Reviewed-by: Ivan Malov <ivan.ma...@arknetworks.am>
Reviewed-by: Andy Moreton <amore...@xilinx.com>
[snip]
+int
+sfc_tbl_meta_cache_ctor(struct rte_hash **ref_cache)
+{
+ size_t cache_size = RTE_MAX((unsigned int)SFC_TBL_META_CACHE_SIZE_MIN,
+ efx_table_supported_num_get());
+ struct rte_hash *cache = NULL;
+ const struct rte_hash_parameters hash_params = {
+ .name = "meta_hash_table",
+ .hash_func = rte_jhash,
+ .entries = cache_size,
+ .socket_id = rte_socket_id(),
+ .key_len = sizeof(efx_table_id_t),
+ };
+
+ cache = rte_hash_create(&hash_params);
+ if (!cache)
Compare vs NULL as DPDK coding style says
+ return -ENOMEM;
+
+ *ref_cache = cache;
+
+ return 0;
+}