From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 483711B779 for ; Tue, 24 Oct 2017 10:59:52 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id b9so8963325wmh.0 for ; Tue, 24 Oct 2017 01:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=UQxb1IIU1Uo8C0RHD4cqhMJMZWLhJ4V/E1DBCxXVTz0=; b=O6fomzjZEPbNrthT/6srY5Z8EY9jI8yzgMnJ5Z562dV0lWVcLozGdEyd8U83MhkWHS UTPNa92CkNbHaIRamn1hqCTkuCYHaMUXw5+IhVe5K8aOUkwTza1xGY7QZo2a0tBdD2xf tu+PI23CyFNzGVoobUxJsxILUDPPsQq/bEWBkL13yRYb0u7y4FGYOywVvvnFLkl7Zdgf qxXuoxhIwyFOoPUBdvygSVkbZnBcysVp8kORsDFbzxxjoALTdV8SIuMeqk5XCyUrgkHD Ar8SmToHOIzxfwSgEVyh2S7GV67EyNXp+Q/wu4A+8bROiiumoNiaZ5D2r2IymyNrLGtW NOmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=UQxb1IIU1Uo8C0RHD4cqhMJMZWLhJ4V/E1DBCxXVTz0=; b=hKIcSAiqTUFn2l6D20G68nLJ+nic6OfvcN2Nd2E7yJglsw++inw37ZIEuw6woAEMEY JqAy1PU1SVuPT3suNkusZzSohiavpLLc5p0KTeIMHdxrS79uG9I8kK/3VvCEsq3EQsfU V5l5kTB9Qwl8p9D1R657Ygt2LYMJxc5lWoNxFCcAWANyKFI9V/Hbk31cLndAhYGs/Jjb h5V1o/7WbtkbciqJKK8QQamQ3TKCNQkxVK2Ws//0H4jXMxUU8Io9WY5MfnIWBm2PkrDY 9N8StDP7Zi1NkkErRInufOetr0jU+7g6d6duB6SwumZToObGujOu+LN5FhXUia1E8XiN XT0A== X-Gm-Message-State: AMCzsaVHzBJGyQbJqDjffdsLrU/++zsH8w26j/u4Ux6sfim+eIQ4f7Pp edcpxz5WdhjL2TKISzHwhmoxp/BO X-Google-Smtp-Source: ABhQp+TGBLKGtNiWzz7HJeLIwbV8/XJDLxYfa/j7DKuYKmwmHOHAzAdnL67ZllmQApTYv7yJ46DtlQ== X-Received: by 10.80.170.135 with SMTP id q7mr11463074edc.134.1508835591670; Tue, 24 Oct 2017 01:59:51 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id d30sm5639939ede.10.2017.10.24.01.59.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Oct 2017 01:59:51 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 24 Oct 2017 10:59:23 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v1 3/3] pci: propagate PMD removal error value for unplug 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: Tue, 24 Oct 2017 08:59:52 -0000 If a PCI device detach removal fails, returns the actual removal operator error value. Use this value within pci->unplug, as it may help applications solve an issue with the feature or more accurately warn their users. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 0f0e4b9..fb92ee7 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -263,6 +263,7 @@ rte_pci_detach_dev(struct rte_pci_device *dev) { struct rte_pci_addr *loc; struct rte_pci_driver *dr; + int ret = 0; if (dev == NULL) return -EINVAL; @@ -277,8 +278,11 @@ rte_pci_detach_dev(struct rte_pci_device *dev) RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); - if (dr->remove && (dr->remove(dev) < 0)) - return -1; /* negative value is an error */ + if (dr->remove) { + ret = dr->remove(dev); + if (ret < 0) + return ret; + } /* clear driver structure */ dev->driver = NULL; @@ -551,8 +555,10 @@ pci_unplug(struct rte_device *dev) pdev = RTE_DEV_TO_PCI(dev); ret = rte_pci_detach_dev(pdev); - rte_pci_remove_device(pdev); - free(pdev); + if (ret == 0) { + rte_pci_remove_device(pdev); + free(pdev); + } return ret; } -- 2.1.4