From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 2E8A5B50F for ; Thu, 19 Feb 2015 03:50:20 +0100 (CET) Received: by padet14 with SMTP id et14so5922282pad.11 for ; Wed, 18 Feb 2015 18:50:19 -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=KtULDY5Nf5D4k9JOAl2mD/T6O1B3tSmkG07Xr1ZSXHQ=; b=mKsemtyQmth7Lj6YcyLmDmSA0ePN41QSGJLjjPcbwgKwXeF9+8EgoYBTdZv58+P6hB 6VY5tpo8i/30l5IK7abco4jq6XgaP47YoZtoEC6qM7Ir8DliTZp0uUq9b2cpus39d3di V1wQobm6LVbCF5PsQhPgtJdJ1XF4BfnyxsreOO9VH9coJQOq20NV/U80g4G8a8soFoVS lYAXsTvLn6qGCwFnGIrpXs+oLfgEU3GKuq24y/Rhv/FAHR2HHZM5mjmyQINDCdjz8Ymz cVDgDi3+L5bYRXtVjE1SKmBbvN48FzIOM6KF1wz18ZuAjy2+5pXQhBOAOLircaTqr7Fp OvuA== X-Gm-Message-State: ALoCoQmWWsKkbDlKii/aoAG6xZDzNpFX+CL932BdGeEX0mu2xU1r+xeV4EP2iUtkA0NRvIrTLIuc X-Received: by 10.68.227.201 with SMTP id sc9mr3818142pbc.19.1424314219625; Wed, 18 Feb 2015 18:50:19 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id iy1sm17860786pbb.14.2015.02.18.18.50.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Feb 2015 18:50:19 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 19 Feb 2015 11:49:37 +0900 Message-Id: <1424314187-25177-7-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424314187-25177-1-git-send-email-mukawa@igel.co.jp> References: <1424060073-23484-12-git-send-email-mukawa@igel.co.jp> <1424314187-25177-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v9 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: Thu, 19 Feb 2015 02:50:20 -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 56797a5..be5aa18 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 768f372..28ecafd 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