DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH 5/8] raw/ioat: add device info function
Date: Thu, 30 May 2019 22:25:22 +0100	[thread overview]
Message-ID: <20190530212525.40370-6-bruce.richardson@intel.com> (raw)
In-Reply-To: <20190530212525.40370-1-bruce.richardson@intel.com>

Add in the "info_get" function to the driver, to allow us to query the
device. This allows us to have the unit test pick up the presence of
supported hardware or not.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/meson.build               |  3 +++
 app/test/test_ioat_rawdev.c        | 23 ++++++++++++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 5 files changed, 82 insertions(+)

diff --git a/app/test/meson.build b/app/test/meson.build
index 9867619d3..9fe3ddc89 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -305,6 +305,9 @@ endif
 if dpdk_conf.has('RTE_LIBRTE_KNI')
 	test_deps += 'kni'
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_IOAT_RAWDEV')
+	test_deps += 'pmd_ioat'
+endif
 
 cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
diff --git a/app/test/test_ioat_rawdev.c b/app/test/test_ioat_rawdev.c
index bd1bb2827..ac1389f6e 100644
--- a/app/test/test_ioat_rawdev.c
+++ b/app/test/test_ioat_rawdev.c
@@ -11,9 +11,32 @@ test_ioat_rawdev(void) { return TEST_SKIPPED; }
 
 #else
 
+#include <string.h>
+#include <unistd.h>
+
+#include <rte_mbuf.h>
+#include <rte_rawdev.h>
+#include <rte_ioat_rawdev.h>
+
 static int
 test_ioat_rawdev(void)
 {
+	const int count = rte_rawdev_count();
+	int i, found = 0;
+
+	printf("Checking %d rawdevs\n", count);
+	for (i = 0; i < count && !found; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		found = (rte_rawdev_info_get(i, &info) == 0 &&
+				strcmp(info.driver_name,
+						IOAT_PMD_RAWDEV_NAME_STR) == 0);
+	}
+
+	if (!found) {
+		printf("No IOAT rawdev found, skipping tests\n");
+		return TEST_SKIPPED;
+	}
+
 	return 0;
 }
 
diff --git a/doc/guides/rawdevs/ioat_rawdev.rst b/doc/guides/rawdevs/ioat_rawdev.rst
index 476b0503f..b68cdffc3 100644
--- a/doc/guides/rawdevs/ioat_rawdev.rst
+++ b/doc/guides/rawdevs/ioat_rawdev.rst
@@ -45,3 +45,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be got using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code in ``test_ioat_rawdev.c`` is used to identify
+the IOAT rawdev device for use for the tests:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index b6964bccd..90bed2810 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -24,10 +24,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
diff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h
index c3216a174..7e0d72ca3 100644
--- a/drivers/raw/ioat/rte_ioat_rawdev.h
+++ b/drivers/raw/ioat/rte_ioat_rawdev.h
@@ -24,6 +24,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
-- 
2.21.0


  parent reply	other threads:[~2019-05-30 21:26 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 21:25 [dpdk-dev] [PATCH 0/8] raw/ioat: driver for Intel QuickData Technology Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 1/8] raw/ioat: add initial support for ioat rawdev driver Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 2/8] usertools/dpdk-devbind.py: add support for IOAT devices Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 3/8] raw/ioat: add register definition file Bruce Richardson
