From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id 04E925A43 for ; Wed, 25 Feb 2015 20:32:57 +0100 (CET) Received: by paceu11 with SMTP id eu11so7564136pac.7 for ; Wed, 25 Feb 2015 11:32:56 -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=TXGXmYDJNUy7FspVPCj6ieEADmGdUZwG3K74C0M+ABWN7Fk1SrtQeP75dfPnDbALQA 3Rss46BDqxHMJG+4KGKx+Ktu7/6svyu91VS6NM7Czq87xeASqOsaEnnDww7K+KbjPhB8 QiK3DTTTiwiJfR7aEEelMEWGZiKvPVfI+vArah37UiHU/p3GvaqccD+ZzAB+8LeYgHPp 6vSoiXGD/e1L8aiAH2dXGTjSc3/ki7xE4CKCuxNCzACtJDuDXLiFAq0GLpldW/agARfB CsO8l0JOg/kH3SFX+eb9b/Gfhg6Mznn+UVe1xOuQA2oCznU83HwSRCqQWNK0o61Glped SD6A== X-Gm-Message-State: ALoCoQnIqC6DCWNm2KJdMaPgAU30xDRPegue2/dZq4h0czwVNtOfLAfsxipEvi2FKLh7IKj7j2Nt X-Received: by 10.70.88.142 with SMTP id bg14mr8442765pdb.46.1424892776409; Wed, 25 Feb 2015 11:32:56 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ux7sm39997444pab.19.2015.02.25.11.32.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 11:32:55 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 26 Feb 2015 04:32:20 +0900 Message-Id: <1424892749-31862-7-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424892749-31862-1-git-send-email-mukawa@igel.co.jp> References: <1424837093-5661-13-git-send-email-mukawa@igel.co.jp> <1424892749-31862-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v15 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: Wed, 25 Feb 2015 19:32:57 -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