[v2,27/32] raw/cnxk_bphy: support for bphy dequeue operation

Message ID 20210615110345.11057-28-tduszynski@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series add support for baseband phy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tomasz Duszynski June 15, 2021, 11:03 a.m. UTC
  Add support for dequeueing responses to previously
enqueued messages.

Signed-off-by: Jakub Palider <jpalider@marvell.com>
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
 drivers/raw/cnxk_bphy/cnxk_bphy.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Patch

diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 2949bf02a..7e541bac4 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -54,6 +54,25 @@  cnxk_bphy_irq_enqueue_bufs(struct rte_rawdev *dev,
 	return ret;
 }
 
+static int
+cnxk_bphy_irq_dequeue_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;
+	unsigned int queue = (size_t)context;
+
+	if (queue >= RTE_DIM(bphy_dev->queues))
+		return -EINVAL;
+
+	if (count == 0)
+		return 0;
+
+	buffers[0]->buf_addr = bphy_dev->queues[queue].rsp;
+
+	return 0;
+}
+
 static uint16_t
 cnxk_bphy_irq_queue_count(struct rte_rawdev *dev)
 {
@@ -81,6 +100,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,
+	.dequeue_bufs = cnxk_bphy_irq_dequeue_bufs,
 	.queue_count = cnxk_bphy_irq_queue_count,
 };