net/bnxt: support EM and TCAM lookup with table scope
[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         TF_SUBTYPE_LAST = HWRM_TFT_TBL_TYPE_BULK_GET,
20 } tf_subtype_t;
21
22 /* Request and Response compile time checking */
23 /* u32_t        tlv_req_value[26]; */
24 #define TF_MAX_REQ_SIZE 104
25 /* u32_t        tlv_resp_value[170]; */
26 #define TF_MAX_RESP_SIZE 680
27
28 /* Use this to allocate/free any kind of
29  * indexes over HWRM and fill the parms pointer
30  */
31 #define TF_BULK_RECV     128
32 #define TF_BULK_SEND      16
33
34 /* EM Key value */
35 #define TF_DEV_DATA_TYPE_TF_EM_RULE_INSERT_KEY_DATA 0x2e30UL
36 /* EM Key value */
37 #define TF_DEV_DATA_TYPE_TF_EM_RULE_DELETE_KEY_DATA 0x2e40UL
38 /* L2 Context DMA Address Type */
39 #define TF_DEV_DATA_TYPE_TF_L2_CTX_DMA_ADDR             0x2fe0UL
40 /* L2 Context Entry */
41 #define TF_DEV_DATA_TYPE_TF_L2_CTX_ENTRY                0x2fe1UL
42 /* Prof tcam DMA Address Type */
43 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_DMA_ADDR          0x3030UL
44 /* Prof tcam Entry */
45 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_ENTRY             0x3031UL
46 /* WC DMA Address Type */
47 #define TF_DEV_DATA_TYPE_TF_WC_DMA_ADDR                 0x30d0UL
48 /* WC Entry */
49 #define TF_DEV_DATA_TYPE_TF_WC_ENTRY                    0x30d1UL
50 /* Action Data */
51 #define TF_DEV_DATA_TYPE_TF_ACTION_DATA                 0x3170UL
52 #define TF_DEV_DATA_TYPE_LAST   TF_DEV_DATA_TYPE_TF_ACTION_DATA
53
54 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
55 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
56
57 struct tf_tbl_type_bulk_get_input;
58 struct tf_tbl_type_bulk_get_output;
59
60 /* Input params for table type get */
61 typedef struct tf_tbl_type_bulk_get_input {
62         /* Session Id */
63         uint32_t                         fw_session_id;
64         /* flags */
65         uint16_t                         flags;
66         /* When set to 0, indicates the get apply to RX */
67 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX    (0x0)
68         /* When set to 1, indicates the get apply to TX */
69 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX    (0x1)
70         /* When set to 1, indicates the clear entry on read */
71 #define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ    (0x2)
72         /* Type of the object to set */
73         uint32_t                         type;
74         /* Starting index to get from */
75         uint32_t                         start_index;
76         /* Number of entries to get */
77         uint32_t                         num_entries;
78         /* Host memory where data will be stored */
79         uint64_t                         host_addr;
80 } tf_tbl_type_bulk_get_input_t, *ptf_tbl_type_bulk_get_input_t;
81
82 /* Output params for table type get */
83 typedef struct tf_tbl_type_bulk_get_output {
84         /* Size of the total data read in bytes */
85         uint16_t                         size;
86 } tf_tbl_type_bulk_get_output_t, *ptf_tbl_type_bulk_get_output_t;
87
88 #endif /* _HWRM_TF_H_ */