From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A59DBA00BE; Fri, 12 Jun 2020 15:37:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6EC41BF74; Fri, 12 Jun 2020 15:34:17 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 6571D1BF54 for ; Fri, 12 Jun 2020 15:34:15 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 1AB891BD7AC; Fri, 12 Jun 2020 06:34:13 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 1AB891BD7AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591968855; bh=DPbnKUPnIOPWYFDe/fTtOQUzcuGAOxJfWdgqYhN5ekI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lrh2aflsx4CO1GbE4914HQtuFAPmWJM03BSdr62v6pfT8ia7O39WzH/SdtAWQfHKs PbK3CvJVnTfdwXeEr8BMtrFns3PSRJ0JyMdiDYzUjpaizoTFm+0Mi4YwdSGql0229E Q0/RU9Mdly9zXuQ0VoSJ4soMyNr1uADkl+phlG08= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:58:52 +0530 Message-Id: <20200612132934.16488-9-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200612132934.16488-1-somnath.kotur@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 08/50] net/bnxt: modify port_db to store & retrieve more info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Venkat Duvvuru Apart from func_svif, func_id & vnic, port_db now stores and retrieves func_spif, func_parif, phy_port_id, port_svif, port_spif, port_parif, port_vport. New helper functions have been added to support the same. Signed-off-by: Venkat Duvvuru Reviewed-by: Somnath Kotur Reviewed-by: Kishore Padmanabha Signed-off-by: Somnath Kotur --- drivers/net/bnxt/tf_ulp/ulp_port_db.c | 145 ++++++++++++++++++++++++++++------ drivers/net/bnxt/tf_ulp/ulp_port_db.h | 72 +++++++++++++---- 2 files changed, 179 insertions(+), 38 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c index 66b5840..ea27ef4 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_port_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.c @@ -106,13 +106,12 @@ int32_t ulp_port_db_deinit(struct bnxt_ulp_context *ulp_ctxt) int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt, struct rte_eth_dev *eth_dev) { - struct bnxt_ulp_port_db *port_db; - struct bnxt *bp = eth_dev->data->dev_private; uint32_t port_id = eth_dev->data->port_id; - uint32_t ifindex; + struct ulp_phy_port_info *port_data; + struct bnxt_ulp_port_db *port_db; struct ulp_interface_info *intf; + uint32_t ifindex; int32_t rc; - struct bnxt_vnic_info *vnic; port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt); if (!port_db) { @@ -133,22 +132,22 @@ int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt, /* update the interface details */ intf = &port_db->ulp_intf_list[ifindex]; - if (BNXT_PF(bp) || BNXT_VF(bp)) { - if (BNXT_PF(bp)) { - intf->type = BNXT_ULP_INTF_TYPE_PF; - intf->port_svif = bp->port_svif; - } else { - intf->type = BNXT_ULP_INTF_TYPE_VF; - } - intf->func_id = bp->fw_fid; - intf->func_svif = bp->func_svif; - vnic = BNXT_GET_DEFAULT_VNIC(bp); - if (vnic) - intf->default_vnic = vnic->fw_vnic_id; - intf->bp = bp; - memcpy(intf->mac_addr, bp->mac_addr, sizeof(intf->mac_addr)); - } else { - BNXT_TF_DBG(ERR, "Invalid interface type\n"); + + intf->type = bnxt_get_interface_type(port_id); + + intf->func_id = bnxt_get_fw_func_id(port_id); + intf->func_svif = bnxt_get_svif(port_id, 1); + intf->func_spif = bnxt_get_phy_port_id(port_id); + intf->func_parif = bnxt_get_parif(port_id); + intf->default_vnic = bnxt_get_vnic_id(port_id); + intf->phy_port_id = bnxt_get_phy_port_id(port_id); + + if (intf->type == BNXT_ULP_INTF_TYPE_PF) { + port_data = &port_db->phy_port_list[intf->phy_port_id]; + port_data->port_svif = bnxt_get_svif(port_id, 0); + port_data->port_spif = bnxt_get_phy_port_id(port_id); + port_data->port_parif = bnxt_get_parif(port_id); + port_data->port_vport = bnxt_get_vport(port_id); } return 0; @@ -209,7 +208,7 @@ ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt, } /* - * Api to get the svid for a given ulp ifindex. + * Api to get the svif for a given ulp ifindex. * * ulp_ctxt [in] Ptr to ulp context * ifindex [in] ulp ifindex @@ -225,16 +224,88 @@ ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt, uint16_t *svif) { struct bnxt_ulp_port_db *port_db; + uint16_t phy_port_id; port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt); if (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) { BNXT_TF_DBG(ERR, "Invalid Arguments\n"); return -EINVAL; } - if (dir == ULP_DIR_EGRESS) + if (dir == ULP_DIR_EGRESS) { *svif = port_db->ulp_intf_list[ifindex].func_svif; - else - *svif = port_db->ulp_intf_list[ifindex].port_svif; + } else { + phy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id; + *svif = port_db->phy_port_list[phy_port_id].port_svif; + } + + return 0; +} + +/* + * Api to get the spif for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * dir [in] the direction for the flow. + * spif [out] the spif of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_spif_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, + uint32_t dir, + uint16_t *spif) +{ + struct bnxt_ulp_port_db *port_db; + uint16_t phy_port_id; + + port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt); + if (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + if (dir == ULP_DIR_EGRESS) { + *spif = port_db->ulp_intf_list[ifindex].func_spif; + } else { + phy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id; + *spif = port_db->phy_port_list[phy_port_id].port_spif; + } + + return 0; +} + +/* + * Api to get the parif for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * dir [in] the direction for the flow. + * parif [out] the parif of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_parif_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, + uint32_t dir, + uint16_t *parif) +{ + struct bnxt_ulp_port_db *port_db; + uint16_t phy_port_id; + + port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt); + if (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + if (dir == ULP_DIR_EGRESS) { + *parif = port_db->ulp_intf_list[ifindex].func_parif; + } else { + phy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id; + *parif = port_db->phy_port_list[phy_port_id].port_parif; + } + return 0; } @@ -262,3 +333,29 @@ ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt, *vnic = port_db->ulp_intf_list[ifindex].default_vnic; return 0; } + +/* + * Api to get the vport id for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * vport [out] the port of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_vport_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, uint16_t *vport) +{ + struct bnxt_ulp_port_db *port_db; + uint16_t phy_port_id; + + port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt); + if (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + phy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id; + *vport = port_db->phy_port_list[phy_port_id].port_vport; + return 0; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.h b/drivers/net/bnxt/tf_ulp/ulp_port_db.h index 604c438..87de3bc 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_port_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.h @@ -15,11 +15,17 @@ struct ulp_interface_info { enum bnxt_ulp_intf_type type; uint16_t func_id; uint16_t func_svif; - uint16_t port_svif; + uint16_t func_spif; + uint16_t func_parif; uint16_t default_vnic; - uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; - /* back pointer to the bnxt driver, it is null for rep ports */ - struct bnxt *bp; + uint16_t phy_port_id; +}; + +struct ulp_phy_port_info { + uint16_t port_svif; + uint16_t port_spif; + uint16_t port_parif; + uint16_t port_vport; }; /* Structure for the Port database */ @@ -29,6 +35,7 @@ struct bnxt_ulp_port_db { /* dpdk device external port list */ uint16_t dev_port_list[RTE_MAX_ETHPORTS]; + struct ulp_phy_port_info phy_port_list[RTE_MAX_ETHPORTS]; }; /* @@ -74,8 +81,7 @@ int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt, */ int32_t ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt, - uint32_t port_id, - uint32_t *ifindex); + uint32_t port_id, uint32_t *ifindex); /* * Api to get the function id for a given ulp ifindex. @@ -88,11 +94,10 @@ ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt, */ int32_t ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt, - uint32_t ifindex, - uint16_t *func_id); + uint32_t ifindex, uint16_t *func_id); /* - * Api to get the svid for a given ulp ifindex. + * Api to get the svif for a given ulp ifindex. * * ulp_ctxt [in] Ptr to ulp context * ifindex [in] ulp ifindex @@ -103,9 +108,36 @@ ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt, */ int32_t ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt, - uint32_t ifindex, - uint32_t dir, - uint16_t *svif); + uint32_t ifindex, uint32_t dir, uint16_t *svif); + +/* + * Api to get the spif for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * dir [in] the direction for the flow. + * spif [out] the spif of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_spif_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, uint32_t dir, uint16_t *spif); + + +/* + * Api to get the parif for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * dir [in] the direction for the flow. + * parif [out] the parif of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_parif_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, uint32_t dir, uint16_t *parif); /* * Api to get the vnic id for a given ulp ifindex. @@ -118,7 +150,19 @@ ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt, */ int32_t ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt, - uint32_t ifindex, - uint16_t *vnic); + uint32_t ifindex, uint16_t *vnic); + +/* + * Api to get the vport id for a given ulp ifindex. + * + * ulp_ctxt [in] Ptr to ulp context + * ifindex [in] ulp ifindex + * vport [out] the port of the given ifindex. + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_vport_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t ifindex, uint16_t *vport); #endif /* _ULP_PORT_DB_H_ */ -- 2.7.4