From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH 08/10] bus/fslmc: add check for memseg availability
Date: Thu, 22 Jun 2017 19:27:15 +0530 [thread overview]
Message-ID: <1498139837-19303-9-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1498139837-19303-1-git-send-email-hemant.agrawal@nxp.com>
From: Shreyansh Jain <shreyansh.jain@nxp.com>
Cleanup the dma map logic for memsegs. Earlier, in case
DMA mapping reaching end of segment, it reports a suprious error.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/bus/fslmc/fslmc_vfio.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8471a9a..49bb670 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -214,17 +214,18 @@ int rte_fslmc_vfio_dmamap(void)
if (is_dma_done)
return 0;
- is_dma_done = 1;
- for (i = 0; i < RTE_MAX_MEMSEG; i++) {
- memseg = rte_eal_get_physmem_layout();
- if (memseg == NULL) {
- FSLMC_VFIO_LOG(ERR, "Cannot get physical layout.");
- return -ENODEV;
- }
+ memseg = rte_eal_get_physmem_layout();
+ if (memseg == NULL) {
+ FSLMC_VFIO_LOG(ERR, "Cannot get physical layout.");
+ return -ENODEV;
+ }
- if (memseg[i].addr == NULL && memseg[i].len == 0)
+ for (i = 0; i < RTE_MAX_MEMSEG; i++) {
+ if (memseg[i].addr == NULL && memseg[i].len == 0) {
+ FSLMC_VFIO_LOG(DEBUG, "Total %d segments found.", i);
break;
+ }
dma_map.size = memseg[i].len;
dma_map.vaddr = memseg[i].addr_64;
@@ -254,12 +255,20 @@ int rte_fslmc_vfio_dmamap(void)
}
}
+ /* Verifying that at least single segment is available */
+ if (i <= 0) {
+ FSLMC_VFIO_LOG(ERR, "No Segments found for VFIO Mapping");
+ return -1;
+ }
+
/* TODO - This is a W.A. as VFIO currently does not add the mapping of
* the interrupt region to SMMU. This should be removed once the
* support is added in the Kernel.
*/
vfio_map_irq_region(group);
+ is_dma_done = 1;
+
return 0;
}
--
2.7.4
next prev parent reply other threads:[~2017-06-22 13:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 13:57 [dpdk-dev] [PATCH 00/10] NXP DPAA2 PMD changes Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 01/10] net/dpaa2: set the eth driver from dpaa2 driver Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 02/10] net/dpaa2: set data align option in mc firmware Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 03/10] net/dpaa2: align the queue numbers with " Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 04/10] net/dpaa2: check soc version for stashing enable Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 05/10] net/dpaa2: disable Tx congestion notification Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 06/10] doc: change the dpaa2 helper repository path Hemant Agrawal
2017-06-26 15:01 ` Mcnamara, John
2017-06-22 13:57 ` [dpdk-dev] [PATCH 07/10] bus/fslmc: fix the failure loop condition Hemant Agrawal
2017-06-22 13:57 ` Hemant Agrawal [this message]
2017-06-22 13:57 ` [dpdk-dev] [PATCH 09/10] net/dpaa2: add support for frame based Tx congestion Hemant Agrawal
2017-06-22 13:57 ` [dpdk-dev] [PATCH 10/10] net/dpaa2: add support for multi seg buffers Hemant Agrawal
2017-06-23 9:59 ` [dpdk-dev] [PATCH 00/10] NXP DPAA2 PMD changes 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=1498139837-19303-9-git-send-email-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=shreyansh.jain@nxp.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).