32f1523142db92c5cc5c45256f7d6afdf839b136
[dpdk.git] / drivers / net / bnxt / tf_core / hwrm_tf.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019 Broadcom
3  * All rights reserved.
4  */
5 #ifndef _HWRM_TF_H_
6 #define _HWRM_TF_H_
7
8 #include "tf_core.h"
9
10 typedef enum tf_type {
11         TF_TYPE_TRUFLOW,
12         TF_TYPE_LAST = TF_TYPE_TRUFLOW,
13 } tf_type_t;
14
15 typedef enum tf_subtype {
16         HWRM_TFT_REG_GET = 821,
17         HWRM_TFT_REG_SET = 822,
18         HWRM_TFT_TBL_TYPE_BULK_GET = 825,
19         HWRM_TFT_IF_TBL_SET = 827,
20         HWRM_TFT_IF_TBL_GET = 828,
21         TF_SUBTYPE_LAST = HWRM_TFT_IF_TBL_GET,
22 } tf_subtype_t;
23
24 /* Request and Response compile time checking */
25 /* u32_t        tlv_req_value[26]; */
26 #define TF_MAX_REQ_SIZE 104
27 /* u32_t        tlv_resp_value[170]; */
28 #define TF_MAX_RESP_SIZE 680
29
30 /* Use this to allocate/free any kind of
31  * indexes over HWRM and fill the parms pointer
32  */
33 #define TF_BULK_RECV     128
34 #define TF_BULK_SEND      16
35
36 /* EM Key value */
37 #define TF_DEV_DATA_TYPE_TF_EM_RULE_INSERT_KEY_DATA 0x2e30UL
38 /* EM Key value */
39 #define TF_DEV_DATA_TYPE_TF_EM_RULE_DELETE_KEY_DATA 0x2e40UL
40 /* L2 Context DMA Address Type */
41 #define TF_DEV_DATA_TYPE_TF_L2_CTX_DMA_ADDR             0x2fe0UL
42 /* L2 Context Entry */
43 #define TF_DEV_DATA_TYPE_TF_L2_CTX_ENTRY                0x2fe1UL
44 /* Prof tcam DMA Address Type */
45 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_DMA_ADDR          0x3030UL
46 /* Prof tcam Entry */
47 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_ENTRY             0x3031UL
48 /* WC DMA Address Type */
49 #define TF_DEV_DATA_TYPE_TF_WC_DMA_ADDR                 0x30d0UL
50 /* WC Entry */
51 #define TF_DEV_DATA_TYPE_TF_WC_ENTRY                            0x30d1UL
52 /* SPIF DFLT L2 CTXT Entry */
53 #define TF_DEV_DATA_TYPE_SPIF_DFLT_L2_CTXT                0x3131UL
54 /* PARIF DFLT ACT REC PTR Entry */
55 #define TF_DEV_DATA_TYPE_PARIF_DFLT_ACT_REC             0x3132UL
56 /* PARIF ERR DFLT ACT REC PTR Entry */
57 #define TF_DEV_DATA_TYPE_PARIF_ERR_DFLT_ACT_REC  0x3133UL
58 /* ILT Entry */
59 #define TF_DEV_DATA_TYPE_ILT                            0x3134UL
60 /* VNIC SVIF entry */
61 #define TF_DEV_DATA_TYPE_VNIC_SVIF                      0x3135UL
62 /* Action Data */
63 #define TF_DEV_DATA_TYPE_TF_ACTION_DATA                 0x3170UL
64 #define TF_DEV_DATA_TYPE_LAST   TF_DEV_DATA_TYPE_TF_ACTION_DATA
65
66 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
67 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
68
69 struct tf_tbl_type_bulk_get_input;
70 struct tf_tbl_type_bulk_get_output;
71 struct tf_if_tbl_set_input;
72 struct tf_if_tbl_get_input;
73 struct tf_if_tbl_get_output;
74
75 /* Input params for table type get */
76 typedef struct tf_tbl_type_bulk_get_input {
77         /* Session Id */
78         uint32_t                         fw_session_id;
79         /* flags */
80         uint16_t                         flags;
81         /* When set to 0, indicates the get apply to RX */
82 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX    (0x0)
83         /* When set to 1, indicates the get apply to TX */
84 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX    (0x1)
85         /* When set to 1, indicates the clear entry on read */
86 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ    (0x2)
87         /* Type of the object to set */
88         uint32_t                         type;
89         /* Starting index to get from */
90         uint32_t                         start_index;
91         /* Number of entries to get */
92         uint32_t                         num_entries;
93         /* Host memory where data will be stored */
94         uint64_t                         host_addr;
95 } tf_tbl_type_bulk_get_input_t, *ptf_tbl_type_bulk_get_input_t;
96
97 /* Output params for table type get */
98 typedef struct tf_tbl_type_bulk_get_output {
99         /* Size of the total data read in bytes */
100         uint16_t                         size;
101 } tf_tbl_type_bulk_get_output_t, *ptf_tbl_type_bulk_get_output_t;
102
103 /* Input params for if tbl set */
104 typedef struct tf_if_tbl_set_input {
105         /* Session Id */
106         uint32_t                         fw_session_id;
107         /* flags */
108         uint16_t                         flags;
109         /* When set to 0, indicates the query apply to RX */
110 #define TF_IF_TBL_SET_INPUT_FLAGS_DIR_RX                          (0x0)
111         /* When set to 1, indicates the query apply to TX */
112 #define TF_IF_TBL_SET_INPUT_FLAGS_DIR_TX                          (0x1)
113         /* if table type */
114         uint16_t                         tf_if_tbl_type;
115         /* index of table entry */
116         uint16_t                         idx;
117         /* size of the data write to table entry */
118         uint32_t                         data_sz_in_bytes;
119         /* data to write into table entry */
120         uint32_t                         data[2];
121 } tf_if_tbl_set_input_t, *ptf_if_tbl_set_input_t;
122
123 /* Input params for if tbl get */
124 typedef struct tf_if_tbl_get_input {
125         /* Session Id */
126         uint32_t                         fw_session_id;
127         /* flags */
128         uint16_t                         flags;
129         /* When set to 0, indicates the query apply to RX */
130 #define TF_IF_TBL_GET_INPUT_FLAGS_DIR_RX                          (0x0)
131         /* When set to 1, indicates the query apply to TX */
132 #define TF_IF_TBL_GET_INPUT_FLAGS_DIR_TX                          (0x1)
133         /* if table type */
134         uint16_t                         tf_if_tbl_type;
135         /* size of the data get from table entry */
136         uint32_t                         data_sz_in_bytes;
137         /* index of table entry */
138         uint16_t                         idx;
139 } tf_if_tbl_get_input_t, *ptf_if_tbl_get_input_t;
140
141 /* output params for if tbl get */
142 typedef struct tf_if_tbl_get_output {
143         /* Value read from table entry */
144         uint32_t                         data[2];
145 } tf_if_tbl_get_output_t, *ptf_if_tbl_get_output_t;
146
147 #endif /* _HWRM_TF_H_ */