From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA00DA0C43; Mon, 16 Aug 2021 01:13:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8F6541145; Mon, 16 Aug 2021 01:13:04 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5EB2441144 for ; Mon, 16 Aug 2021 01:13:03 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17FMvU4o029132 for ; Sun, 15 Aug 2021 16:13:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=kBvpxenSLYlM9VXkHi4M9W/uoXqrAD/emZe37H04rDA=; b=GvqFBVS8WQLInWPppFeZ4QTgAQCBLzSSR1RNxN4MO42EXt6hcFhxexKlngfexC5vuJxf p4fH8iK+lp6GXcmW/s6qSHiWXIPXlXbl2YjdefJs2I5RYBZV9zhVNy/FEmE+Zv5CDlmQ x5QIaHyUUUBr4h4lc315F1SCpiBDei5SQ2NFhECgxpV77BYPL7WKG1pBDD+vIASFyr76 b7CNMf9+5BkKPcqv3eozcd0IYnHXtHNnPKEv6lpXRUUBbGAb0X0SthePB+8p1DkVw7rT UXm9q8aBeUgF3Sqr1hocAkZ6U8wEdLky1ehLAsjeM3l6rHG/LuX2c17reDWNefK38RJD jw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3af0pth4eq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 15 Aug 2021 16:13:02 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 15 Aug 2021 16:13:01 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sun, 15 Aug 2021 16:13:01 -0700 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id CCA6F5B6956; Sun, 15 Aug 2021 16:12:59 -0700 (PDT) From: Tomasz Duszynski To: , Jakub Palider , Tomasz Duszynski CC: Jerin Jacob Kollanukkaran Date: Mon, 16 Aug 2021 01:12:02 +0200 Message-ID: <20210815231202.1192974-4-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210815231202.1192974-1-tduszynski@marvell.com> References: <20210815231202.1192974-1-tduszynski@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: sR6mlk6GDze0bq9UtPCob2aXiPa4wgXn X-Proofpoint-ORIG-GUID: sR6mlk6GDze0bq9UtPCob2aXiPa4wgXn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-15_09,2021-08-13_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH 3/3] raw/cnxk_bphy: support reading NPA/SSO PF function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Add support for reading NPA/SSO pf_func which will be used by a PSM to access NPA/SSO. PSM is a hardware block capable of dispatching jobs to different blocks within a baseband module. Signed-off-by: Tomasz Duszynski Reviewed-by: Jerin Jacob Kollanukkaran --- drivers/raw/cnxk_bphy/cnxk_bphy.c | 16 +++++++++ drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 50 ++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c index 8a0d2224c0..8e7b714ba1 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c @@ -67,6 +67,14 @@ bphy_rawdev_selftest(uint16_t dev_id) goto err_desc; } + ret = rte_pmd_bphy_npa_pf_func_get(dev_id); + if (ret == 0) + plt_warn("NPA pf_func is invalid"); + + ret = rte_pmd_bphy_sso_pf_func_get(dev_id); + if (ret == 0) + plt_warn("SSO pf_func is invalid"); + ret = rte_pmd_bphy_intr_init(dev_id); if (ret) { plt_err("intr init failed"); @@ -190,6 +198,14 @@ cnxk_bphy_irq_enqueue_bufs(struct rte_rawdev *dev, case CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET: bphy_dev->queues[queue].rsp = &bphy_dev->mem; break; + case CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC: + bphy_dev->queues[queue].rsp = + (void *)(size_t)roc_bphy_npa_pf_func_get(); + break; + case CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC: + bphy_dev->queues[queue].rsp = + (void *)(size_t)roc_bphy_sso_pf_func_get(); + break; default: ret = -EINVAL; } diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h index d459c3a862..bcd165f41c 100644 --- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h +++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h @@ -114,6 +114,8 @@ enum cnxk_bphy_irq_msg_type { CNXK_BPHY_IRQ_MSG_TYPE_REGISTER, CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER, CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET, + CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC, + CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC, }; struct cnxk_bphy_irq_msg { @@ -232,4 +234,52 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id) return buf.buf_addr; } +static __rte_always_inline uint16_t +rte_pmd_bphy_npa_pf_func_get(uint16_t dev_id) +{ + struct cnxk_bphy_irq_msg msg = { + .type = CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC, + }; + struct rte_rawdev_buf *bufs[1]; + struct rte_rawdev_buf buf; + int ret; + + buf.buf_addr = &msg; + bufs[0] = &buf; + + ret = rte_rawdev_enqueue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE); + if (ret) + return 0; + + ret = rte_rawdev_dequeue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE); + if (ret) + return 0; + + return (uint16_t)(size_t)buf.buf_addr; +} + +static __rte_always_inline uint16_t +rte_pmd_bphy_sso_pf_func_get(uint16_t dev_id) +{ + struct cnxk_bphy_irq_msg msg = { + .type = CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC, + }; + struct rte_rawdev_buf *bufs[1]; + struct rte_rawdev_buf buf; + int ret; + + buf.buf_addr = &msg; + bufs[0] = &buf; + + ret = rte_rawdev_enqueue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE); + if (ret) + return 0; + + ret = rte_rawdev_dequeue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE); + if (ret) + return 0; + + return (uint16_t)(size_t)buf.buf_addr; +} + #endif /* _CNXK_BPHY_H_ */ -- 2.25.1