DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] pci: remove unused UNBIND support
@ 2016-12-07 18:04 Stephen Hemminger
  2016-12-08 10:53 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2016-12-07 18:04 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

No device driver sets the unbind flag in current public code base.
Therefore it is good time to remove the unused dead code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/bsdapp/eal/eal_pci.c     |  9 --------
 lib/librte_eal/common/eal_common_pci.c  |  5 -----
 lib/librte_eal/common/include/rte_pci.h |  2 --
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 39 ---------------------------------
 4 files changed, 55 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 8b3ed88..3a5c315 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -87,15 +87,6 @@
  * enabling bus master.
  */
 
-/* unbind kernel driver for this device */
-int
-pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
-{
-	RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented "
-		"for BSD\n");
-	return -ENOTSUP;
-}
-
 /* Map pci device */
 int
 rte_eal_pci_map_device(struct rte_pci_device *dev)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6bff675..33485bc 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -203,11 +203,6 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 			ret = rte_eal_pci_map_device(dev);
 			if (ret != 0)
 				return ret;
-		} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
-				rte_eal_process_type() == RTE_PROC_PRIMARY) {
-			/* unbind current driver */
-			if (pci_unbind_kernel_driver(dev) < 0)
-				return -1;
 		}
 
 		/* reference driver structure */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 9ce8847..fbc4311 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -208,8 +208,6 @@ struct rte_pci_driver {
 
 /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs to be unbound even if no module is provided */
-#define RTE_PCI_DRV_FORCE_UNBIND 0x0004
 /** Device driver supports link state interrupt */
 #define RTE_PCI_DRV_INTR_LSC	0x0008
 /** Device driver supports detaching capability */
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 876ba38..4350134 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -54,45 +54,6 @@
  * IGB_UIO driver (or doesn't initialize, if the device wasn't bound to it).
  */
 
-/* unbind kernel driver for this device */
-int
-pci_unbind_kernel_driver(struct rte_pci_device *dev)
-{
-	int n;
-	FILE *f;
-	char filename[PATH_MAX];
-	char buf[BUFSIZ];
-	struct rte_pci_addr *loc = &dev->addr;
-
-	/* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
-	snprintf(filename, sizeof(filename),
-		"%s/" PCI_PRI_FMT "/driver/unbind", pci_get_sysfs_path(),
-		loc->domain, loc->bus, loc->devid, loc->function);
-
-	f = fopen(filename, "w");
-	if (f == NULL) /* device was not bound */
-		return 0;
-
-	n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
-	             loc->domain, loc->bus, loc->devid, loc->function);
-	if ((n < 0) || (n >= (int)sizeof(buf))) {
-		RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
-		goto error;
-	}
-	if (fwrite(buf, n, 1, f) == 0) {
-		RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
-				filename);
-		goto error;
-	}
-
-	fclose(f);
-	return 0;
-
-error:
-	fclose(f);
-	return -1;
-}
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name)
 {
-- 
2.10.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [RFC] pci: remove unused UNBIND support
  2016-12-07 18:04 [dpdk-dev] [RFC] pci: remove unused UNBIND support Stephen Hemminger
@ 2016-12-08 10:53 ` David Marchand
  2016-12-21 15:15   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2016-12-08 10:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Thomas Monjalon

On Wed, Dec 7, 2016 at 7:04 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> No device driver sets the unbind flag in current public code base.
> Therefore it is good time to remove the unused dead code.

Yes, this has been unused for some time now.

I would say this is not subject to abi enforcement as this only
matters to driver api not application api.
So this can go into 17.02.

The patch looks good to me.


-- 
David Marchand

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [RFC] pci: remove unused UNBIND support
  2016-12-08 10:53 ` David Marchand
@ 2016-12-21 15:15   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-12-21 15:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Marchand, dev

2016-12-08 11:53, David Marchand:
> On Wed, Dec 7, 2016 at 7:04 PM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > No device driver sets the unbind flag in current public code base.
> > Therefore it is good time to remove the unused dead code.
> 
> Yes, this has been unused for some time now.
> 
> I would say this is not subject to abi enforcement as this only
> matters to driver api not application api.
> So this can go into 17.02.
> 
> The patch looks good to me.

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-21 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07 18:04 [dpdk-dev] [RFC] pci: remove unused UNBIND support Stephen Hemminger
2016-12-08 10:53 ` David Marchand
2016-12-21 15:15   ` Thomas Monjalon

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).