From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 03EDD6942 for ; Wed, 1 Apr 2015 04:12:56 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 31 Mar 2015 19:12:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,503,1422950400"; d="scan'208";a="688615888" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by fmsmga001.fm.intel.com with ESMTP; 31 Mar 2015 19:12:55 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 1 Apr 2015 10:12:19 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.24]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.71]) with mapi id 14.03.0224.002; Wed, 1 Apr 2015 10:12:18 +0800 From: "Qiu, Michael" To: Thomas Monjalon , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver Thread-Index: AQHQa/8J2fK4wBs1e0eSMm3ZDMr/Gg== Date: Wed, 1 Apr 2015 02:12:18 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286D2A59C@SHSMSX101.ccr.corp.intel.com> References: <1427839547-14705-1-git-send-email-thomas.monjalon@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] pci: rename passthrough driver to kernel driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2015 02:12:57 -0000 On 4/1/2015 6:07 AM, Thomas Monjalon wrote:=0A= > Kernel driver (kdrv) seems easier to understand than=0A= > passthrough driver (pt_driver). It's also more generic=0A= > as a PMD could run on top of any PCI kernel driver if=0A= > it would offer such support.=0A= >=0A= > Signed-off-by: Thomas Monjalon =0A= > ---=0A= =0A= Acked-by: Michael Qiu =0A= > lib/librte_eal/bsdapp/eal/eal_pci.c | 3 +--=0A= > lib/librte_eal/common/include/rte_pci.h | 12 ++++++------=0A= > lib/librte_eal/linuxapp/eal/eal_pci.c | 33 ++++++++++++++++-----------= ------=0A= > lib/librte_ether/rte_ethdev.c | 8 ++++----=0A= > 4 files changed, 27 insertions(+), 29 deletions(-)=0A= >=0A= > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/= eal/eal_pci.c=0A= > index fe3ef86..30f0232 100644=0A= > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c=0A= > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c=0A= > @@ -356,8 +356,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)= =0A= > TAILQ_INSERT_BEFORE(dev2, dev, next);=0A= > return 0;=0A= > } else { /* already registered */=0A= > - /* update pt_driver */=0A= > - dev2->pt_driver =3D dev->pt_driver;=0A= > + dev2->kdrv =3D dev->kdrv;=0A= > dev2->max_vfs =3D dev->max_vfs;=0A= > memmove(dev2->mem_resource,=0A= > dev->mem_resource,=0A= > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/com= mon/include/rte_pci.h=0A= > index 995f814..785852d 100644=0A= > --- a/lib/librte_eal/common/include/rte_pci.h=0A= > +++ b/lib/librte_eal/common/include/rte_pci.h=0A= > @@ -142,11 +142,11 @@ struct rte_pci_addr {=0A= > =0A= > struct rte_devargs;=0A= > =0A= > -enum rte_pt_driver {=0A= > - RTE_PT_UNKNOWN =3D 0,=0A= > - RTE_PT_IGB_UIO =3D 1,=0A= > - RTE_PT_VFIO =3D 2,=0A= > - RTE_PT_UIO_GENERIC =3D 3,=0A= > +enum rte_kernel_driver {=0A= > + RTE_KDRV_UNKNOWN =3D 0,=0A= > + RTE_KDRV_IGB_UIO,=0A= > + RTE_KDRV_VFIO,=0A= > + RTE_KDRV_UIO_GENERIC,=0A= > };=0A= > =0A= > /**=0A= > @@ -162,7 +162,7 @@ struct rte_pci_device {=0A= > uint16_t max_vfs; /**< sriov enable if not zero *= /=0A= > int numa_node; /**< NUMA node connection */=0A= > struct rte_devargs *devargs; /**< Device user arguments */= =0A= > - enum rte_pt_driver pt_driver; /**< Driver of passthrough */=0A= > + enum rte_kernel_driver kdrv; /**< Kernel driver passthrough = */=0A= > };=0A= > =0A= > /** Any PCI device identifier (vendor, device, ...) */=0A= > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linux= app/eal/eal_pci.c=0A= > index 83c589e..9cb0ffd 100644=0A= > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c=0A= > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c=0A= > @@ -340,19 +340,19 @@ pci_scan_one(const char *dirname, uint16_t domain, = uint8_t bus,=0A= > ret =3D pci_get_kernel_driver_by_path(filename, driver);=0A= > if (!ret) {=0A= > if (!strcmp(driver, "vfio-pci"))=0A= > - dev->pt_driver =3D RTE_PT_VFIO;=0A= > + dev->kdrv =3D RTE_KDRV_VFIO;=0A= > else if (!strcmp(driver, "igb_uio"))=0A= > - dev->pt_driver =3D RTE_PT_IGB_UIO;=0A= > + dev->kdrv =3D RTE_KDRV_IGB_UIO;=0A= > else if (!strcmp(driver, "uio_pci_generic"))=0A= > - dev->pt_driver =3D RTE_PT_UIO_GENERIC;=0A= > + dev->kdrv =3D RTE_KDRV_UIO_GENERIC;=0A= > else=0A= > - dev->pt_driver =3D RTE_PT_UNKNOWN;=0A= > + dev->kdrv =3D RTE_KDRV_UNKNOWN;=0A= > } else if (ret < 0) {=0A= > RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");=0A= > free(dev);=0A= > return -1;=0A= > } else=0A= > - dev->pt_driver =3D RTE_PT_UNKNOWN;=0A= > + dev->kdrv =3D RTE_KDRV_UNKNOWN;=0A= > =0A= > /* device is valid, add in list (sorted) */=0A= > if (TAILQ_EMPTY(&pci_device_list)) {=0A= > @@ -370,8 +370,7 @@ pci_scan_one(const char *dirname, uint16_t domain, ui= nt8_t bus,=0A= > TAILQ_INSERT_BEFORE(dev2, dev, next);=0A= > return 0;=0A= > } else { /* already registered */=0A= > - /* update pt_driver */=0A= > - dev2->pt_driver =3D dev->pt_driver;=0A= > + dev2->kdrv =3D dev->kdrv;=0A= > dev2->max_vfs =3D dev->max_vfs;=0A= > memmove(dev2->mem_resource,=0A= > dev->mem_resource,=0A= > @@ -570,20 +569,20 @@ pci_map_device(struct rte_pci_device *dev)=0A= > int ret =3D -1;=0A= > =0A= > /* try mapping the NIC resources using VFIO if it exists */=0A= > - switch (dev->pt_driver) {=0A= > - case RTE_PT_VFIO:=0A= > + switch (dev->kdrv) {=0A= > + case RTE_KDRV_VFIO:=0A= > #ifdef VFIO_PRESENT=0A= > if (pci_vfio_is_enabled())=0A= > ret =3D pci_vfio_map_resource(dev);=0A= > #endif=0A= > break;=0A= > - case RTE_PT_IGB_UIO:=0A= > - case RTE_PT_UIO_GENERIC:=0A= > + case RTE_KDRV_IGB_UIO:=0A= > + case RTE_KDRV_UIO_GENERIC:=0A= > /* map resources for devices that use uio */=0A= > ret =3D pci_uio_map_resource(dev);=0A= > break;=0A= > default:=0A= > - RTE_LOG(DEBUG, EAL, " Not managed by known pt driver,"=0A= > + RTE_LOG(DEBUG, EAL, " Not managed by a supported kernel driver,"=0A= > " skipped\n");=0A= > ret =3D 1;=0A= > break;=0A= > @@ -600,17 +599,17 @@ pci_unmap_device(struct rte_pci_device *dev)=0A= > return;=0A= > =0A= > /* try unmapping the NIC resources using VFIO if it exists */=0A= > - switch (dev->pt_driver) {=0A= > - case RTE_PT_VFIO:=0A= > + switch (dev->kdrv) {=0A= > + case RTE_KDRV_VFIO:=0A= > RTE_LOG(ERR, EAL, "Hotplug doesn't support vfio yet\n");=0A= > break;=0A= > - case RTE_PT_IGB_UIO:=0A= > - case RTE_PT_UIO_GENERIC:=0A= > + case RTE_KDRV_IGB_UIO:=0A= > + case RTE_KDRV_UIO_GENERIC:=0A= > /* unmap resources for devices that use uio */=0A= > pci_uio_unmap_resource(dev);=0A= > break;=0A= > default:=0A= > - RTE_LOG(DEBUG, EAL, " Not managed by known pt driver,"=0A= > + RTE_LOG(DEBUG, EAL, " Not managed by a supported kernel driver,"=0A= > " skipped\n");=0A= > break;=0A= > }=0A= > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c=0A= > index 5208bad..e20cca5 100644=0A= > --- a/lib/librte_ether/rte_ethdev.c=0A= > +++ b/lib/librte_ether/rte_ethdev.c=0A= > @@ -512,11 +512,11 @@ rte_eth_dev_is_detachable(uint8_t port_id)=0A= > }=0A= > =0A= > if (rte_eth_devices[port_id].dev_type =3D=3D RTE_ETH_DEV_PCI) {=0A= > - switch (rte_eth_devices[port_id].pci_dev->pt_driver) {=0A= > - case RTE_PT_IGB_UIO:=0A= > - case RTE_PT_UIO_GENERIC:=0A= > + switch (rte_eth_devices[port_id].pci_dev->kdrv) {=0A= > + case RTE_KDRV_IGB_UIO:=0A= > + case RTE_KDRV_UIO_GENERIC:=0A= > break;=0A= > - case RTE_PT_VFIO:=0A= > + case RTE_KDRV_VFIO:=0A= > default:=0A= > return -ENOTSUP;=0A= > }=0A= =0A=