1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
11 #include <sys/queue.h>
13 #include "rte_ethdev.h"
15 struct bnxt_ulp_data {
16 uint32_t tbl_scope_id;
17 struct bnxt_ulp_mark_tbl *mark_tbl;
18 uint32_t dev_id; /* Hardware device id */
20 struct bnxt_ulp_flow_db *flow_db;
22 struct bnxt_ulp_port_db *port_db;
25 struct bnxt_ulp_context {
26 struct bnxt_ulp_data *cfg_data;
27 /* TBD The tfp should be removed once tf_attach is implemented. */
31 struct bnxt_ulp_pci_info {
36 struct bnxt_ulp_session_state {
37 STAILQ_ENTRY(bnxt_ulp_session_state) next;
39 pthread_mutex_t bnxt_ulp_mutex;
40 struct bnxt_ulp_pci_info pci_info;
41 struct bnxt_ulp_data *cfg_data;
42 /* TBD The tfp should be removed once tf_attach is implemented. */
44 uint32_t session_opened;
47 /* ULP flow id structure */
53 * Allow the deletion of context only for the bnxt device that
55 * TBD - The implementation of the function should change to
56 * using the reference count once tf_session_attach functionality
60 ulp_ctx_deinit_allowed(void *bp);
62 /* Function to set the device id of the hardware. */
64 bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
66 /* Function to get the device id of the hardware. */
68 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
70 /* Function to set the table scope id of the EEM table. */
72 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
73 uint32_t tbl_scope_id);
75 /* Function to get the table scope id of the EEM table. */
77 bnxt_ulp_cntxt_tbl_scope_id_get(struct bnxt_ulp_context *ulp_ctx,
78 uint32_t *tbl_scope_id);
80 /* Function to set the tfp session details in the ulp context. */
82 bnxt_ulp_cntxt_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp);
84 /* Function to get the tfp session details from ulp context. */
86 bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp);
88 /* Get the device table entry based on the device id. */
89 struct bnxt_ulp_device_params *
90 bnxt_ulp_device_params_get(uint32_t dev_id);
93 bnxt_ulp_ctxt_ptr2_mark_db_set(struct bnxt_ulp_context *ulp_ctx,
94 struct bnxt_ulp_mark_tbl *mark_tbl);
96 struct bnxt_ulp_mark_tbl *
97 bnxt_ulp_ctxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
99 /* Function to set the flow database to the ulp context. */
101 bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context *ulp_ctx,
102 struct bnxt_ulp_flow_db *flow_db);
104 /* Function to get the flow database from the ulp context. */
105 struct bnxt_ulp_flow_db *
106 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx);
108 /* Function to get the ulp context from eth device. */
109 struct bnxt_ulp_context *
110 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
112 /* Function to add the ulp mapper data to the ulp context */
114 bnxt_ulp_cntxt_ptr2_mapper_data_set(struct bnxt_ulp_context *ulp_ctx,
117 /* Function to get the ulp mapper data from the ulp context */
119 bnxt_ulp_cntxt_ptr2_mapper_data_get(struct bnxt_ulp_context *ulp_ctx);
121 /* Function to set the port database to the ulp context. */
123 bnxt_ulp_cntxt_ptr2_port_db_set(struct bnxt_ulp_context *ulp_ctx,
124 struct bnxt_ulp_port_db *port_db);
126 /* Function to get the port database from the ulp context. */
127 struct bnxt_ulp_port_db *
128 bnxt_ulp_cntxt_ptr2_port_db_get(struct bnxt_ulp_context *ulp_ctx);
130 #endif /* _BNXT_ULP_H_ */