DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tduszynski@marvell.com>
To: <dev@dpdk.org>, Jakub Palider <jpalider@marvell.com>,
	Tomasz Duszynski <tduszynski@marvell.com>
Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH 3/3] raw/cnxk_bphy: support reading NPA/SSO PF function
Date: Mon, 16 Aug 2021 01:12:02 +0200	[thread overview]
Message-ID: <20210815231202.1192974-4-tduszynski@marvell.com> (raw)
In-Reply-To: <20210815231202.1192974-1-tduszynski@marvell.com>

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 <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 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


      parent reply	other threads:[~2021-08-15 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 23:11 [dpdk-dev] [PATCH 0/3] " Tomasz Duszynski
2021-08-15 23:12 ` [dpdk-dev] [PATCH 1/3] raw/cnxk_bphy: fix device lookup Tomasz Duszynski
2021-09-28 13:20   ` Jerin Jacob
2021-08-15 23:12 ` [dpdk-dev] [PATCH 2/3] common/cnxk: support reading NPA/SSO PF function Tomasz Duszynski
2021-08-15 23:12 ` Tomasz Duszynski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210815231202.1192974-4-tduszynski@marvell.com \
    --to=tduszynski@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=jpalider@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).