From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) by dpdk.org (Postfix) with ESMTP id CF4B42B8F for ; Wed, 7 Dec 2016 19:04:46 +0100 (CET) Received: by mail-pg0-f52.google.com with SMTP id 3so164437862pgd.0 for ; Wed, 07 Dec 2016 10:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=k2Sv/1VC9Mge4OMRJTVlciuEty3uMHYAUJ1UvdDSRLg=; b=gcwnDaBosU6f8Ra9fEDa/2NNeL4vyXQCo8ZEpXRusgztjoV7lv8+mYDdDwavL46ffH KXm7gbo6dp6W0iYWLns7CKTzHgoe9Gsk7YvqkWt1b5eGsykaAyaEvLscM16axUc79cZ/ PTW/HqN8D5GplI8LacUEo96XEvJqlr6CqN6INxfrZR+39LIHDMV3Uef6ClPUfumjWF+J DmWRiu1MaUWyVJEtPFSCuvkFVoKL7USv0iBXrdg13xhjFlbx70LSrEZHbWjFW/IDyHlh fdnV6uPUVqxKhNnA14HIv67SmRXouhYeC+QURsFcZP/NirmlGkArFZznBvYTwkNd18xe tlLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k2Sv/1VC9Mge4OMRJTVlciuEty3uMHYAUJ1UvdDSRLg=; b=HaG5miwF9M1ILVPiYDjeQ53xMuEI+6A95eNXhKYuxFBepHPa1TOt4Qp2tOBugM66nU jAIDRF/0XtIrSoc5ODn6dZdMSsbsoBpjmURIJTONy+lAn6Yb38EgW8cBHhG5uJ4iDjBL DVyfA6x1v+xoejEXGvL+TRJM+PRt+HzsMdyhAwzwgmMVc0or6hAQQjSTkyRSxFBa6Xew P06VL+uBPxI8atHvW2wSJqnAd4o69pyLSKlAd222w5OHL82swtIC0OuLvli7uBFBsA96 xkbXmNZ9KL3MmdKgrsxKPryfagfFEWWXIUpPloe4rkHF72Uc1IhGXxmqmCi4QgTVNyrd 1Hng== X-Gm-Message-State: AKaTC00JM+Pzpqw2om9oDVK45WRf8wJBcTPaJxmciT50gwppNpD5XbZB1R83RWPBUYAdCA== X-Received: by 10.99.143.9 with SMTP id n9mr56379812pgd.133.1481133885455; Wed, 07 Dec 2016 10:04:45 -0800 (PST) Received: from xeon-e3.wavecable.com (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id c128sm44199303pfc.39.2016.12.07.10.04.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2016 10:04:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 7 Dec 2016 10:04:36 -0800 Message-Id: <20161207180436.2960-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.10.2 Subject: [dpdk-dev] [RFC] pci: remove unused UNBIND support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2016 18:04:47 -0000 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 --- 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