DPDK patches and discussions
 help / color / mirror / Atom feed
From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <david.marchand@redhat.com>, <Nipun.Gupta@amd.com>,
	<nikhil.agarwal@amd.com>
Cc: <dev@dpdk.org>, <Ferruh.Yigit@amd.com>, <thomas@monjalon.net>,
	"Abhijit Gangurde" <abhijit.gangurde@amd.com>
Subject: [PATCH v4 1/1] bus/cdx: provide driver flag for optional resource mapping
Date: Mon, 16 Oct 2023 14:46:34 +0530	[thread overview]
Message-ID: <20231016091634.2770946-1-abhijit.gangurde@amd.com> (raw)
In-Reply-To: <20230626103958.3139-1-abhijit.gangurde@amd.com>

Provide driver flag which gives an option to map the cdx device
resource before probing the device driver. External driver can
use rte_cdx_map_device() and rte_cdx_unmap_device() APIs to map/
unmap device resource separately.

Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
 v4:
 - rte_cdx_map_device() and rte_cdx_unmap_device() APIs are kept
   as internal APIs.

 v3:
 - Changed APIs to __rte_experimental.

 v2:
 - Corrected _RTE_BUS_CDX_H_ to RTE_BUS_CDX_H
 - Improved code comments.

 drivers/bus/cdx/bus_cdx_driver.h |  3 +++
 drivers/bus/cdx/cdx.c            | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h
index fcacdb5896..1c9a64c87a 100644
--- a/drivers/bus/cdx/bus_cdx_driver.h
+++ b/drivers/bus/cdx/bus_cdx_driver.h
@@ -37,6 +37,9 @@ struct rte_cdx_bus;
 static const char DRV_EXP_TAG(name, cdx_tbl_export)[] __rte_used = \
 RTE_STR(table)
 
+/** Device needs resource mapping */
+#define RTE_CDX_DRV_NEED_MAPPING 0x0001
+
 /**
  * A structure describing an ID for a CDX driver. Each driver provides a
  * table of these IDs for each device that it supports.
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index f9526e08cc..541aae76c3 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -383,10 +383,12 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr,
 	CDX_BUS_DEBUG("  probe device %s using driver: %s", dev_name,
 		dr->driver.name);
 
-	ret = cdx_vfio_map_resource(dev);
-	if (ret != 0) {
-		CDX_BUS_ERR("CDX map device failed: %d", ret);
-		goto error_map_device;
+	if (dr->drv_flags & RTE_CDX_DRV_NEED_MAPPING) {
+		ret = cdx_vfio_map_resource(dev);
+		if (ret != 0) {
+			CDX_BUS_ERR("CDX map device failed: %d", ret);
+			goto error_map_device;
+		}
 	}
 
 	/* call the driver probe() function */
-- 
2.34.1


  parent reply	other threads:[~2023-10-16  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 10:39 [PATCH] " Abhijit Gangurde
2023-07-04 11:22 ` Gupta, Nipun
2023-07-05  6:52 ` [PATCH v2] " Abhijit Gangurde
2023-07-11  5:51   ` [PATCH v3] " Abhijit Gangurde
2023-07-11 15:05     ` Gupta, Nipun
2023-09-29 15:17     ` David Marchand
2023-10-04 10:06       ` Gangurde, Abhijit
2023-10-04 12:54         ` David Marchand
2023-10-13 11:51           ` Gangurde, Abhijit
2023-10-13 12:15             ` David Marchand
2023-07-07  8:35 ` [PATCH] " Gupta, Nipun
2023-10-16  9:16 ` Abhijit Gangurde [this message]
2023-10-16 15:21   ` [PATCH v4 1/1] " 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=20231016091634.2770946-1-abhijit.gangurde@amd.com \
    --to=abhijit.gangurde@amd.com \
    --cc=Ferruh.Yigit@amd.com \
    --cc=Nipun.Gupta@amd.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=thomas@monjalon.net \
    /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).