net/bnxt: support shared TCAM region
[dpdk.git] / drivers / net / bnxt / tf_core / tf_tcam_shared.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2021 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_TCAM_SHARED_H_
7 #define _TF_TCAM_SHARED_H_
8
9 #include "tf_core.h"
10 #include "tf_tcam.h"
11
12 /**
13  * @page tcam_shared TCAM SHARED
14  *
15  * @ref tf_tcam_shared_bind
16  *
17  * @ref tf_tcam_shared_unbind
18  *
19  * @ref tf_tcam_shared_alloc
20  *
21  * @ref tf_tcam_shared_free
22  *
23  * @ref tf_tcam_shared_set
24  *
25  * @ref tf_tcam_shared_get
26  *
27  */
28
29 /**
30  * Initializes the TCAM shared module with the requested DBs. Must be
31  * invoked as the first thing before any of the access functions.
32  *
33  * [in] tfp
34  *   Pointer to the truflow handle
35  *
36  * [in] parms
37  *   Pointer to parameters
38  *
39  * Returns
40  *   - (0) if successful.
41  *   - (-EINVAL) on failure.
42  */
43 int tf_tcam_shared_bind(struct tf *tfp,
44                         struct tf_tcam_cfg_parms *parms);
45
46 /**
47  * Cleans up the private DBs and releases all the data.
48  *
49  * [in] tfp
50  *   Pointer to the truflow handle
51  *
52  * [in] parms
53  *   Pointer to parameters
54  *
55  * Returns
56  *   - (0) if successful.
57  *   - (-EINVAL) on failure.
58  */
59 int tf_tcam_shared_unbind(struct tf *tfp);
60
61 /**
62  * Allocates the requested tcam type from the internal RM DB.
63  *
64  * [in] tfp
65  *   Pointer to the truflow handle
66  *
67  * [in] parms
68  *   Pointer to parameters
69  *
70  * Returns
71  *   - (0) if successful.
72  *   - (-EINVAL) on failure.
73  */
74 int tf_tcam_shared_alloc(struct tf *tfp,
75                          struct tf_tcam_alloc_parms *parms);
76
77 /**
78  * Free's the requested table type and returns it to the DB.
79  *
80  * [in] tfp
81  *   Pointer to the truflow handle
82  *
83  * [in] parms
84  *   Pointer to parameters
85  *
86  * Returns
87  *   - (0) if successful.
88  *   - (-EINVAL) on failure.
89  */
90 int tf_tcam_shared_free(struct tf *tfp,
91                         struct tf_tcam_free_parms *parms);
92
93 /**
94  * Configures the requested element by sending a firmware request which
95  * then installs it into the device internal structures.
96  *
97  * [in] tfp
98  *   Pointer to the truflow handle
99  *
100  * [in] parms
101  *   Pointer to parameters
102  *
103  * Returns
104  *   - (0) if successful.
105  *   - (-EINVAL) on failure.
106  */
107 int tf_tcam_shared_set(struct tf *tfp,
108                        struct tf_tcam_set_parms *parms);
109
110 /**
111  * Retrieves the requested element by sending a firmware request to get
112  * the element.
113  *
114  * [in] tfp
115  *   Pointer to the truflow handle
116  *
117  * [in] parms
118  *   Pointer to parameters
119  *
120  * Returns
121  *   - (0) if successful.
122  *   - (-EINVAL) on failure.
123  */
124 int tf_tcam_shared_get(struct tf *tfp,
125                        struct tf_tcam_get_parms *parms);
126
127 #endif /* _TF_TCAM_SHARED_H */