From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by dpdk.org (Postfix) with ESMTP id 75607ADCC for ; Tue, 24 Feb 2015 05:50:22 +0100 (CET) Received: by pdno5 with SMTP id o5so30624372pdn.8 for ; Mon, 23 Feb 2015 20:50:21 -0800 (PST) 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=T7M2gZnygm3lpy9d66ZZb1nKMS5JOEO5hIbOcfgcXeE=; b=AKLhHXVGCcyx9AfY53pXynsNX8YhGlayjoqtJyCKCue4KT0IaRQhWyNjYPLS0UWg+z 6jOoNfYWN8uUMlavTUawVOjKSmh1NI4NfzGhwi/+7mJS28DtN4930LOhjLy1o7DnhDok a9Izm2/Hgzkx8wH7irStlULvdc9E+6qoONL303k2CqqUVJ/i55cvJxBPQZekuRGhvRrt Dfp28vOyUP1ZZw3A2hj5p/ODPFSRDLbMBTmaxkDP1jQumIg9XlW/dgK9mNtjmFk4dGn7 dwLAzm4eVPfhgbsYQmU0Vke9SkddiTy7UOgkdZ7W4iE/mRRdVXwn0aGH0abQ/n6yK3xA huTg== X-Gm-Message-State: ALoCoQm/zu3wGOH2X4wdnlanImljDOcQb24stzdd+1sN5oB3Z6vtNVmy+EtOqX8ro0d13X+rhPvM X-Received: by 10.66.136.17 with SMTP id pw17mr26291396pab.33.1424753421917; Mon, 23 Feb 2015 20:50:21 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id r5sm26736146pdd.60.2015.02.23.20.50.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Feb 2015 20:50:20 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 24 Feb 2015 13:49:40 +0900 Message-Id: <1424753389-29864-7-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424753389-29864-1-git-send-email-mukawa@igel.co.jp> References: <1424060073-23484-2-git-send-email-mukawa@igel.co.jp> <1424753389-29864-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v13 06/13] ethdev: Add rte_eth_dev_release_port to release specified port 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, 24 Feb 2015 04:50:22 -0000 This patch adds rte_eth_dev_release_port(). The function is used for changing an attached status of the device that has specified name. v9: - rte_eth_dev_free() is replaced by rte_eth_dev_release_port(). (Thanks to Thomas Monjalon) v6: - Use rte_eth_dev structure as the paramter of rte_eth_dev_free(). v4: - Add parameter checking. Signed-off-by: Tetsuya Mukawa --- lib/librte_ether/rte_ethdev.c | 11 +++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index b702039..a089557 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -255,6 +255,17 @@ rte_eth_dev_allocate(const char *name) return eth_dev; } +int +rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) +{ + if (eth_dev == NULL) + return -EINVAL; + + eth_dev->attached = 0; + nb_ports--; + return 0; +} + static int rte_eth_dev_init(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 110ddba..7963e56 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1539,6 +1539,18 @@ extern uint8_t rte_eth_dev_count(void); */ struct rte_eth_dev *rte_eth_dev_allocate(const char *name); +/** + * Function for internal use by dummy drivers primarily, e.g. ring-based + * driver. + * Release the specified ethdev port. + * + * @param eth_dev + * The *eth_dev* pointer is the address of the *rte_eth_dev* structure. + * @return + * - 0 on success, negative on error + */ +int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev); + struct eth_driver; /** * @internal -- 1.9.1