1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
11 #include <sys/queue.h>
13 #include "rte_ethdev.h"
15 #include "ulp_template_db_enum.h"
17 /* defines for the ulp_flags */
18 #define BNXT_ULP_VF_REP_ENABLED 0x1
19 #define ULP_VF_REP_IS_ENABLED(flag) ((flag) & BNXT_ULP_VF_REP_ENABLED)
21 struct bnxt_ulp_data {
22 uint32_t tbl_scope_id;
23 struct bnxt_ulp_mark_tbl *mark_tbl;
24 uint32_t dev_id; /* Hardware device id */
26 struct bnxt_ulp_flow_db *flow_db;
28 struct bnxt_ulp_port_db *port_db;
29 struct bnxt_ulp_fc_info *fc_info;
31 uint32_t port_to_app_flow_id;
32 uint32_t app_to_port_flow_id;
33 uint32_t tx_cfa_action;
36 struct bnxt_ulp_context {
37 struct bnxt_ulp_data *cfg_data;
38 /* TBD The tfp should be removed once tf_attach is implemented. */
42 struct bnxt_ulp_pci_info {
47 struct bnxt_ulp_session_state {
48 STAILQ_ENTRY(bnxt_ulp_session_state) next;
50 pthread_mutex_t bnxt_ulp_mutex;
51 struct bnxt_ulp_pci_info pci_info;
52 struct bnxt_ulp_data *cfg_data;
53 /* TBD The tfp should be removed once tf_attach is implemented. */
55 uint32_t session_opened;
58 /* ULP flow id structure */
63 struct ulp_tlv_param {
64 enum bnxt_ulp_df_param_type type;
70 * Allow the deletion of context only for the bnxt device that
72 * TBD - The implementation of the function should change to
73 * using the reference count once tf_session_attach functionality
77 ulp_ctx_deinit_allowed(void *bp);
79 /* Function to set the device id of the hardware. */
81 bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
83 /* Function to get the device id of the hardware. */
85 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
87 /* Function to set the table scope id of the EEM table. */
89 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
90 uint32_t tbl_scope_id);
92 /* Function to get the table scope id of the EEM table. */
94 bnxt_ulp_cntxt_tbl_scope_id_get(struct bnxt_ulp_context *ulp_ctx,
95 uint32_t *tbl_scope_id);
97 /* Function to set the tfp session details in the ulp context. */
99 bnxt_ulp_cntxt_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp);
101 /* Function to get the tfp session details from ulp context. */
103 bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp);
105 /* Get the device table entry based on the device id. */
106 struct bnxt_ulp_device_params *
107 bnxt_ulp_device_params_get(uint32_t dev_id);
110 bnxt_ulp_ctxt_ptr2_mark_db_set(struct bnxt_ulp_context *ulp_ctx,
111 struct bnxt_ulp_mark_tbl *mark_tbl);
113 struct bnxt_ulp_mark_tbl *
114 bnxt_ulp_ctxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
116 /* Function to set the flow database to the ulp context. */
118 bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context *ulp_ctx,
119 struct bnxt_ulp_flow_db *flow_db);
121 /* Function to get the flow database from the ulp context. */
122 struct bnxt_ulp_flow_db *
123 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx);
125 /* Function to get the ulp context from eth device. */
126 struct bnxt_ulp_context *
127 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
129 /* Function to add the ulp mapper data to the ulp context */
131 bnxt_ulp_cntxt_ptr2_mapper_data_set(struct bnxt_ulp_context *ulp_ctx,
134 /* Function to get the ulp mapper data from the ulp context */
136 bnxt_ulp_cntxt_ptr2_mapper_data_get(struct bnxt_ulp_context *ulp_ctx);
138 /* Function to set the port database to the ulp context. */
140 bnxt_ulp_cntxt_ptr2_port_db_set(struct bnxt_ulp_context *ulp_ctx,
141 struct bnxt_ulp_port_db *port_db);
143 /* Function to get the port database from the ulp context. */
144 struct bnxt_ulp_port_db *
145 bnxt_ulp_cntxt_ptr2_port_db_get(struct bnxt_ulp_context *ulp_ctx);
147 /* Function to create default flows. */
149 ulp_default_flow_create(struct rte_eth_dev *eth_dev,
150 struct ulp_tlv_param *param_list,
151 uint32_t ulp_class_tid,
154 /* Function to destroy default flows. */
156 ulp_default_flow_destroy(struct rte_eth_dev *eth_dev,
160 bnxt_ulp_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
161 struct rte_flow_error *error);
164 bnxt_ulp_cntxt_ptr2_fc_info_set(struct bnxt_ulp_context *ulp_ctx,
165 struct bnxt_ulp_fc_info *ulp_fc_info);
167 struct bnxt_ulp_fc_info *
168 bnxt_ulp_cntxt_ptr2_fc_info_get(struct bnxt_ulp_context *ulp_ctx);
171 bnxt_ulp_cntxt_ptr2_ulp_flags_get(struct bnxt_ulp_context *ulp_ctx,
174 #endif /* _BNXT_ULP_H_ */