From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id B95348E8B for ; Tue, 3 Nov 2015 12:35:24 +0100 (CET) Received: by wmeg8 with SMTP id g8so82001571wme.0 for ; Tue, 03 Nov 2015 03:35:24 -0800 (PST) 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=hyJ/JGiiMcnMUftOZXMfd278uUfPpmhA9WepyuYA+c0=; b=G1eoOrXt7MABzdRB6MrixyE7QCOPQ9Sl43Vyo5Y53eAE/jd9hh5C0ea0KWRetlknks IrvXUqrbVeoOJYvbvyqKjF/EAO8J6jA7+7GNaYI4HdfsaCunNrHI+zf0cAOOvPuKrUWS WLi+VL/vAwsENBmsHTSvLG07+hKE8zKwDSn8SCl7H+JBRQXNnDWR9V7BqNkR42htJ7sI 86VknUTH/HPy3K6De67VaU/FyoNjywFik4oqHrnygl6vmac0iYnHHZP6O+ZFfFcAfmye WKLdjxydDK1uAFTOKXpJU22Xrgg7YE8NPn5+aicYWZx9jfxPzB4kt3iAX9x3E/ygYuu4 heDQ== 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=hyJ/JGiiMcnMUftOZXMfd278uUfPpmhA9WepyuYA+c0=; b=jdhETn45J4bBspIx4QxklUefgANCvR1MgIZA5qdjH2k6UNfvzKN2fWEZy+ayQo7prp 4BojG+KobsdRS0g2m1uddcKGTYuIuunuyrgnX7+40URJOW3HfCg/P3y40HjypvnVgqBg obvDAq+mYqwoKHHe7h68ZFd5RhfqNEnuGVjD6qPwYOqk0NQHCDZy+IuuEC2yJrQJtOm1 7lyKqaKrGY3q/JaLqqoyVSU8z8BJPgbez7xLuZzfB0SrUPw+GD7AZDIdxMK38ZoeaQSE 1QyI4z4ufNxtpATuWVXmXxTZkNmDhNdr3ztW4mQ4kzGvqYALDvPMbA3uLK7xu0uxr6Zp TlbQ== X-Gm-Message-State: ALoCoQlSMLqBxB6d+K05dTtDQbrMilZuFtCKh08/Of32NisohjjoW/Ca6Vpgt24mftFf2Wq527kT X-Received: by 10.28.138.148 with SMTP id m142mr17870452wmd.79.1446550524622; Tue, 03 Nov 2015 03:35:24 -0800 (PST) Received: from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id pc2sm5536175wjb.11.2015.11.03.03.35.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2015 03:35:23 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Tue, 3 Nov 2015 12:34:59 +0100 Message-Id: <1446550500-24029-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1446550500-24029-1-git-send-email-david.marchand@6wind.com> References: <1446108903-14412-1-git-send-email-david.marchand@6wind.com> <1446550500-24029-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2 1/2] 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: Tue, 03 Nov 2015 11:35:24 -0000 From: Maxime Leroy The rte_eth_dev_is_detachable return 0 when the device is detachable. It not, this one return a negative value or 1. Such behavior is not logical. 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 073ffe9..ec1b632 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -510,7 +510,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) { @@ -521,12 +521,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 */ @@ -574,7 +574,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 */ @@ -651,7 +651,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