1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2021 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"
17 #include "ulp_gen_tbl.h"
19 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
21 struct bnxt_ulp_mapper_glb_resource_entry {
22 enum bnxt_ulp_resource_func resource_func;
23 uint32_t resource_type; /* TF_ enum type */
24 uint64_t resource_hndl;
28 struct bnxt_ulp_mapper_data {
29 struct bnxt_ulp_mapper_glb_resource_entry
30 glb_res_tbl[TF_DIR_MAX][BNXT_ULP_GLB_RF_IDX_LAST];
31 struct ulp_mapper_gen_tbl_list gen_tbl_list[BNXT_ULP_GEN_TBL_MAX_SZ];
34 /* Internal Structure for passing the arguments around */
35 struct bnxt_ulp_mapper_parms {
36 enum bnxt_ulp_template_type tmpl_type;
39 struct bnxt_ulp_mapper_tbl_info *atbls; /* action table */
42 struct bnxt_ulp_mapper_tbl_info *ctbls; /* class table */
44 struct ulp_rte_act_prop *act_prop;
45 struct ulp_rte_act_bitmap *act_bitmap;
46 struct ulp_rte_hdr_bitmap *hdr_bitmap;
47 struct ulp_rte_hdr_bitmap *enc_hdr_bitmap;
48 struct ulp_rte_hdr_field *hdr_field;
49 struct ulp_rte_hdr_field *enc_field;
50 struct ulp_rte_field_bitmap *fld_bitmap;
52 struct ulp_regfile *regfile;
53 struct bnxt_ulp_context *ulp_ctx;
55 enum bnxt_ulp_fdb_type flow_type;
56 struct bnxt_ulp_mapper_data *mapper_data;
57 struct bnxt_ulp_device_params *device_params;
61 uint32_t app_priority;
63 uint32_t flow_pattern_id;
64 uint32_t act_pattern_id;
69 struct bnxt_ulp_mapper_create_parms {
70 uint32_t app_priority;
71 struct ulp_rte_hdr_bitmap *hdr_bitmap;
72 struct ulp_rte_hdr_bitmap *enc_hdr_bitmap;
73 struct ulp_rte_hdr_field *hdr_field;
74 struct ulp_rte_hdr_field *enc_field;
76 struct ulp_rte_act_bitmap *act;
77 struct ulp_rte_act_prop *act_prop;
78 struct ulp_rte_field_bitmap *fld_bitmap;
83 enum bnxt_ulp_fdb_type flow_type;
86 /* if set then create it as a child flow */
88 /* if set then create a parent flow */
93 /* support pattern based rejection */
94 uint32_t flow_pattern_id;
95 uint32_t act_pattern_id;
100 /* Function to initialize any dynamic mapper data. */
102 ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx);
104 /* Function to release all dynamic mapper data. */
106 ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
109 * Function to handle the mapping of the Flow to be compatible
110 * with the underlying hardware.
113 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
114 struct bnxt_ulp_mapper_create_parms *parms);
116 /* Function that frees all resources associated with the flow. */
118 ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
119 enum bnxt_ulp_fdb_type flow_type,
123 * Function that frees all resources and can be called on default or regular
127 ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
128 enum bnxt_ulp_fdb_type flow_type,
132 ulp_mapper_get_shared_fid(struct bnxt_ulp_context *ulp,
137 #endif /* _ULP_MAPPER_H_ */