DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	przemyslawx.lal@intel.com,  kuralamudhan.ramakrishnan@intel.com,
	ivan.coughlan@intel.com, tiwei.bie@intel.com,
	ray.kinsella@intel.com
Subject: [dpdk-dev] [PATCH 19.02 1/2] memalloc: allow setting up segment list fd's
Date: Tue, 13 Nov 2018 17:54:47 +0000	[thread overview]
Message-ID: <51e22e414880066b307ca1d0342fd20b1f3c3953.1542130721.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1542130721.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1542130721.git.anatoly.burakov@intel.com>

Currently, only segment fd's for multi-file segments are supported,
while for memfd-backed no-huge memory we need single-file segments
mode. Add support for single-file segments in the internal API.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal_memalloc.c   |  6 ++++++
 lib/librte_eal/common/eal_memalloc.h       |  4 ++++
 lib/librte_eal/linuxapp/eal/eal_memalloc.c | 16 ++++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal_memalloc.c b/lib/librte_eal/bsdapp/eal/eal_memalloc.c
index a5847f0bd..6893448db 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memalloc.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memalloc.c
@@ -61,6 +61,12 @@ eal_memalloc_set_seg_fd(int list_idx __rte_unused, int seg_idx __rte_unused,
 	return -ENOTSUP;
 }
 
+int
+eal_memalloc_set_seg_list_fd(int list_idx __rte_unused, int fd __rte_unused)
+{
+	return -ENOTSUP;
+}
+
 int
 eal_memalloc_get_seg_fd_offset(int list_idx __rte_unused,
 		int seg_idx __rte_unused, size_t *offset __rte_unused)
diff --git a/lib/librte_eal/common/eal_memalloc.h b/lib/librte_eal/common/eal_memalloc.h
index af917c2f9..b96c9c512 100644
--- a/lib/librte_eal/common/eal_memalloc.h
+++ b/lib/librte_eal/common/eal_memalloc.h
@@ -84,6 +84,10 @@ eal_memalloc_get_seg_fd(int list_idx, int seg_idx);
 int
 eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd);
 
+/* returns 0 or -errno */
+int
+eal_memalloc_set_seg_list_fd(int list_idx, int fd);
+
 int
 eal_memalloc_get_seg_fd_offset(int list_idx, int seg_idx, size_t *offset);
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
index 48b9c7360..5bda92717 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
@@ -1529,6 +1529,10 @@ eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd)
 {
 	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
 
+	/* single file segments mode doesn't support individual segment fd's */
+	if (internal_config.single_file_segments)
+		return -ENOTSUP;
+
 	/* if list is not allocated, allocate it */
 	if (fd_list[list_idx].len == 0) {
 		int len = mcfg->memsegs[list_idx].memseg_arr.len;
@@ -1541,6 +1545,18 @@ eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd)
 	return 0;
 }
 
+int
+eal_memalloc_set_seg_list_fd(int list_idx, int fd)
+{
+	/* non-single file segment mode doesn't support segment list fd's */
+	if (!internal_config.single_file_segments)
+		return -ENOTSUP;
+
+	fd_list[list_idx].memseg_list_fd = fd;
+
+	return 0;
+}
+
 int
 eal_memalloc_get_seg_fd(int list_idx, int seg_idx)
 {
-- 
2.17.1

  reply	other threads:[~2018-11-13 17:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 17:54 [dpdk-dev] [PATCH 19.02 0/2] Allow using virtio without hugepages Anatoly Burakov
2018-11-13 17:54 ` Anatoly Burakov [this message]
2018-11-13 17:54 ` [dpdk-dev] [PATCH 19.02 2/2] mem: use memfd for no-huge mode Anatoly Burakov
2018-11-28  4:57   ` Tiwei Bie
2018-11-28  9:11     ` Burakov, Anatoly
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 0/5] Allow using virtio without hugepages Anatoly Burakov
2018-12-13  4:53   ` Tiwei Bie
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 0/5] Allow using virtio-user " Anatoly Burakov
2018-12-20 22:01     ` Thomas Monjalon
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 1/5] mem: fix error code for segment fd API for external segs Anatoly Burakov
2018-12-14  9:15     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 2/5] memalloc: check for memfd support in segment fd API Anatoly Burakov
2018-12-14  9:19     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 3/5] memalloc: allow setting up segment list fd's Anatoly Burakov
2018-12-14 10:03     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 4/5] mem: use memfd for no-huge mode Anatoly Burakov
2018-12-13 11:59     ` Burakov, Anatoly
2018-12-14 10:06     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 5/5] test: add segment fd API test Anatoly Burakov
2018-12-14 10:09     ` Maxime Coquelin
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 1/5] mem: fix error code for segment fd API for external segs Anatoly Burakov
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 2/5] memalloc: check for memfd support in segment fd API Anatoly Burakov
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 3/5] memalloc: allow setting up segment list fd's Anatoly Burakov
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 4/5] mem: use memfd for no-huge mode Anatoly Burakov
2018-12-13  4:59   ` Tiwei Bie
2018-12-13 11:36     ` Burakov, Anatoly
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 5/5] test: add segment fd API test Anatoly Burakov

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=51e22e414880066b307ca1d0342fd20b1f3c3953.1542130721.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ivan.coughlan@intel.com \
    --cc=kuralamudhan.ramakrishnan@intel.com \
    --cc=przemyslawx.lal@intel.com \
    --cc=ray.kinsella@intel.com \
    --cc=tiwei.bie@intel.com \
    /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).