[v4,04/10] vdpa/sfc: get device supported max queue count

Message ID 20211103135754.17411-5-vsrivast@xilinx.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vdpa/sfc: introduce Xilinx vDPA driver |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Vijay Srivastava Nov. 3, 2021, 1:57 p.m. UTC
  From: Vijay Kumar Srivastava <vsrivast@xilinx.com>

Implement vDPA ops get_queue_num to get the maximum number
of queues supported by the device.

Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
v4:
* Updated format specifier in log message.

 drivers/vdpa/sfc/sfc_vdpa_ops.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 5750944..9a95211 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -31,10 +31,20 @@ 
 static int
 sfc_vdpa_get_queue_num(struct rte_vdpa_device *vdpa_dev, uint32_t *queue_num)
 {
-	RTE_SET_USED(vdpa_dev);
-	RTE_SET_USED(queue_num);
+	struct sfc_vdpa_ops_data *ops_data;
+	void *dev;
 
-	return -1;
+	ops_data = sfc_vdpa_get_data_by_dev(vdpa_dev);
+	if (ops_data == NULL)
+		return -1;
+
+	dev = ops_data->dev_handle;
+	*queue_num = sfc_vdpa_adapter_by_dev_handle(dev)->max_queue_count;
+
+	sfc_vdpa_info(dev, "vDPA ops get_queue_num :: supported queue num : %u",
+		      *queue_num);
+
+	return 0;
 }
 
 static int