xref: /dpdk/lib/table/rte_table_array.h (revision 99a2dd95)
1*99a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
2*99a2dd95SBruce Richardson  * Copyright(c) 2010-2014 Intel Corporation
3*99a2dd95SBruce Richardson  */
4*99a2dd95SBruce Richardson 
5*99a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_TABLE_ARRAY_H__
6*99a2dd95SBruce Richardson #define __INCLUDE_RTE_TABLE_ARRAY_H__
7*99a2dd95SBruce Richardson 
8*99a2dd95SBruce Richardson #ifdef __cplusplus
9*99a2dd95SBruce Richardson extern "C" {
10*99a2dd95SBruce Richardson #endif
11*99a2dd95SBruce Richardson 
12*99a2dd95SBruce Richardson /**
13*99a2dd95SBruce Richardson  * @file
14*99a2dd95SBruce Richardson  * RTE Table Array
15*99a2dd95SBruce Richardson  *
16*99a2dd95SBruce Richardson  * Simple array indexing. Lookup key is the array entry index.
17*99a2dd95SBruce Richardson  *
18*99a2dd95SBruce Richardson  ***/
19*99a2dd95SBruce Richardson 
20*99a2dd95SBruce Richardson #include <stdint.h>
21*99a2dd95SBruce Richardson 
22*99a2dd95SBruce Richardson #include "rte_table.h"
23*99a2dd95SBruce Richardson 
24*99a2dd95SBruce Richardson /** Array table parameters */
25*99a2dd95SBruce Richardson struct rte_table_array_params {
26*99a2dd95SBruce Richardson 	/** Number of array entries. Has to be a power of two. */
27*99a2dd95SBruce Richardson 	uint32_t n_entries;
28*99a2dd95SBruce Richardson 
29*99a2dd95SBruce Richardson 	/** Byte offset within input packet meta-data where lookup key (i.e. the
30*99a2dd95SBruce Richardson 	    array entry index) is located. */
31*99a2dd95SBruce Richardson 	uint32_t offset;
32*99a2dd95SBruce Richardson };
33*99a2dd95SBruce Richardson 
34*99a2dd95SBruce Richardson /** Array table key format */
35*99a2dd95SBruce Richardson struct rte_table_array_key {
36*99a2dd95SBruce Richardson 	/** Array entry index */
37*99a2dd95SBruce Richardson 	uint32_t pos;
38*99a2dd95SBruce Richardson };
39*99a2dd95SBruce Richardson 
40*99a2dd95SBruce Richardson /** Array table operations */
41*99a2dd95SBruce Richardson extern struct rte_table_ops rte_table_array_ops;
42*99a2dd95SBruce Richardson 
43*99a2dd95SBruce Richardson #ifdef __cplusplus
44*99a2dd95SBruce Richardson }
45*99a2dd95SBruce Richardson #endif
46*99a2dd95SBruce Richardson 
47*99a2dd95SBruce Richardson #endif
48