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 /* enumeration of the interface types */
14 enum bnxt_ulp_intf_type {
15 BNXT_ULP_INTF_TYPE_INVALID = 0,
16 BNXT_ULP_INTF_TYPE_PF = 1,
17 BNXT_ULP_INTF_TYPE_VF,
18 BNXT_ULP_INTF_TYPE_PF_REP,
19 BNXT_ULP_INTF_TYPE_VF_REP,
20 BNXT_ULP_INTF_TYPE_LAST
23 /* Structure for the Port database resource information. */
24 struct ulp_interface_info {
25 enum bnxt_ulp_intf_type type;
29 uint16_t default_vnic;
30 uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
31 /* back pointer to the bnxt driver, it is null for rep ports */
35 /* Structure for the Port database */
36 struct bnxt_ulp_port_db {
37 struct ulp_interface_info *ulp_intf_list;
38 uint32_t ulp_intf_list_size;
40 /* dpdk device external port list */
41 uint16_t dev_port_list[RTE_MAX_ETHPORTS];
45 * Initialize the port database. Memory is allocated in this
46 * call and assigned to the port database.
48 * ulp_ctxt [in] Ptr to ulp context
50 * Returns 0 on success or negative number on failure.
52 int32_t ulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt);
55 * Deinitialize the port database. Memory is deallocated in
58 * ulp_ctxt [in] Ptr to ulp context
60 * Returns 0 on success.
62 int32_t ulp_port_db_deinit(struct bnxt_ulp_context *ulp_ctxt);
65 * Update the port database.This api is called when the port
66 * details are available during the startup.
68 * ulp_ctxt [in] Ptr to ulp context
69 * bp [in]. ptr to the device function.
71 * Returns 0 on success or negative number on failure.
73 int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
74 struct rte_eth_dev *eth_dev);
77 * Api to get the ulp ifindex for a given device port.
79 * ulp_ctxt [in] Ptr to ulp context
80 * port_id [in].device port id
81 * ifindex [out] ulp ifindex
83 * Returns 0 on success or negative number on failure.
86 ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,
91 * Api to get the function id for a given ulp ifindex.
93 * ulp_ctxt [in] Ptr to ulp context
94 * ifindex [in] ulp ifindex
95 * func_id [out] the function id of the given ifindex.
97 * Returns 0 on success or negative number on failure.
100 ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,
105 * Api to get the svid for a given ulp ifindex.
107 * ulp_ctxt [in] Ptr to ulp context
108 * ifindex [in] ulp ifindex
109 * dir [in] the direction for the flow.
110 * svif [out] the svif of the given ifindex.
112 * Returns 0 on success or negative number on failure.
115 ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt,
121 * Api to get the vnic id for a given ulp ifindex.
123 * ulp_ctxt [in] Ptr to ulp context
124 * ifindex [in] ulp ifindex
125 * vnic [out] the vnic of the given ifindex.
127 * Returns 0 on success or negative number on failure.
130 ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt,
134 #endif /* _ULP_PORT_DB_H_ */