DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alejandro Lucero <alejandro.lucero@netronome.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, anatoly.burakov@intel.com
Subject: [dpdk-dev] [PATCH 4/6] mem: add function for setting internal dma mask
Date: Tue, 26 Jun 2018 18:37:31 +0100	[thread overview]
Message-ID: <1530034653-28299-5-git-send-email-alejandro.lucero@netronome.com> (raw)
In-Reply-To: <1530034653-28299-1-git-send-email-alejandro.lucero@netronome.com>

A device with addressing limitations will invoke this function
for setting a dma mask. It has no effect if there is another
dma mask already set and more restrictive than this one.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 lib/librte_eal/common/eal_common_memory.c  | 15 +++++++++++++++
 lib/librte_eal/common/include/rte_memory.h |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index fc6c44d..39bf98c 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -109,6 +109,21 @@
 	}
 }
 
+/* set global dma mask based on device dma mask */
+void
+rte_eal_set_dma_mask(uint8_t maskbits) {
+
+	/* If no dma mask yet this is the new one */
+	if (!internal_config.dma_mask) {
+		internal_config.dma_mask = maskbits;
+		return;
+	}
+
+	/* Set dma mask just if more restrictive than current one */
+	if (internal_config.dma_mask > maskbits)
+		internal_config.dma_mask = maskbits;
+}
+
 /* return the number of memory channels */
 unsigned rte_memory_get_nchannel(void)
 {
diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index 80a8fc0..a078c31 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -209,6 +209,9 @@ struct rte_memseg {
  */
 unsigned rte_memory_get_nrank(void);
 
+/* set global dma mask based on a specific device dma mask */
+void rte_eal_set_dma_mask(uint8_t maskbits);
+
 /**
  * Drivers based on uio will not load unless physical
  * addresses are obtainable. It is only possible to get
-- 
1.9.1

  parent reply	other threads:[~2018-06-26 17:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 17:37 [dpdk-dev] [RFC] Add support for device " Alejandro Lucero
2018-06-26 17:37 ` [dpdk-dev] [PATCH 1/6] eal: add internal " Alejandro Lucero
2018-06-26 17:37 ` [dpdk-dev] [PATCH 2/6] mem: add hugepages check Alejandro Lucero
2018-06-26 17:37 ` [dpdk-dev] [PATCH 3/6] eal: check hugepages within dma mask range Alejandro Lucero
2018-06-26 17:37 ` Alejandro Lucero [this message]
2018-06-26 17:37 ` [dpdk-dev] [PATCH 5/6] ethdev: add function for dma mask Alejandro Lucero
2018-06-26 17:37 ` [dpdk-dev] [PATCH 6/6] net/nfp: set " Alejandro Lucero
2018-06-27  8:17 ` [dpdk-dev] [RFC] Add support for device " Burakov, Anatoly
2018-06-27 10:13   ` Alejandro Lucero
2018-06-27 13:24     ` Burakov, Anatoly
2018-06-27 16:52       ` Alejandro Lucero
2018-06-28  8:54         ` Burakov, Anatoly
2018-06-28  9:56           ` Alejandro Lucero
2018-06-28 10:03             ` Burakov, Anatoly
2018-06-28 10:27               ` Alejandro Lucero
2018-06-28 10:30                 ` Burakov, Anatoly

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=1530034653-28299-5-git-send-email-alejandro.lucero@netronome.com \
    --to=alejandro.lucero@netronome.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).