net/bnxt: modify resource reservation strategy
[dpdk.git] / drivers / net / bnxt / tf_core / tf_util.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2021 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_UTIL_H_
7 #define _TF_UTIL_H_
8
9 #include "tf_core.h"
10 #include "tf_device.h"
11
12 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
13 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
14 #define TF_BITS2BYTES_64B_WORD_ALIGN(x) ((((x) + 63) >> 6) * 8)
15
16 /**
17  * Helper function converting direction to text string
18  *
19  * [in] dir
20  *   Receive or transmit direction identifier
21  *
22  * Returns:
23  *   Pointer to a char string holding the string for the direction
24  */
25 const char *tf_dir_2_str(enum tf_dir dir);
26
27 /**
28  * Helper function converting identifier to text string
29  *
30  * [in] id_type
31  *   Identifier type
32  *
33  * Returns:
34  *   Pointer to a char string holding the string for the identifier
35  */
36 const char *tf_ident_2_str(enum tf_identifier_type id_type);
37
38 /**
39  * Helper function converting tcam type to text string
40  *
41  * [in] tcam_type
42  *   TCAM type
43  *
44  * Returns:
45  *   Pointer to a char string holding the string for the tcam
46  */
47 const char *tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type);
48
49 /**
50  * Helper function converting tbl type to text string
51  *
52  * [in] tbl_type
53  *   Table type
54  *
55  * Returns:
56  *   Pointer to a char string holding the string for the table type
57  */
58 const char *tf_tbl_type_2_str(enum tf_tbl_type tbl_type);
59
60 /**
61  * Helper function converting em tbl type to text string
62  *
63  * [in] em_type
64  *   EM type
65  *
66  * Returns:
67  *   Pointer to a char string holding the string for the EM type
68  */
69 const char *tf_em_tbl_type_2_str(enum tf_em_tbl_type em_type);
70
71 /**
72  * Helper function converting module and submodule type to
73  * text string.
74  *
75  * [in] module
76  *   Module type
77  *
78  * [in] submodule
79  *   Module specific subtype
80  *
81  * Returns:
82  *   Pointer to a char string holding the string for the EM type
83  */
84 const char *tf_module_subtype_2_str(enum tf_module_type module,
85                                     uint16_t subtype);
86
87 /**
88  * Helper function converting module type to text string
89  *
90  * [in] module
91  *   Module type
92  *
93  * Returns:
94  *   Pointer to a char string holding the string for the EM type
95  */
96 const char *tf_module_2_str(enum tf_module_type module);
97
98 #endif /* _TF_UTIL_H_ */