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;
23 struct bnxt_ulp_context {
24 struct bnxt_ulp_data *cfg_data;
25 /* TBD The tfp should be removed once tf_attach is implemented. */
29 struct bnxt_ulp_pci_info {
34 struct bnxt_ulp_session_state {
35 STAILQ_ENTRY(bnxt_ulp_session_state) next;
37 pthread_mutex_t bnxt_ulp_mutex;
38 struct bnxt_ulp_pci_info pci_info;
39 struct bnxt_ulp_data *cfg_data;
40 /* TBD The tfp should be removed once tf_attach is implemented. */
42 uint32_t session_opened;
45 /* ULP flow id structure */
51 * Allow the deletion of context only for the bnxt device that
53 * TBD - The implementation of the function should change to
54 * using the reference count once tf_session_attach functionality
58 ulp_ctx_deinit_allowed(void *bp);
60 /* Function to set the device id of the hardware. */
62 bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
64 /* Function to get the device id of the hardware. */
66 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
68 /* Function to set the table scope id of the EEM table. */
70 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
71 uint32_t tbl_scope_id);
73 /* Function to get the table scope id of the EEM table. */
75 bnxt_ulp_cntxt_tbl_scope_id_get(struct bnxt_ulp_context *ulp_ctx,
76 uint32_t *tbl_scope_id);
78 /* Function to set the tfp session details in the ulp context. */
80 bnxt_ulp_cntxt_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp);
82 /* Function to get the tfp session details from ulp context. */
84 bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp);
86 /* Get the device table entry based on the device id. */
87 struct bnxt_ulp_device_params *
88 bnxt_ulp_device_params_get(uint32_t dev_id);
91 bnxt_ulp_ctxt_ptr2_mark_db_set(struct bnxt_ulp_context *ulp_ctx,
92 struct bnxt_ulp_mark_tbl *mark_tbl);
94 struct bnxt_ulp_mark_tbl *
95 bnxt_ulp_ctxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
97 /* Function to set the flow database to the ulp context. */
99 bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context *ulp_ctx,
100 struct bnxt_ulp_flow_db *flow_db);
102 /* Function to get the flow database from the ulp context. */
103 struct bnxt_ulp_flow_db *
104 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx);
106 /* Function to get the ulp context from eth device. */
107 struct bnxt_ulp_context *
108 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
110 #endif /* _BNXT_ULP_H_ */