DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kumar Amber <kumar.amber@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v8] raw/ioat: add secondary process support
Date: Fri,  8 Jan 2021 19:14:56 +0530
Message-ID: <20210108134456.636211-1-kumar.amber@intel.com> (raw)
In-Reply-To: <20210107122312.564619-1-kumar.amber@intel.com>

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
v7
* include dev ops for secondary
v8
* fix wrong memzone alloaction
---
 drivers/raw/ioat/ioat_common.c | 16 ++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..da464181a5 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,14 +215,30 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
 			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = ops;
+		rawdev->device = dev;
+		return 0;
+	}
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
+
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = ops;
 	rawdev->device = dev;
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..922fa20e32 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
 			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = &ioat_rawdev_ops;
+		rawdev->device = &dev->device;
+		return 0;
+	}
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
-- 
2.25.1


  parent reply	other threads:[~2021-01-08 13:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  2:09 [dpdk-dev] [PATCH v1] " Kumar Amber
2021-01-04 13:31 ` [dpdk-dev] [PATCH v2] " Kumar Amber
2021-01-04 16:28   ` [dpdk-dev] [PATCH v3] " Kumar Amber
2021-01-04 16:30     ` [dpdk-dev] [PATCH v4] " Kumar Amber
2021-01-06 14:07       ` Bruce Richardson
2021-01-07  4:00       ` [dpdk-dev] [PATCH v5] " Kumar Amber
2021-01-07  5:05         ` [dpdk-dev] [PATCH v6] " Kumar Amber
2021-01-07 12:23           ` [dpdk-dev] [PATCH v7] " Kumar Amber
2021-01-07 12:37             ` Bruce Richardson
2021-01-08 13:44             ` Kumar Amber [this message]
2021-01-08 14:03               ` [dpdk-dev] [PATCH v8] " Bruce Richardson
2021-01-08 16:08               ` [dpdk-dev] [PATCH v9] " Kumar Amber
2021-01-08 16:52                 ` Kumar Amber
2021-01-08 17:05                   ` Bruce Richardson
2021-01-17 21:53                     ` Thomas Monjalon

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=20210108134456.636211-1-kumar.amber@intel.com \
    --to=kumar.amber@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git