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 struct bnxt_ulp_data {
18 uint32_t tbl_scope_id;
19 struct bnxt_ulp_mark_tbl *mark_tbl;
20 uint32_t dev_id; /* Hardware device id */
22 struct bnxt_ulp_flow_db *flow_db;
24 struct bnxt_ulp_port_db *port_db;
25 uint32_t port_to_app_flow_id;
26 uint32_t app_to_port_flow_id;
27 uint32_t tx_cfa_action;
30 struct bnxt_ulp_context {
31 struct bnxt_ulp_data *cfg_data;
32 /* TBD The tfp should be removed once tf_attach is implemented. */
36 struct bnxt_ulp_pci_info {
41 struct bnxt_ulp_session_state {
42 STAILQ_ENTRY(bnxt_ulp_session_state) next;
44 pthread_mutex_t bnxt_ulp_mutex;
45 struct bnxt_ulp_pci_info pci_info;
46 struct bnxt_ulp_data *cfg_data;
47 /* TBD The tfp should be removed once tf_attach is implemented. */
49 uint32_t session_opened;
52 /* ULP flow id structure */
57 struct ulp_tlv_param {
58 enum bnxt_ulp_df_param_type type;
64 * Allow the deletion of context only for the bnxt device that
66 * TBD - The implementation of the function should change to
67 * using the reference count once tf_session_attach functionality
71 ulp_ctx_deinit_allowed(void *bp);
73 /* Function to set the device id of the hardware. */
75 bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
77 /* Function to get the device id of the hardware. */
79 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
81 /* Function to set the table scope id of the EEM table. */
83 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
84 uint32_t tbl_scope_id);
86 /* Function to get the table scope id of the EEM table. */
88 bnxt_ulp_cntxt_tbl_scope_id_get(struct bnxt_ulp_context *ulp_ctx,
89 uint32_t *tbl_scope_id);
91 /* Function to set the tfp session details in the ulp context. */
93 bnxt_ulp_cntxt_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp);
95 /* Function to get the tfp session details from ulp context. */
97 bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp);
99 /* Get the device table entry based on the device id. */
100 struct bnxt_ulp_device_params *
101 bnxt_ulp_device_params_get(uint32_t dev_id);
104 bnxt_ulp_ctxt_ptr2_mark_db_set(struct bnxt_ulp_context *ulp_ctx,
105 struct bnxt_ulp_mark_tbl *mark_tbl);
107 struct bnxt_ulp_mark_tbl *
108 bnxt_ulp_ctxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
110 /* Function to set the flow database to the ulp context. */
112 bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context *ulp_ctx,
113 struct bnxt_ulp_flow_db *flow_db);
115 /* Function to get the flow database from the ulp context. */
116 struct bnxt_ulp_flow_db *
117 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx);
119 /* Function to get the ulp context from eth device. */
120 struct bnxt_ulp_context *
121 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
123 /* Function to add the ulp mapper data to the ulp context */
125 bnxt_ulp_cntxt_ptr2_mapper_data_set(struct bnxt_ulp_context *ulp_ctx,
128 /* Function to get the ulp mapper data from the ulp context */
130 bnxt_ulp_cntxt_ptr2_mapper_data_get(struct bnxt_ulp_context *ulp_ctx);
132 /* Function to set the port database to the ulp context. */
134 bnxt_ulp_cntxt_ptr2_port_db_set(struct bnxt_ulp_context *ulp_ctx,
135 struct bnxt_ulp_port_db *port_db);
137 /* Function to get the port database from the ulp context. */
138 struct bnxt_ulp_port_db *
139 bnxt_ulp_cntxt_ptr2_port_db_get(struct bnxt_ulp_context *ulp_ctx);
141 /* Function to create default flows. */
143 ulp_default_flow_create(struct rte_eth_dev *eth_dev,
144 struct ulp_tlv_param *param_list,
145 uint32_t ulp_class_tid,
148 /* Function to destroy default flows. */
150 ulp_default_flow_destroy(struct rte_eth_dev *eth_dev,
154 bnxt_ulp_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
155 struct rte_flow_error *error);
157 #endif /* _BNXT_ULP_H_ */