2019-05-30 23:53   ` Stephen Hemminger
2019-06-06 13:19     ` Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 4/8] raw/ioat: create device on probe and destroy on release Bruce Richardson
2019-05-30 21:25 ` Bruce Richardson [this message]
2019-05-30 21:25 ` [dpdk-dev] [PATCH 6/8] raw/ioat: add configure, start and stop functions Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 7/8] raw/ioat: add statistics functions Bruce Richardson
2019-05-30 21:25 ` [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies Bruce Richardson
2019-06-03 14:44   ` Thomas Monjalon
2019-06-04 12:23     ` Bruce Richardson
2019-06-05 13:52   ` Jerin Jacob Kollanukkaran
2019-06-05 13:57     ` Bruce Richardson
2019-06-25 14:58 ` [dpdk-dev] [PATCH v2 0/8] raw/ioat: driver for Intel QuickData Technology Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 1/8] raw/ioat: add initial support for ioat rawdev driver Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 2/8] usertools/dpdk-devbind.py: add support for IOAT devices Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 3/8] raw/ioat: add register definition file Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 4/8] raw/ioat: create device on probe and destroy on release Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 5/8] raw/ioat: add device info function Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 6/8] raw/ioat: add configure, start and stop functions Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 7/8] raw/ioat: add statistics functions Bruce Richardson
2019-06-25 14:58   ` [dpdk-dev] [PATCH v2 8/8] raw/ioat: add local API to perform copies Bruce Richardson
2019-06-27 10:40 ` [dpdk-dev] [PATCH v3 0/8] raw/ioat: driver for Intel QuickData Technology Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver Bruce Richardson
2019-06-27 11:55     ` Burakov, Anatoly
2019-06-28 12:43       ` Bruce Richardson
2019-07-01  7:38     ` Hu, Jiayu
2019-07-01  7:51       ` Thomas Monjalon
2019-07-01  8:29     ` Hu, Jiayu
2019-07-01 14:30       ` Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 2/8] usertools/dpdk-devbind.py: add support for IOAT devices Bruce Richardson
2019-06-27 11:57     ` Burakov, Anatoly
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 3/8] raw/ioat: add register definition file Bruce Richardson
2019-06-27 12:01     ` Burakov, Anatoly
2019-06-28 12:44       ` Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release Bruce Richardson
2019-06-27 12:09     ` Burakov, Anatoly
2019-06-28 16:21       ` Bruce Richardson
2019-06-27 12:28     ` Burakov, Anatoly
2019-06-28 12:46       ` Bruce Richardson
2019-06-28 12:59         ` Burakov, Anatoly
2019-06-28 13:15           ` Bruce Richardson
2019-06-28 13:28             ` Burakov, Anatoly
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 5/8] raw/ioat: add device info function Bruce Richardson
2019-06-27 12:16     ` Burakov, Anatoly
2019-06-28 21:09       ` Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions Bruce Richardson
2019-06-27 12:29     ` Burakov, Anatoly
2019-06-27 16:37     ` Pattan, Reshma
2019-06-28 21:21       ` Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions Bruce Richardson
2019-06-27 12:38     ` Burakov, Anatoly
2019-07-01 10:11     ` Pattan, Reshma
2019-07-01 12:56       ` Bruce Richardson
2019-06-27 10:40   ` [dpdk-dev] [PATCH v3 8/8] raw/ioat: add local API to perform copies Bruce Richardson
2019-06-27 12:45     ` Burakov, Anatoly
2019-06-27 15:34   ` [dpdk-dev] [PATCH v3 0/8] raw/ioat: driver for Intel QuickData Technology Van Haaren, Harry
2019-07-01 15:55 ` [dpdk-dev] [PATCH v4 0/9] " Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation Bruce Richardson
2019-07-02 11:34     ` Hemant Agrawal
2019-07-02 11:43     ` Shreyansh Jain
2019-07-02 12:41       ` Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 2/9] raw/ioat: add initial support for ioat rawdev driver Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 3/9] usertools/dpdk-devbind.py: add support for IOAT devices Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 4/9] raw/ioat: add register definition file Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 5/9] raw/ioat: create device on probe and destroy on release Bruce Richardson
2019-07-02  9:39     ` Burakov, Anatoly
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 6/9] raw/ioat: add device info function Bruce Richardson
2019-07-02  2:33     ` Hu, Jiayu
2019-07-02  8:28       ` Bruce Richardson
2019-07-02  9:40     ` Burakov, Anatoly
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 7/9] raw/ioat: add configure, start and stop functions Bruce Richardson
2019-07-02  9:49     ` Burakov, Anatoly
2019-07-02  9:59       ` Bruce Richardson
2019-07-01 15:55   ` [dpdk-dev] [PATCH v4 8/9] raw/ioat: add statistics functions Bruce Richardson
2019-07-02  9:50     ` Burakov, Anatoly
2019-07-01 15:56   ` [dpdk-dev] [PATCH v4 9/9] raw/ioat: add local API to perform copies Bruce Richardson
2019-07-01 15:58   ` [dpdk-dev] [PATCH v4 0/9] raw/ioat: driver for Intel QuickData Technology Bruce Richardson
2019-07-02 14:12 ` [dpdk-dev] [PATCH v5 " Bruce Richardson
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 1/9] rawdev: allow devices to skip extra memory allocation Bruce Richardson
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 2/9] raw/ioat: add initial support for ioat rawdev driver Bruce Richardson
2019-07-03  1:53     ` Hu, Jiayu
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 3/9] usertools/dpdk-devbind.py: add support for IOAT devices Bruce Richardson
2019-07-03  1:54     ` Hu, Jiayu
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 4/9] raw/ioat: add register definition file Bruce Richardson
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 5/9] raw/ioat: create device on probe and destroy on release Bruce Richardson
2019-07-03  1:57     ` Hu, Jiayu
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 6/9] raw/ioat: add device info function Bruce Richardson
2019-07-03  1:58     ` Hu, Jiayu
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 7/9] raw/ioat: add configure, start and stop functions Bruce Richardson
2019-07-03  1:59     ` Hu, Jiayu
2019-07-03 16:21     ` Aaron Conole
2019-07-03 16:44       ` Bruce Richardson
2019-07-03 20:26         ` Aaron Conole
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 8/9] raw/ioat: add statistics functions Bruce Richardson
2019-07-03  2:00     ` Hu, Jiayu
2019-07-02 14:12   ` [dpdk-dev] [PATCH v5 9/9] raw/ioat: add local API to perform copies Bruce Richardson
2019-07-03  2:01     ` Hu, Jiayu
2019-07-04  7:45   ` [dpdk-dev] [PATCH v5 0/9] raw/ioat: driver for Intel QuickData Technology Thomas Monjalon
2019-07-04 22:17   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190530212525.40370-6-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).