[dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality

Nipun Gupta nipun.gupta at nxp.com
Sat Apr 7 16:34:02 CEST 2018


Signed-off-by: Nipun Gupta <nipun.gupta at nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 0d98d36..9044489 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -29,7 +29,32 @@
 /* CMDIF driver object */
 static struct rte_vdev_driver dpaa2_cmdif_drv;
 
+/*
+ * This API provides the DPCI device ID in 'attr_value'.
+ * The device ID shall be passed by GPP to the AIOP using CMDIF commands.
+ */
+static int
+dpaa2_cmdif_get_attr(struct rte_rawdev *dev,
+		     const char *attr_name,
+		     uint64_t *attr_value)
+{
+	struct dpaa2_dpci_dev *cidev = dev->dev_private;
+
+	DPAA2_CMDIF_FUNC_TRACE();
+
+	RTE_SET_USED(attr_name);
+
+	if (!attr_value) {
+		DPAA2_CMDIF_ERR("Invalid arguments for getting attributes");
+		return -EINVAL;
+	}
+	*attr_value = cidev->dpci_id;
+
+	return 0;
+}
+
 static const struct rte_rawdev_ops dpaa2_cmdif_ops = {
+	.attr_get = dpaa2_cmdif_get_attr,
 };
 
 static int
-- 
1.9.1



More information about the dev mailing list