From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1B8CBA04BC;
	Thu,  8 Oct 2020 11:58:39 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id B76861BFDB;
	Thu,  8 Oct 2020 11:52:21 +0200 (CEST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 56BD21BFBC
 for <dev@dpdk.org>; Thu,  8 Oct 2020 11:52:19 +0200 (CEST)
IronPort-SDR: eDtuIrKPC4AdFUhG268UUbTbYWElXTFhykY6V3jc3n92OBy4Ss0B4IeY/dFRGBOO5gwsoydu/b
 Hn3oo3oARk9Q==
X-IronPort-AV: E=McAfee;i="6000,8403,9767"; a="152226405"
X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="152226405"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 08 Oct 2020 02:52:18 -0700
IronPort-SDR: 9YkKmaEdEjMFVj8x9gNcfHA0dUX+nznFMyDlcna59arXYEKNeVbSem6Cq74kHW2w0MgfOwMOrC
 tu7KkQ9qKoIg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="344686761"
Received: from silpixa00399126.ir.intel.com ([10.237.222.4])
 by orsmga008.jf.intel.com with ESMTP; 08 Oct 2020 02:52:17 -0700
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: patrick.fu@intel.com, thomas@monjalon.net,
 Bruce Richardson <bruce.richardson@intel.com>,
 Kevin Laatz <kevin.laatz@intel.com>, Radu Nicolau <radu.nicolau@intel.com>
Date: Thu,  8 Oct 2020 10:51:28 +0100
Message-Id: <20201008095133.123014-21-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20201008095133.123014-1-bruce.richardson@intel.com>
References: <20200721095140.719297-1-bruce.richardson@intel.com>
 <20201008095133.123014-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v6 20/25] raw/ioat: add info function for idxd
	devices
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Add the info get function for DSA devices, returning just the ring size
info about the device, same as is returned for existing IOAT/CBDMA devices.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/raw/ioat/idxd_pci.c     |  1 +
 drivers/raw/ioat/idxd_vdev.c    |  1 +
 drivers/raw/ioat/ioat_common.c  | 18 ++++++++++++++++++
 drivers/raw/ioat/ioat_private.h |  3 +++
 4 files changed, 23 insertions(+)

diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 6b5c47392..bf5edcfdd 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -106,6 +106,7 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 		.dev_configure = idxd_dev_configure,
 		.dev_start = idxd_pci_dev_start,
 		.dev_stop = idxd_pci_dev_stop,
+		.dev_info_get = idxd_dev_info_get,
 };
 
 /* each portal uses 4 x 4k pages */
diff --git a/drivers/raw/ioat/idxd_vdev.c b/drivers/raw/ioat/idxd_vdev.c
index 3dad1473b..c75ac4317 100644
--- a/drivers/raw/ioat/idxd_vdev.c
+++ b/drivers/raw/ioat/idxd_vdev.c
@@ -35,6 +35,7 @@ static const struct rte_rawdev_ops idxd_vdev_ops = {
 		.dev_selftest = idxd_rawdev_test,
 		.dump = idxd_dev_dump,
 		.dev_configure = idxd_dev_configure,
+		.dev_info_get = idxd_dev_info_get,
 };
 
 static void *
diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 6a4e2979f..b5cea2fda 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -44,6 +44,24 @@ idxd_dev_dump(struct rte_rawdev *dev, FILE *f)
 	return 0;
 }
 
+int
+idxd_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info,
+		size_t info_size)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct idxd_rawdev *idxd = dev->dev_private;
+	struct rte_idxd_rawdev *rte_idxd = &idxd->public;
+
+	if (info_size != sizeof(*cfg))
+		return -EINVAL;
+
+	if (cfg != NULL) {
+		cfg->ring_size = rte_idxd->hdl_ring_sz;
+		cfg->hdls_disable = rte_idxd->hdls_disable;
+	}
+	return 0;
+}
+
 int
 idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_rawdev_obj_t config, size_t config_size)
diff --git a/drivers/raw/ioat/ioat_private.h b/drivers/raw/ioat/ioat_private.h
index aba70d8d7..0f80d60bf 100644
--- a/drivers/raw/ioat/ioat_private.h
+++ b/drivers/raw/ioat/ioat_private.h
@@ -62,6 +62,9 @@ extern int idxd_rawdev_close(struct rte_rawdev *dev);
 extern int idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_rawdev_obj_t config, size_t config_size);
 
+extern int idxd_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info,
+		size_t info_size);
+
 extern int idxd_rawdev_test(uint16_t dev_id);
 
 extern int idxd_dev_dump(struct rte_rawdev *dev, FILE *f);
-- 
2.25.1