diff mbox series

[v3,26/32] raw/cnxk_bphy: support for bphy enqueue operation

Message ID 20210621150449.19070-27-tduszynski@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series add support for baseband phy | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tomasz Duszynski June 21, 2021, 3:04 p.m. UTC
Add preliminary support for enqueue operation.

Signed-off-by: Jakub Palider <jpalider@marvell.com>
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/raw/cnxk_bphy/cnxk_bphy.c    | 26 ++++++++++++++++++++++++++
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 13 +++++++++++++
 2 files changed, 39 insertions(+)
diff mbox series

Patch

diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 04e822586..2949bf02a 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -13,6 +13,7 @@ 
 #include <roc_api.h>
 
 #include "cnxk_bphy_irq.h"
+#include "rte_pmd_bphy.h"
 
 static const struct rte_pci_id pci_bphy_map[] = {
 	{RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_CNXK_BPHY)},
@@ -29,6 +30,30 @@  bphy_rawdev_get_name(char *name, struct rte_pci_device *pci_dev)
 		 pci_dev->addr.function);
 }
 
+static int
+cnxk_bphy_irq_enqueue_bufs(struct rte_rawdev *dev,
+			   struct rte_rawdev_buf **buffers, unsigned int count,
+			   rte_rawdev_obj_t context)
+{
+	struct bphy_device *bphy_dev = (struct bphy_device *)dev->dev_private;
+	struct cnxk_bphy_irq_msg *msg = buffers[0]->buf_addr;
+	unsigned int queue = (size_t)context;
+	int ret = 0;
+
+	if (queue >= RTE_DIM(bphy_dev->queues))
+		return -EINVAL;
+
+	if (count == 0)
+		return 0;
+
+	switch (msg->type) {
+	default:
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
 static uint16_t
 cnxk_bphy_irq_queue_count(struct rte_rawdev *dev)
 {
@@ -55,6 +80,7 @@  cnxk_bphy_irq_queue_def_conf(struct rte_rawdev *dev, uint16_t queue_id,
 
 static const struct rte_rawdev_ops bphy_rawdev_ops = {
 	.queue_def_conf = cnxk_bphy_irq_queue_def_conf,
+	.enqueue_bufs = cnxk_bphy_irq_enqueue_bufs,
 	.queue_count = cnxk_bphy_irq_queue_count,
 };
 
diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
index fed7916fe..eb39654f1 100644
--- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
+++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
@@ -101,4 +101,17 @@  struct cnxk_bphy_cgx_msg {
 	void *data;
 };
 
+enum cnxk_bphy_irq_msg_type {
+	CNXK_BPHY_IRQ_MSG_TYPE_INIT,
+	CNXK_BPHY_IRQ_MSG_TYPE_FINI,
+	CNXK_BPHY_IRQ_MSG_TYPE_REGISTER,
+	CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER,
+	CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET,
+};
+
+struct cnxk_bphy_irq_msg {
+	enum cnxk_bphy_irq_msg_type type;
+	void *data;
+};
+
 #endif /* _CNXK_BPHY_H_ */