DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver
@ 2015-03-31 22:05 Thomas Monjalon
  2015-04-01  2:12 ` Qiu, Michael
  2015-04-01  5:23 ` David Marchand
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-03-31 22:05 UTC (permalink / raw)
  To: dev

Kernel driver (kdrv) seems easier to understand than
passthrough driver (pt_driver). It's also more generic
as a PMD could run on top of any PCI kernel driver if
it would offer such support.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/bsdapp/eal/eal_pci.c     |  3 +--
 lib/librte_eal/common/include/rte_pci.h | 12 ++++++------
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 33 ++++++++++++++++-----------------
 lib/librte_ether/rte_ethdev.c           |  8 ++++----
 4 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index fe3ef86..30f0232 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -356,8 +356,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 				TAILQ_INSERT_BEFORE(dev2, dev, next);
 				return 0;
 			} else { /* already registered */
-				/* update pt_driver */
-				dev2->pt_driver = dev->pt_driver;
+				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 995f814..785852d 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -142,11 +142,11 @@ struct rte_pci_addr {
 
 struct rte_devargs;
 
-enum rte_pt_driver {
-	RTE_PT_UNKNOWN		= 0,
-	RTE_PT_IGB_UIO		= 1,
-	RTE_PT_VFIO		= 2,
-	RTE_PT_UIO_GENERIC	= 3,
+enum rte_kernel_driver {
+	RTE_KDRV_UNKNOWN = 0,
+	RTE_KDRV_IGB_UIO,
+	RTE_KDRV_VFIO,
+	RTE_KDRV_UIO_GENERIC,
 };
 
 /**
@@ -162,7 +162,7 @@ struct rte_pci_device {
 	uint16_t max_vfs;                       /**< sriov enable if not zero */
 	int numa_node;                          /**< NUMA node connection */
 	struct rte_devargs *devargs;            /**< Device user arguments */
-	enum rte_pt_driver pt_driver;		/**< Driver of passthrough */
+	enum rte_kernel_driver kdrv;            /**< Kernel driver passthrough */
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 83c589e..9cb0ffd 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -340,19 +340,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 	ret = pci_get_kernel_driver_by_path(filename, driver);
 	if (!ret) {
 		if (!strcmp(driver, "vfio-pci"))
-			dev->pt_driver = RTE_PT_VFIO;
+			dev->kdrv = RTE_KDRV_VFIO;
 		else if (!strcmp(driver, "igb_uio"))
-			dev->pt_driver = RTE_PT_IGB_UIO;
+			dev->kdrv = RTE_KDRV_IGB_UIO;
 		else if (!strcmp(driver, "uio_pci_generic"))
-			dev->pt_driver = RTE_PT_UIO_GENERIC;
+			dev->kdrv = RTE_KDRV_UIO_GENERIC;
 		else
-			dev->pt_driver = RTE_PT_UNKNOWN;
+			dev->kdrv = RTE_KDRV_UNKNOWN;
 	} else if (ret < 0) {
 		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
 		free(dev);
 		return -1;
 	} else
-		dev->pt_driver = RTE_PT_UNKNOWN;
+		dev->kdrv = RTE_KDRV_UNKNOWN;
 
 	/* device is valid, add in list (sorted) */
 	if (TAILQ_EMPTY(&pci_device_list)) {
@@ -370,8 +370,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 				TAILQ_INSERT_BEFORE(dev2, dev, next);
 				return 0;
 			} else { /* already registered */
-				/* update pt_driver */
-				dev2->pt_driver = dev->pt_driver;
+				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
@@ -570,20 +569,20 @@ pci_map_device(struct rte_pci_device *dev)
 	int ret = -1;
 
 	/* try mapping the NIC resources using VFIO if it exists */
-	switch (dev->pt_driver) {
-	case RTE_PT_VFIO:
+	switch (dev->kdrv) {
+	case RTE_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_map_resource(dev);
 #endif
 		break;
-	case RTE_PT_IGB_UIO:
-	case RTE_PT_UIO_GENERIC:
+	case RTE_KDRV_IGB_UIO:
+	case RTE_KDRV_UIO_GENERIC:
 		/* map resources for devices that use uio */
 		ret = pci_uio_map_resource(dev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL, "  Not managed by known pt driver,"
+		RTE_LOG(DEBUG, EAL, "  Not managed by a supported kernel driver,"
 			" skipped\n");
 		ret = 1;
 		break;
@@ -600,17 +599,17 @@ pci_unmap_device(struct rte_pci_device *dev)
 		return;
 
 	/* try unmapping the NIC resources using VFIO if it exists */
-	switch (dev->pt_driver) {
-	case RTE_PT_VFIO:
+	switch (dev->kdrv) {
+	case RTE_KDRV_VFIO:
 		RTE_LOG(ERR, EAL, "Hotplug doesn't support vfio yet\n");
 		break;
-	case RTE_PT_IGB_UIO:
-	case RTE_PT_UIO_GENERIC:
+	case RTE_KDRV_IGB_UIO:
+	case RTE_KDRV_UIO_GENERIC:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL, "  Not managed by known pt driver,"
+		RTE_LOG(DEBUG, EAL, "  Not managed by a supported kernel driver,"
 			" skipped\n");
 		break;
 	}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5208bad..e20cca5 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -512,11 +512,11 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 	}
 
 	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) {
-		switch (rte_eth_devices[port_id].pci_dev->pt_driver) {
-		case RTE_PT_IGB_UIO:
-		case RTE_PT_UIO_GENERIC:
+		switch (rte_eth_devices[port_id].pci_dev->kdrv) {
+		case RTE_KDRV_IGB_UIO:
+		case RTE_KDRV_UIO_GENERIC:
 			break;
-		case RTE_PT_VFIO:
+		case RTE_KDRV_VFIO:
 		default:
 			return -ENOTSUP;
 		}
-- 
2.2.2

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

* Re: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver
  2015-03-31 22:05 [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver Thomas Monjalon
@ 2015-04-01  2:12 ` Qiu, Michael
  2015-04-01  5:23 ` David Marchand
  1 sibling, 0 replies; 4+ messages in thread
From: Qiu, Michael @ 2015-04-01  2:12 UTC (permalink / raw)
  To: Thomas Monjalon, dev

On 4/1/2015 6:07 AM, Thomas Monjalon wrote:
> Kernel driver (kdrv) seems easier to understand than
> passthrough driver (pt_driver). It's also more generic
> as a PMD could run on top of any PCI kernel driver if
> it would offer such support.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---

Acked-by: Michael Qiu <michael.qiu@intel.com>
>  lib/librte_eal/bsdapp/eal/eal_pci.c     |  3 +--
>  lib/librte_eal/common/include/rte_pci.h | 12 ++++++------
>  lib/librte_eal/linuxapp/eal/eal_pci.c   | 33 ++++++++++++++++-----------------
>  lib/librte_ether/rte_ethdev.c           |  8 ++++----
>  4 files changed, 27 insertions(+), 29 deletions(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index fe3ef86..30f0232 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -356,8 +356,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
>  				TAILQ_INSERT_BEFORE(dev2, dev, next);
>  				return 0;
>  			} else { /* already registered */
> -				/* update pt_driver */
> -				dev2->pt_driver = dev->pt_driver;
> +				dev2->kdrv = dev->kdrv;
>  				dev2->max_vfs = dev->max_vfs;
>  				memmove(dev2->mem_resource,
>  					dev->mem_resource,
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index 995f814..785852d 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -142,11 +142,11 @@ struct rte_pci_addr {
>  
>  struct rte_devargs;
>  
> -enum rte_pt_driver {
> -	RTE_PT_UNKNOWN		= 0,
> -	RTE_PT_IGB_UIO		= 1,
> -	RTE_PT_VFIO		= 2,
> -	RTE_PT_UIO_GENERIC	= 3,
> +enum rte_kernel_driver {
> +	RTE_KDRV_UNKNOWN = 0,
> +	RTE_KDRV_IGB_UIO,
> +	RTE_KDRV_VFIO,
> +	RTE_KDRV_UIO_GENERIC,
>  };
>  
>  /**
> @@ -162,7 +162,7 @@ struct rte_pci_device {
>  	uint16_t max_vfs;                       /**< sriov enable if not zero */
>  	int numa_node;                          /**< NUMA node connection */
>  	struct rte_devargs *devargs;            /**< Device user arguments */
> -	enum rte_pt_driver pt_driver;		/**< Driver of passthrough */
> +	enum rte_kernel_driver kdrv;            /**< Kernel driver passthrough */
>  };
>  
>  /** Any PCI device identifier (vendor, device, ...) */
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index 83c589e..9cb0ffd 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -340,19 +340,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
>  	ret = pci_get_kernel_driver_by_path(filename, driver);
>  	if (!ret) {
>  		if (!strcmp(driver, "vfio-pci"))
> -			dev->pt_driver = RTE_PT_VFIO;
> +			dev->kdrv = RTE_KDRV_VFIO;
>  		else if (!strcmp(driver, "igb_uio"))
> -			dev->pt_driver = RTE_PT_IGB_UIO;
> +			dev->kdrv = RTE_KDRV_IGB_UIO;
>  		else if (!strcmp(driver, "uio_pci_generic"))
> -			dev->pt_driver = RTE_PT_UIO_GENERIC;
> +			dev->kdrv = RTE_KDRV_UIO_GENERIC;
>  		else
> -			dev->pt_driver = RTE_PT_UNKNOWN;
> +			dev->kdrv = RTE_KDRV_UNKNOWN;
>  	} else if (ret < 0) {
>  		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
>  		free(dev);
>  		return -1;
>  	} else
> -		dev->pt_driver = RTE_PT_UNKNOWN;
> +		dev->kdrv = RTE_KDRV_UNKNOWN;
>  
>  	/* device is valid, add in list (sorted) */
>  	if (TAILQ_EMPTY(&pci_device_list)) {
> @@ -370,8 +370,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
>  				TAILQ_INSERT_BEFORE(dev2, dev, next);
>  				return 0;
>  			} else { /* already registered */
> -				/* update pt_driver */
> -				dev2->pt_driver = dev->pt_driver;
> +				dev2->kdrv = dev->kdrv;
>  				dev2->max_vfs = dev->max_vfs;
>  				memmove(dev2->mem_resource,
>  					dev->mem_resource,
> @@ -570,20 +569,20 @@ pci_map_device(struct rte_pci_device *dev)
>  	int ret = -1;
>  
>  	/* try mapping the NIC resources using VFIO if it exists */
> -	switch (dev->pt_driver) {
> -	case RTE_PT_VFIO:
> +	switch (dev->kdrv) {
> +	case RTE_KDRV_VFIO:
>  #ifdef VFIO_PRESENT
>  		if (pci_vfio_is_enabled())
>  			ret = pci_vfio_map_resource(dev);
>  #endif
>  		break;
> -	case RTE_PT_IGB_UIO:
> -	case RTE_PT_UIO_GENERIC:
> +	case RTE_KDRV_IGB_UIO:
> +	case RTE_KDRV_UIO_GENERIC:
>  		/* map resources for devices that use uio */
>  		ret = pci_uio_map_resource(dev);
>  		break;
>  	default:
> -		RTE_LOG(DEBUG, EAL, "  Not managed by known pt driver,"
> +		RTE_LOG(DEBUG, EAL, "  Not managed by a supported kernel driver,"
>  			" skipped\n");
>  		ret = 1;
>  		break;
> @@ -600,17 +599,17 @@ pci_unmap_device(struct rte_pci_device *dev)
>  		return;
>  
>  	/* try unmapping the NIC resources using VFIO if it exists */
> -	switch (dev->pt_driver) {
> -	case RTE_PT_VFIO:
> +	switch (dev->kdrv) {
> +	case RTE_KDRV_VFIO:
>  		RTE_LOG(ERR, EAL, "Hotplug doesn't support vfio yet\n");
>  		break;
> -	case RTE_PT_IGB_UIO:
> -	case RTE_PT_UIO_GENERIC:
> +	case RTE_KDRV_IGB_UIO:
> +	case RTE_KDRV_UIO_GENERIC:
>  		/* unmap resources for devices that use uio */
>  		pci_uio_unmap_resource(dev);
>  		break;
>  	default:
> -		RTE_LOG(DEBUG, EAL, "  Not managed by known pt driver,"
> +		RTE_LOG(DEBUG, EAL, "  Not managed by a supported kernel driver,"
>  			" skipped\n");
>  		break;
>  	}
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 5208bad..e20cca5 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -512,11 +512,11 @@ rte_eth_dev_is_detachable(uint8_t port_id)
>  	}
>  
>  	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) {
> -		switch (rte_eth_devices[port_id].pci_dev->pt_driver) {
> -		case RTE_PT_IGB_UIO:
> -		case RTE_PT_UIO_GENERIC:
> +		switch (rte_eth_devices[port_id].pci_dev->kdrv) {
> +		case RTE_KDRV_IGB_UIO:
> +		case RTE_KDRV_UIO_GENERIC:
>  			break;
> -		case RTE_PT_VFIO:
> +		case RTE_KDRV_VFIO:
>  		default:
>  			return -ENOTSUP;
>  		}


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

* Re: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver
  2015-03-31 22:05 [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver Thomas Monjalon
  2015-04-01  2:12 ` Qiu, Michael
@ 2015-04-01  5:23 ` David Marchand
  2015-04-01 19:15   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: David Marchand @ 2015-04-01  5:23 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hello Thomas,


On Wed, Apr 1, 2015 at 12:05 AM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> Kernel driver (kdrv) seems easier to understand than
> passthrough driver (pt_driver). It's also more generic
> as a PMD could run on top of any PCI kernel driver if
> it would offer such support.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal_pci.c     |  3 +--
>  lib/librte_eal/common/include/rte_pci.h | 12 ++++++------
>  lib/librte_eal/linuxapp/eal/eal_pci.c   | 33
> ++++++++++++++++-----------------
>  lib/librte_ether/rte_ethdev.c           |  8 ++++----
>  4 files changed, 27 insertions(+), 29 deletions(-)
>

This looks ok for me.
I suppose you checked it builds fine on both linux and bsd ?

Acked-by: David Marchand <david.marchand@6wind.com>

-- 
David Marchand

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

* Re: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver
  2015-04-01  5:23 ` David Marchand
@ 2015-04-01 19:15   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-04-01 19:15 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

> > Kernel driver (kdrv) seems easier to understand than
> > passthrough driver (pt_driver). It's also more generic
> > as a PMD could run on top of any PCI kernel driver if
> > it would offer such support.
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> > ---
> >  lib/librte_eal/bsdapp/eal/eal_pci.c     |  3 +--
> >  lib/librte_eal/common/include/rte_pci.h | 12 ++++++------
> >  lib/librte_eal/linuxapp/eal/eal_pci.c   | 33
> > ++++++++++++++++-----------------
> >  lib/librte_ether/rte_ethdev.c           |  8 ++++----
> >  4 files changed, 27 insertions(+), 29 deletions(-)
> >
> 
> This looks ok for me.
> I suppose you checked it builds fine on both linux and bsd ?

Yes it builds fine in my Linux and FreeBSD 10.0.

> Acked-by: David Marchand <david.marchand@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2015-04-01 19:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 22:05 [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver Thomas Monjalon
2015-04-01  2:12 ` Qiu, Michael
2015-04-01  5:23 ` David Marchand
2015-04-01 19: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).