1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2019 Broadcom
11 #include <rte_flow_driver.h>
13 #include "ulp_template_db_enum.h"
14 #include "ulp_template_struct.h"
16 #include "ulp_utils.h"
18 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
21 * The cache table opcode is used to convey informat from the cache handler
22 * to the tcam handler. The opcodes do the following:
23 * NORMAL - tcam should process all instructions as normal
24 * SKIP - tcam is using the cached entry and doesn't need to process the
26 * ALLOC - tcam needs to allocate the tcam index and store in the cache entry
28 enum bnxt_ulp_cache_table_opc {
29 BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL,
30 BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_SKIP,
31 BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_ALLOC
34 struct bnxt_ulp_mapper_cache_entry {
37 uint16_t idents[BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM];
38 uint8_t ident_types[BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM];
41 struct bnxt_ulp_mapper_glb_resource_entry {
42 enum bnxt_ulp_resource_func resource_func;
43 uint32_t resource_type; /* TF_ enum type */
44 uint64_t resource_hndl;
47 struct bnxt_ulp_mapper_data {
48 struct bnxt_ulp_mapper_glb_resource_entry
49 glb_res_tbl[TF_DIR_MAX][BNXT_ULP_GLB_RESOURCE_INFO_TBL_MAX_SZ];
50 struct bnxt_ulp_mapper_cache_entry
51 *cache_tbl[BNXT_ULP_CACHE_TBL_MAX_SZ];
54 /* Internal Structure for passing the arguments around */
55 struct bnxt_ulp_mapper_parms {
58 struct bnxt_ulp_mapper_tbl_info *atbls; /* action table */
61 struct bnxt_ulp_mapper_tbl_info *ctbls; /* class table */
63 struct ulp_rte_act_prop *act_prop;
64 struct ulp_rte_act_bitmap *act_bitmap;
65 struct ulp_rte_hdr_field *hdr_field;
67 struct ulp_regfile *regfile;
69 struct bnxt_ulp_context *ulp_ctx;
70 uint8_t encap_byte_swap;
72 enum bnxt_ulp_flow_db_tables tbl_idx;
73 struct bnxt_ulp_mapper_data *mapper_data;
74 enum bnxt_ulp_cache_table_opc tcam_tbl_opc;
75 struct bnxt_ulp_mapper_cache_entry *cache_ptr;
76 struct bnxt_ulp_device_params *device_params;
79 struct bnxt_ulp_mapper_create_parms {
80 uint32_t app_priority;
81 struct ulp_rte_hdr_bitmap *hdr_bitmap;
82 struct ulp_rte_hdr_field *hdr_field;
84 struct ulp_rte_act_bitmap *act;
85 struct ulp_rte_act_prop *act_prop;
89 enum ulp_direction_type dir;
92 /* Function to initialize any dynamic mapper data. */
94 ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx);
96 /* Function to release all dynamic mapper data. */
98 ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
101 * Function to handle the mapping of the Flow to be compatible
102 * with the underlying hardware.
105 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
106 struct bnxt_ulp_mapper_create_parms *parms,
109 /* Function that frees all resources associated with the flow. */
111 ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx, uint32_t fid);
114 * Function that frees all resources and can be called on default or regular
118 ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
120 enum bnxt_ulp_flow_db_tables tbl_type);
122 #endif /* _ULP_MAPPER_H_ */