net/bnxt: support bulk table get and mirror
[dpdk.git] / drivers / net / bnxt / tf_core / tf_identifier.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_IDENTIFIER_H_
7 #define _TF_IDENTIFIER_H_
8
9 #include "tf_core.h"
10
11 /**
12  * The Identifier module provides processing of Identifiers.
13  */
14
15 struct tf_ident_cfg {
16         /**
17          * Number of identifier types in each of the configuration
18          * arrays
19          */
20         uint16_t num_elements;
21
22         /**
23          * TCAM configuration array
24          */
25         struct tf_rm_element_cfg *ident_cfg[TF_DIR_MAX];
26 };
27
28 /**
29  * Identifier allcoation parameter definition
30  */
31 struct tf_ident_alloc_parms {
32         /**
33          * [in] receive or transmit direction
34          */
35         enum tf_dir dir;
36         /**
37          * [in] Identifier type
38          */
39         enum tf_identifier_type ident_type;
40         /**
41          * [out] Identifier allocated
42          */
43         uint16_t id;
44 };
45
46 /**
47  * Identifier free parameter definition
48  */
49 struct tf_ident_free_parms {
50         /**
51          * [in]  receive or transmit direction
52          */
53         enum tf_dir dir;
54         /**
55          * [in] Identifier type
56          */
57         enum tf_identifier_type ident_type;
58         /**
59          * [in] ID to free
60          */
61         uint16_t id;
62 };
63
64 /**
65  * @page ident Identity Management
66  *
67  * @ref tf_ident_bind
68  *
69  * @ref tf_ident_unbind
70  *
71  * @ref tf_ident_alloc
72  *
73  * @ref tf_ident_free
74  */
75
76 /**
77  * Initializes the Identifier module with the requested DBs. Must be
78  * invoked as the first thing before any of the access functions.
79  *
80  * [in] tfp
81  *   Pointer to TF handle, used for HCAPI communication
82  *
83  * [in] parms
84  *   Pointer to parameters
85  *
86  * Returns
87  *   - (0) if successful.
88  *   - (-EINVAL) on failure.
89  */
90 int tf_ident_bind(struct tf *tfp,
91                   struct tf_ident_cfg *parms);
92
93 /**
94  * Cleans up the private DBs and releases all the data.
95  *
96  * [in] tfp
97  *   Pointer to TF handle, used for HCAPI communication
98  *
99  * [in] parms
100  *   Pointer to parameters
101  *
102  * Returns
103  *   - (0) if successful.
104  *   - (-EINVAL) on failure.
105  */
106 int tf_ident_unbind(struct tf *tfp);
107
108 /**
109  * Allocates a single identifier type.
110  *
111  * [in] tfp
112  *   Pointer to TF handle, used for HCAPI communication
113  *
114  * [in] parms
115  *   Pointer to parameters
116  *
117  * Returns
118  *   - (0) if successful.
119  *   - (-EINVAL) on failure.
120  */
121 int tf_ident_alloc(struct tf *tfp,
122                    struct tf_ident_alloc_parms *parms);
123
124 /**
125  * Free's a single identifier type.
126  *
127  * [in] tfp
128  *   Pointer to TF handle, used for HCAPI communication
129  *
130  * [in] parms
131  *   Pointer to parameters
132  *
133  * Returns
134  *   - (0) if successful.
135  *   - (-EINVAL) on failure.
136  */
137 int tf_ident_free(struct tf *tfp,
138                   struct tf_ident_free_parms *parms);
139
140 #endif /* _TF_IDENTIFIER_H_ */