From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 497C81B79A for ; Tue, 24 Oct 2017 12:36:01 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id r68so15313353wmr.3 for ; Tue, 24 Oct 2017 03:36:01 -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=e2thn8kyfQZ6PqC88SXGRgKw7z1XRjM650JeZd0Fl2Q=; b=Kbq7CVDX0Ipq2F2BcWtf3cVow4vhDjYNzwvsj5XXFQDtaPK1XHBfqdLqfBn1R29mSQ HZQnyk517qszAHp/UV8sG9QRJEN1LxNaWpuAWjiTBiHA30n+sHXaMbdJWZcIM/gsIx4X JgrLzJMdFFUOqg2+23CyjhbTY9aQ+Ytoyb089PkQT33o/mhxNK8inKS459WmfCrKSES2 ufJMNHmXVwPJO3o6UTq4Hpen6WuIO/Fv/vKfHsMVe/6LVZpdikqR6AMuUi5Dcy8YrhV/ 1l8Z5pKZ9u6/Z5pY1DmDvLhayxjWkckm4cI9SCA02kR36KsWyCmBlL+qYhv92CpNXH5+ 8bvw== 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; bh=e2thn8kyfQZ6PqC88SXGRgKw7z1XRjM650JeZd0Fl2Q=; b=ijxdd0EaapkA9AgB6B8/BGDq8Q0pCdNvvB3Lix08JUI4S30kG8g8X1n1up/fLiJC5m VapIN6/Q/s070L6Ups15W2wNXjqraDn5m6VOtEjiGk9/HCZQ4fBPVSzC8jM50hDsNpqF Mh857J8+jLEGzCsHeIdZQRq6s2op5d+EYzD/cglmxnOpQdw9GnUonwvmr0eDur/0SnDn UafdKQ+8Ng/XOt6ZJfYXhyVAlqa51jc1p5a8Cl/7L+Rup53a7A6bLrY1hU8+VqvC/soE 89gfg4K4swX3JL1Bhb1byPAtlbr1SVMA1KwGZh44IGdDuCXNN0/Y16K4g06uNBlHsjs7 jb3A== X-Gm-Message-State: AMCzsaXcMmfz34l1ShqZjqLhs25jA01AHi2Y3pRm9btN7Ir0QqD0CGLE nCVyrb9go1ZqIy6sg4XNQK3ZQbEy X-Google-Smtp-Source: ABhQp+TK/XsfE6R9y4vcI0KuoMykprMBeymNwTrQCPR7xshXHm0HT0215yhEJMGF6ravRIUHmrNPLQ== X-Received: by 10.28.130.140 with SMTP id e134mr5562378wmd.159.1508841360303; Tue, 24 Oct 2017 03:36:00 -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 w4sm12205088wrc.17.2017.10.24.03.35.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Oct 2017 03:35:59 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 24 Oct 2017 12:35:37 +0200 Message-Id: <409639fdf67753288cff5bf7d91f725666ff5678.1508840586.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 1/6] ethdev: do not rely on detachable flag in detach 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 10:36:01 -0000 This flag is deprecated and should not be used to check for the device ability to be detached. The rte_dev library call will fail with the relevant error code if detaching this port is not possible. Signed-off-by: Gaetan Rivet --- lib/librte_ether/rte_ethdev.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0b1e928..d9a71e2 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -356,21 +356,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) return -ENODEV; } -static int -rte_eth_dev_is_detachable(uint16_t port_id) -{ - uint32_t dev_flags; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); - - dev_flags = rte_eth_devices[port_id].data->dev_flags; - if ((dev_flags & RTE_ETH_DEV_DETACHABLE) && - (!(dev_flags & RTE_ETH_DEV_BONDED_SLAVE))) - return 0; - else - return 1; -} - /* attach the new device, then store port_id of the device */ int rte_eth_dev_attach(const char *devargs, uint16_t *port_id) @@ -421,16 +406,23 @@ rte_eth_dev_attach(const char *devargs, uint16_t *port_id) int rte_eth_dev_detach(uint16_t port_id, char *name) { + uint32_t dev_flags; int ret = -1; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); + if (name == NULL) { ret = -EINVAL; goto err; } - /* FIXME: move this to eal, once device flags are relocated there */ - if (rte_eth_dev_is_detachable(port_id)) + dev_flags = rte_eth_devices[port_id].data->dev_flags; + if (dev_flags & RTE_ETH_DEV_BONDED_SLAVE) { + RTE_LOG(ERR, EAL, "Port %" PRIu16 " is bonded, cannot detach\n", + port_id); + ret = -ENOTSUP; goto err; + } snprintf(name, sizeof(rte_eth_devices[port_id].data->name), "%s", rte_eth_devices[port_id].data->name); -- 2.1.4