net/bnxt: update multi device design
[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_parms {
16         /**
17          * [in] Number of identifier types in each of the
18          * configuration arrays
19          */
20         uint16_t num_elements;
21         /**
22          * [in] Identifier configuration array
23          */
24         struct tf_rm_element_cfg *cfg;
25         /**
26          * [in] Boolean controlling the request shadow copy.
27          */
28         bool shadow_copy;
29         /**
30          * [in] Session resource allocations
31          */
32         struct tf_session_resources *resources;
33 };
34
35 /**
36  * Identifier allocation parameter definition
37  */
38 struct tf_ident_alloc_parms {
39         /**
40          * [in] receive or transmit direction
41          */
42         enum tf_dir dir;
43         /**
44          * [in] Identifier type
45          */
46         enum tf_identifier_type ident_type;
47         /**
48          * [out] Identifier allocated
49          */
50         uint16_t *id;
51 };
52
53 /**
54  * Identifier free parameter definition
55  */
56 struct tf_ident_free_parms {
57         /**
58          * [in]  receive or transmit direction
59          */
60         enum tf_dir dir;
61         /**
62          * [in] Identifier type
63          */
64         enum tf_identifier_type ident_type;
65         /**
66          * [in] ID to free
67          */
68         uint16_t id;
69 };
70
71 /**
72  * @page ident Identity Management
73  *
74  * @ref tf_ident_bind
75  *
76  * @ref tf_ident_unbind
77  *
78  * @ref tf_ident_alloc
79  *
80  * @ref tf_ident_free
81  */
82
83 /**
84  * Initializes the Identifier module with the requested DBs. Must be
85  * invoked as the first thing before any of the access functions.
86  *
87  * [in] tfp
88  *   Pointer to TF handle, used for HCAPI communication
89  *
90  * [in] parms
91  *   Pointer to parameters
92  *
93  * Returns
94  *   - (0) if successful.
95  *   - (-EINVAL) on failure.
96  */
97 int tf_ident_bind(struct tf *tfp,
98                   struct tf_ident_cfg_parms *parms);
99
100 /**
101  * Cleans up the private DBs and releases all the data.
102  *
103  * [in] tfp
104  *   Pointer to TF handle, used for HCAPI communication
105  *
106  * [in] parms
107  *   Pointer to parameters
108  *
109  * Returns
110  *   - (0) if successful.
111  *   - (-EINVAL) on failure.
112  */
113 int tf_ident_unbind(struct tf *tfp);
114
115 /**
116  * Allocates a single identifier type.
117  *
118  * [in] tfp
119  *   Pointer to TF handle, used for HCAPI communication
120  *
121  * [in] parms
122  *   Pointer to parameters
123  *
124  * Returns
125  *   - (0) if successful.
126  *   - (-EINVAL) on failure.
127  */
128 int tf_ident_alloc(struct tf *tfp,
129                    struct tf_ident_alloc_parms *parms);
130
131 /**
132  * Free's a single identifier type.
133  *
134  * [in] tfp
135  *   Pointer to TF handle, used for HCAPI communication
136  *
137  * [in] parms
138  *   Pointer to parameters
139  *
140  * Returns
141  *   - (0) if successful.
142  *   - (-EINVAL) on failure.
143  */
144 int tf_ident_free(struct tf *tfp,
145                   struct tf_ident_free_parms *parms);
146
147 #endif /* _TF_IDENTIFIER_H_ */