From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 451148DA3 for ; Thu, 29 Oct 2015 09:55:11 +0100 (CET) Received: by wmeg8 with SMTP id g8so20837361wme.1 for ; Thu, 29 Oct 2015 01:55:11 -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; bh=UDu091j/MQTU+8xxECWi5vv+zL3w9qMvMwvl6WC6wU8=; b=TEoGEAKsVOBYaSYLU2RDzwxaDT0dbrpXe9/uie2GsCXLC+PUbtZl6pNLeWApV1aigt t58uC6CarRUxnyakTKaEzkQD+/ZA3P9FMYk5g2y4uqa9UU1CVsUGfMOgfH+YLuoW6Ehe Jlyl817uqea+wXquBrRsU0Q9z/ymEWwKI2AdqgdQRymt7eserOwD7/trPcbD7W+EujL8 g7Q76PzXU0l77rR8p6jYyLvqYLCvFiwlrtQWfs4eIT1ghroVkVbQ2K86eB4XxieASy9v rAartrKLz4dDujiL2sF1Mfz/u6Zw2W0LijogOLY6RzhxLcGW79p0lnkISi0NsIdvJ1gp yW+Q== 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:in-reply-to :references; bh=UDu091j/MQTU+8xxECWi5vv+zL3w9qMvMwvl6WC6wU8=; b=A34oJ1HfJlnPt1VyjLWshh7cN33/qOORJHXWFVTB/XWLOmGBt3/JiFlqIc3iOjxIbd 1gVE5P2LFSKXcYKaIcSDCdHIkjKZcsOPlm9zfzr+NUtl/ii2Xu7glUkLMXlPlWPK/XyO gVufQh4YYXvOS7Fr/2POMGMaUCPUxVM7WIdQ8x6x6yIFk4Ie4GXp6fyqcPdqIQbmcVxx A57VibwirjzParHxGCxD/i8DesuJpQTsfBKqFI7AQqasZ+T7hfXZ5CbIWqYN6SjZjVpd bZIc1840uzAU54+SrISSkCVIXkCDQI4BtY+xD2UBAczYWx2IHWz9fPT5le+om3cQDa1a 40xw== X-Gm-Message-State: ALoCoQm9op+uaK1jXCGSc2+jfj/A24epZGIBYBNru0dt7q41RTCBIMmg0dvgA02x/KEyoBXK9RrW X-Received: by 10.28.55.212 with SMTP id e203mr5535933wma.7.1446108911046; Thu, 29 Oct 2015 01:55:11 -0700 (PDT) Received: from gloops.dev.6wind.com (89-158-215-180.rev.numericable.fr. [89.158.215.180]) by smtp.gmail.com with ESMTPSA id xt1sm624273wjb.32.2015.10.29.01.55.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 01:55:10 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Thu, 29 Oct 2015 09:55:01 +0100 Message-Id: <1446108903-14412-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446108903-14412-1-git-send-email-david.marchand@6wind.com> References: <1446108903-14412-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 1/3] ethdev: rework value return by rte_eth_dev_is_detachable 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: Thu, 29 Oct 2015 08:55:11 -0000 From: Maxime Leroy The rte_eth_dev_is_detachable return 0 when the device is detachable. It not, it returns a negative value or 1. This patch modifies this function to return 1 when the device is detachable and 0 when is not. Signed-off-by: Maxime Leroy Signed-off-by: David Marchand --- lib/librte_ether/rte_ethdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f593f6e..396667c 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -507,7 +507,7 @@ rte_eth_dev_is_detachable(uint8_t port_id) if (!rte_eth_dev_is_valid_port(port_id)) { PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); - return -EINVAL; + return 0; } if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) { @@ -518,12 +518,12 @@ rte_eth_dev_is_detachable(uint8_t port_id) break; case RTE_KDRV_VFIO: default: - return -ENOTSUP; + return 0; } } drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags; - return !(drv_flags & RTE_PCI_DRV_DETACHABLE); + return drv_flags & RTE_PCI_DRV_DETACHABLE; } /* attach the new physical device, then store port_id of the device */ @@ -571,7 +571,7 @@ rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr) goto err; /* check whether the driver supports detach feature, or not */ - if (rte_eth_dev_is_detachable(port_id)) + if (!rte_eth_dev_is_detachable(port_id)) goto err; /* get pci address by port id */ @@ -648,7 +648,7 @@ rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname) goto err; /* check whether the driver supports detach feature, or not */ - if (rte_eth_dev_is_detachable(port_id)) + if (!rte_eth_dev_is_detachable(port_id)) goto err; /* get device name by port id */ -- 1.9.1