1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2019 Broadcom
6 #ifndef _ULP_PORT_DB_H_
7 #define _ULP_PORT_DB_H_
11 #define BNXT_PORT_DB_MAX_INTF_LIST 256
13 /* Structure for the Port database resource information. */
14 struct ulp_interface_info {
15 enum bnxt_ulp_intf_type type;
19 uint16_t default_vnic;
20 uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
21 /* back pointer to the bnxt driver, it is null for rep ports */
25 /* Structure for the Port database */
26 struct bnxt_ulp_port_db {
27 struct ulp_interface_info *ulp_intf_list;
28 uint32_t ulp_intf_list_size;
30 /* dpdk device external port list */
31 uint16_t dev_port_list[RTE_MAX_ETHPORTS];
35 * Initialize the port database. Memory is allocated in this
36 * call and assigned to the port database.
38 * ulp_ctxt [in] Ptr to ulp context
40 * Returns 0 on success or negative number on failure.
42 int32_t ulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt);
45 * Deinitialize the port database. Memory is deallocated in
48 * ulp_ctxt [in] Ptr to ulp context
50 * Returns 0 on success.
52 int32_t ulp_port_db_deinit(struct bnxt_ulp_context *ulp_ctxt);
55 * Update the port database.This api is called when the port
56 * details are available during the startup.
58 * ulp_ctxt [in] Ptr to ulp context
59 * bp [in]. ptr to the device function.
61 * Returns 0 on success or negative number on failure.
63 int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
64 struct rte_eth_dev *eth_dev);
67 * Api to get the ulp ifindex for a given device port.
69 * ulp_ctxt [in] Ptr to ulp context
70 * port_id [in].device port id
71 * ifindex [out] ulp ifindex
73 * Returns 0 on success or negative number on failure.
76 ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,
81 * Api to get the function id for a given ulp ifindex.
83 * ulp_ctxt [in] Ptr to ulp context
84 * ifindex [in] ulp ifindex
85 * func_id [out] the function id of the given ifindex.
87 * Returns 0 on success or negative number on failure.
90 ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,
95 * Api to get the svid for a given ulp ifindex.
97 * ulp_ctxt [in] Ptr to ulp context
98 * ifindex [in] ulp ifindex
99 * dir [in] the direction for the flow.
100 * svif [out] the svif of the given ifindex.
102 * Returns 0 on success or negative number on failure.
105 ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt,
111 * Api to get the vnic id for a given ulp ifindex.
113 * ulp_ctxt [in] Ptr to ulp context
114 * ifindex [in] ulp ifindex
115 * vnic [out] the vnic of the given ifindex.
117 * Returns 0 on success or negative number on failure.
120 ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt,
124 #endif /* _ULP_PORT_DB_H_ */