From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 409046A94 for ; Wed, 1 Apr 2015 00:06:42 +0200 (CEST) Received: by wgdm6 with SMTP id m6so34238088wgd.2 for ; Tue, 31 Mar 2015 15:06:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=DtzcNE0BLV7cpJDGv1rfg8j/90w/Pxwmiqw7Wo1WXIU=; b=Db5G5GiRZi/qpsn/1LnKyEg2SyIKkIasu0G2zsQBXVpQNALIjM3zebGqMEHLESoM8n MAerXEbPVM6DEVmpt0ajeQPQcxnQ+Rh+Zn/PGxYP9/SBcUVxqXQJHOvcVoOK66Z0x3h3 oeIxnkxg8ltuGnORWa9yKiADgql3/TKc+8QuEe2PBEf7qim01EyjsoVDKEc48mFRLVcy 3HGvOJGLtEk8aQU3JNmfpPFMAG4+KtX0Ejz6gIol12zJJv0XLY2szPtQiVJLIBS71n4W G4J/u6ageFRtto8dImzZq9q4LKgV6z7LrxxCuRKOdoZi6fqtSUm/E2WVPqqwYJis4yOe IZKQ== X-Gm-Message-State: ALoCoQn7q4PDr6IDX9tBzhppfIk4LEnaOvjmRTlv0eFdVWh2bg6i05PC1dv8NdieQA+AWD2q98gh X-Received: by 10.194.175.137 with SMTP id ca9mr74424910wjc.67.1427839602141; Tue, 31 Mar 2015 15:06:42 -0700 (PDT) Received: from localhost.localdomain (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id ei8sm22703722wib.10.2015.03.31.15.06.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Mar 2015 15:06:41 -0700 (PDT) From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 1 Apr 2015 00:05:47 +0200 Message-Id: <1427839547-14705-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.2.2 Subject: [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: Tue, 31 Mar 2015 22:06:42 -0000 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 --- 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