+
+/* internal function to get the */
+static struct ulp_func_if_info*
+ulp_port_db_func_if_info_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint32_t port_id)
+{
+ struct bnxt_ulp_port_db *port_db;
+ uint16_t func_id;
+
+ port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);
+ if (ulp_port_db_port_func_id_get(ulp_ctxt, port_id, &func_id)) {
+ BNXT_TF_DBG(ERR, "Invalid port_id %x\n", port_id);
+ return NULL;
+ }
+
+ if (!port_db->ulp_func_id_tbl[func_id].func_valid) {
+ BNXT_TF_DBG(ERR, "Invalid func_id %x\n", func_id);
+ return NULL;
+ }
+ return &port_db->ulp_func_id_tbl[func_id];
+}
+
+/*
+ * Api to get the parent mac address for a given port id.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * port_id [in] device port id
+ * mac_addr [out] mac address
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+int32_t
+ulp_port_db_parent_mac_addr_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint32_t port_id, uint8_t **mac_addr)
+{
+ struct ulp_func_if_info *info;
+
+ info = ulp_port_db_func_if_info_get(ulp_ctxt, port_id);
+ if (info) {
+ *mac_addr = info->func_parent_mac;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/*
+ * Api to get the mac address for a given port id.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * port_id [in] device port id
+ * mac_addr [out] mac address
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+int32_t
+ulp_port_db_drv_mac_addr_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint32_t port_id, uint8_t **mac_addr)
+{
+ struct ulp_func_if_info *info;
+
+ info = ulp_port_db_func_if_info_get(ulp_ctxt, port_id);
+ if (info) {
+ *mac_addr = info->func_mac;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/*
+ * Api to get the parent vnic for a given port id.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * port_id [in] device port id
+ * vnic [out] parent vnic
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+int32_t
+ulp_port_db_parent_vnic_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint32_t port_id, uint8_t **vnic)
+{
+ struct ulp_func_if_info *info;
+
+ info = ulp_port_db_func_if_info_get(ulp_ctxt, port_id);
+ if (info) {
+ *vnic = (uint8_t *)&info->func_parent_vnic;
+ return 0;
+ }
+ return -EINVAL;
+}