net/bnxt: remove unused macro
[dpdk.git] / drivers / net / bnxt / tf_core / tf_global_cfg.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef TF_GLOBAL_CFG_H_
7 #define TF_GLOBAL_CFG_H_
8
9 #include "tf_core.h"
10 #include "stack.h"
11
12 /**
13  * The global cfg module provides processing of global cfg types.
14  */
15
16 struct tf;
17
18 /**
19  * Global cfg configuration enumeration.
20  */
21 enum tf_global_cfg_cfg_type {
22         /**
23          * No configuration
24          */
25         TF_GLOBAL_CFG_CFG_NULL,
26         /**
27          * HCAPI 'controlled'
28          */
29         TF_GLOBAL_CFG_CFG_HCAPI,
30 };
31
32 /**
33  * Global cfg configuration structure, used by the Device to configure
34  * how an individual global cfg type is configured in regard to the HCAPI type.
35  */
36 struct tf_global_cfg_cfg {
37         /**
38          * Global cfg config controls how the DB for that element is
39          * processed.
40          */
41         enum tf_global_cfg_cfg_type cfg_type;
42
43         /**
44          * HCAPI Type for the element. Used for TF to HCAPI type
45          * conversion.
46          */
47         uint16_t hcapi_type;
48 };
49
50 /**
51  * Global Cfg configuration parameters
52  */
53 struct tf_global_cfg_cfg_parms {
54         /**
55          * Number of table types in the configuration array
56          */
57         uint16_t num_elements;
58         /**
59          * Table Type element configuration array
60          */
61         struct tf_global_cfg_cfg *cfg;
62 };
63
64 /**
65  * global cfg parameters
66  */
67 struct tf_dev_global_cfg_parms {
68         /**
69          * [in] Receive or transmit direction
70          */
71         enum tf_dir dir;
72         /**
73          * [in] Global config type
74          */
75         enum tf_global_config_type type;
76         /**
77          * [in] Offset @ the type
78          */
79         uint32_t offset;
80         /**
81          * [in/out] Value of the configuration
82          * set - Read, Modify and Write
83          * get - Read the full configuration
84          */
85         uint8_t *config;
86         /**
87          * [in] struct containing size
88          */
89         uint16_t config_sz_in_bytes;
90 };
91
92 /**
93  * @page global cfg
94  *
95  * @ref tf_global_cfg_bind
96  *
97  * @ref tf_global_cfg_unbind
98  *
99  * @ref tf_global_cfg_set
100  *
101  * @ref tf_global_cfg_get
102  *
103  */
104 /**
105  * Initializes the Global Cfg module with the requested DBs. Must be
106  * invoked as the first thing before any of the access functions.
107  *
108  * [in] tfp
109  *   Pointer to TF handle
110  *
111  * [in] parms
112  *   Pointer to Global Cfg configuration parameters
113  *
114  * Returns
115  *   - (0) if successful.
116  *   - (-EINVAL) on failure.
117  */
118 int
119 tf_global_cfg_bind(struct tf *tfp,
120                    struct tf_global_cfg_cfg_parms *parms);
121
122 /**
123  * Cleans up the private DBs and releases all the data.
124  *
125  * [in] tfp
126  *   Pointer to TF handle
127  *
128  * [in] parms
129  *   Pointer to Global Cfg configuration parameters
130  *
131  * Returns
132  *   - (0) if successful.
133  *   - (-EINVAL) on failure.
134  */
135 int
136 tf_global_cfg_unbind(struct tf *tfp);
137
138 /**
139  * Updates the global configuration table
140  *
141  * [in] tfp
142  *   Pointer to TF handle, used for HCAPI communication
143  *
144  * [in] parms
145  *   Pointer to global cfg parameters
146  *
147  * Returns
148  *   - (0) if successful.
149  *   - (-EINVAL) on failure.
150  */
151 int tf_global_cfg_set(struct tf *tfp,
152                       struct tf_dev_global_cfg_parms *parms);
153
154 /**
155  * Get global configuration
156  *
157  * [in] tfp
158  *   Pointer to TF handle, used for HCAPI communication
159  *
160  * [in] parms
161  *   Pointer to global cfg parameters
162  *
163  * Returns
164  *   - (0) if successful.
165  *   - (-EINVAL) on failure.
166  */
167 int tf_global_cfg_get(struct tf *tfp,
168                       struct tf_dev_global_cfg_parms *parms);
169
170 #endif /* TF_GLOBAL_CFG_H */