DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Qiu, Michael" <michael.qiu@intel.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver
Date: Wed, 1 Apr 2015 02:12:18 +0000	[thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E60286D2A59C@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1427839547-14705-1-git-send-email-thomas.monjalon@6wind.com>

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;
>  		}


  reply	other threads:[~2015-04-01  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 22:05 Thomas Monjalon
2015-04-01  2:12 ` Qiu, Michael [this message]
2015-04-01  5:23 ` David Marchand
2015-04-01 19:15   ` 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=533710CFB86FA344BFBF2D6802E60286D2A59C@SHSMSX101.ccr.corp.intel.com \
    --to=michael.qiu@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.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).