From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 61D57B4FA for ; Fri, 20 Feb 2015 07:40:13 +0100 (CET) Received: by padfb1 with SMTP id fb1so5783965pad.8 for ; Thu, 19 Feb 2015 22:40:12 -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=Qgy5f46gna/G2WHi9EZUQ3kM6TyQxvyxZvUokqGEvT4=; b=lHZwrfDrmZ27sjB4eUOTqpXK+i374HTmLNDSgVew9QQrOqpkQMkTVRoM/XF5DRfgjm BudcF43puLwelJkHShbBF8x7st1O7DhAuieyjDU7GVnBf9KhYXAcoeERLI0xxEumEbVZ NVUd2SiLb0PEcPXMCME43MOpkfEy4EA+rbQJhiDMP2BlUGs2Qb5rcqk1JFKyeLbdWcvU Rm223EPaT9+IQAODdoa1ObAJabzsVqX0sbfK2zBn3cRWx86oCJ3q1k+KqakMYYWv4fDB ZK3wON78u08MwDqh4u0pMYHAf7WzBp4LS0RejDZT3Pczr+cQH/V1GJKbc/KkVAymH7Qh 7cCg== X-Gm-Message-State: ALoCoQnEuI+kK4Paqz9DBfl7CVaoDaiURValuNzZeYHL63kczmG2IveVeS+14meiouhrQ3jSHxlo X-Received: by 10.68.95.130 with SMTP id dk2mr10369324pbb.51.1424414412753; Thu, 19 Feb 2015 22:40:12 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id g7sm13769979pdm.4.2015.02.19.22.40.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Feb 2015 22:40:11 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Fri, 20 Feb 2015 15:39:40 +0900 Message-Id: <1424414390-18509-7-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424414390-18509-1-git-send-email-mukawa@igel.co.jp> References: <1424060073-23484-2-git-send-email-mukawa@igel.co.jp> <1424414390-18509-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v10 06/14] 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: Fri, 20 Feb 2015 06:40:13 -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 6e22216..72eed1b 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 13bdb67..cd210eb 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1628,6 +1628,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