From: Nipun Gupta Date: Fri, 4 May 2018 10:11:27 +0000 (+0530) Subject: raw/dpaa2_cmdif: add attribute get functionality X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d14dc7e7cf9e43dca4faf3fb0e6898b319c80115;p=dpdk.git raw/dpaa2_cmdif: add attribute get functionality Signed-off-by: Nipun Gupta Acked-by: Shreyansh Jain --- diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 470eb536e3..093bffee66 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -28,7 +28,33 @@ int dpaa2_cmdif_logtype; /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; -static const struct rte_rawdev_ops dpaa2_cmdif_ops; +/* + * 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 dpaa2_cmdif_create(const char *name,