[dpdk-dev] rte, eal: Rename pci_update_device and make it public

Message ID 1486954428-94003-1-git-send-email-ziye.yang@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Ziye Yang Feb. 13, 2017, 2:53 a.m. UTC
  The reaon is that sometimes we only like to rebound the
kernel driver or VFIO or UIO or other drivers for
this device after rte_eal_detach function. Function
rte_eal_pci_probe_one not only updates the device but
also probes the rte_eal_driver for this device, it is
not flexible.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal_pci.c     |  2 +-
 lib/librte_eal/common/eal_common_pci.c  |  2 +-
 lib/librte_eal/common/eal_private.h     | 13 -------------
 lib/librte_eal/common/include/rte_pci.h | 14 ++++++++++++++
 lib/librte_eal/linuxapp/eal/eal_pci.c   |  2 +-
 5 files changed, 17 insertions(+), 16 deletions(-)
  

Comments

Thomas Monjalon March 9, 2017, 5:58 p.m. UTC | #1
2017-02-13 10:53, Ziye Yang:
> The reaon is that sometimes we only like to rebound the
> kernel driver or VFIO or UIO or other drivers for
> this device after rte_eal_detach function. Function
> rte_eal_pci_probe_one not only updates the device but
> also probes the rte_eal_driver for this device, it is
> not flexible.
> 
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal_pci.c     |  2 +-
>  lib/librte_eal/common/eal_common_pci.c  |  2 +-
>  lib/librte_eal/common/eal_private.h     | 13 -------------
>  lib/librte_eal/common/include/rte_pci.h | 14 ++++++++++++++
>  lib/librte_eal/linuxapp/eal/eal_pci.c   |  2 +-
>  5 files changed, 17 insertions(+), 16 deletions(-)

The PCI bus management is going to change with the new bus framework.
Please check pending developments or future version for your needs.

This patch will be marked as rejected because of the conflicting work
in progress.
  
Ziye Yang March 9, 2017, 11:04 p.m. UTC | #2
Hi  Thomas,

That's OK. Hope that the need of usage can be considered in the new framework.

-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] 
Sent: Friday, March 10, 2017 1:58 AM
To: Yang, Ziye <ziye.yang@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] rte, eal: Rename pci_update_device and make it public

2017-02-13 10:53, Ziye Yang:
> The reaon is that sometimes we only like to rebound the kernel driver 
> or VFIO or UIO or other drivers for this device after rte_eal_detach 
> function. Function rte_eal_pci_probe_one not only updates the device 
> but also probes the rte_eal_driver for this device, it is not 
> flexible.
> 
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal_pci.c     |  2 +-
>  lib/librte_eal/common/eal_common_pci.c  |  2 +-
>  lib/librte_eal/common/eal_private.h     | 13 -------------
>  lib/librte_eal/common/include/rte_pci.h | 14 ++++++++++++++
>  lib/librte_eal/linuxapp/eal/eal_pci.c   |  2 +-
>  5 files changed, 17 insertions(+), 16 deletions(-)

The PCI bus management is going to change with the new bus framework.
Please check pending developments or future version for your needs.

This patch will be marked as rejected because of the conflicting work in progress.
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 3a5c315..052b91e 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -398,7 +398,7 @@ 
 }
 
 int
-pci_update_device(const struct rte_pci_addr *addr)
+rte_eal_pci_update_device(const struct rte_pci_addr *addr)
 {
 	int fd;
 	struct pci_conf matches[2];
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 72547bd..1d5f581 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -351,7 +351,7 @@  static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
 	/* update current pci device in global list, kernel bindings might have
 	 * changed since last time we looked at it.
 	 */
-	if (pci_update_device(addr) < 0)
+	if (rte_eal_pci_update_device(addr) < 0)
 		goto err_return;
 
 	TAILQ_FOREACH(dev, &pci_device_list, next) {
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 9e7d8f6..770284f 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -122,19 +122,6 @@ 
 struct rte_pci_device;
 
 /**
- * Update a pci device object by asking the kernel for the latest information.
- *
- * This function is private to EAL.
- *
- * @param addr
- *	The PCI Bus-Device-Function address to look for
- * @return
- *   - 0 on success.
- *   - negative on error.
- */
-int pci_update_device(const struct rte_pci_addr *addr);
-
-/**
  * Unbind kernel driver for this device
  *
  * This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8557e47..71b8309 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -442,6 +442,20 @@  void *pci_map_resource(void *requested_addr, int fd, off_t offset,
 void pci_unmap_resource(void *requested_addr, size_t size);
 
 /**
+ * Update the PCI device in global list
+ *
+ * Update the driver of pci device  and add it in global list,
+ * kernel bindings might have changed since last time we looked at it.
+ *
+ * @param addr
+ *	The PCI Bus-Device-Function address to update.
+ * @return
+ *   - 0 on success.
+ *   - Negative on error.
+ */
+int rte_eal_pci_update_device(const struct rte_pci_addr *addr);
+
+/**
  * Probe the single PCI device.
  *
  * Scan the content of the PCI bus, and find the pci device specified by pci
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index e2fc219..5cff70e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -378,7 +378,7 @@ 
 }
 
 int
-pci_update_device(const struct rte_pci_addr *addr)
+rte_eal_pci_update_device(const struct rte_pci_addr *addr)
 {
 	char filename[PATH_MAX];