From patchwork Thu Nov 20 09:06:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 1374 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 367D77FFA; Thu, 20 Nov 2014 09:57:17 +0100 (CET) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id ABCD77FDB for ; Thu, 20 Nov 2014 09:57:14 +0100 (CET) Received: by mail-pa0-f47.google.com with SMTP id kq14so2168891pab.6 for ; Thu, 20 Nov 2014 01:07:43 -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=F4z2NFna33uUNePtjMT9ELNA3OLHUfuHa6M+vbhfEqs=; b=fMEu/D7JZOHF7Y833Qldyv/B4XNl7rKt8b+a4any3l9Wu6kucivSEcfrUPW6tbxr3m Qx3uiGathR1syIkByK6KL6my/ypoWGqi4GI12/EYmv6hvF+TJ41bbe+EsS8Nes1zK3Dr lJbM9Ngegu1X99sIv0t2FzMUOXlXc8owvzfHX4BFyjT3IgvWb+/7wdmZz7fQ4wuKOgXk 2PFbuJ1m8TpWigaz9E0IYP0Xuaxo/2yUBzJgeRMsmE5o4JeATXxGE/3hssgN78gX5yMj R/6dZWCOdi8eWwc4CZLSAviOZfOBdjx0ynuvsEOgcnn30hsbWuPMsue14Np00dPwnnfj Lgtg== X-Gm-Message-State: ALoCoQlbCaRFjtIyw4HenBZvxThiaWYkLZr9LwoKOsk9dgtr1eW/Q6UmGfASzJ0j8frFksXJWoOt X-Received: by 10.66.124.130 with SMTP id mi2mr54957064pab.104.1416474463502; Thu, 20 Nov 2014 01:07:43 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id a6sm1432407pbu.64.2014.11.20.01.07.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Nov 2014 01:07:43 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 20 Nov 2014 18:06:25 +0900 Message-Id: <1416474399-16851-12-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> Cc: nakajima.yoshihiro@lab.ntt.co.jp, menrigh@brocade.com, masutani.hitoshi@lab.ntt.co.jp Subject: [dpdk-dev] [PATCH 11/25] ethdev: Add rte_eth_dev_check_detachable 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The function returns whether a PMD supports detach function, or not. Signed-off-by: Tetsuya Mukawa --- lib/librte_ether/rte_ethdev.c | 9 +++++++++ lib/librte_ether/rte_ethdev.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 372ab7d..0d2397b 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -466,6 +466,15 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name) return 0; } +int +rte_eth_dev_check_detachable(uint8_t port_id) +{ + uint32_t drv_flags; + + drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags; + return !!(drv_flags & RTE_PCI_DRV_DETACHABLE); +} + static int rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 2087daf..49b4e9b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1697,6 +1697,17 @@ extern int rte_eth_dev_get_port_by_addr( extern int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); /** + * Function for internal use by port hotplug functions. + * Check whether or not, a PMD that is handling the ethdev specified by port + * identifier can support detach function. + * @param port_id + * The port identifier + * @return + * - 0 on supporting detach function, negative on not supporting + */ +extern int rte_eth_dev_check_detachable(uint8_t port_id); + +/** * Function for internal use by dummy drivers primarily, e.g. ring-based * driver. * Allocates a new ethdev slot for an ethernet device and returns the pointer