From patchwork Tue Dec 9 03:42:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 1837 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 9FB397E79; Tue, 9 Dec 2014 04:43:40 +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 ED4473F9 for ; Tue, 9 Dec 2014 04:43:37 +0100 (CET) Received: by mail-pa0-f47.google.com with SMTP id kq14so6510713pab.6 for ; Mon, 08 Dec 2014 19:43:37 -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=Qb3Fuv4liilbHTJ/FkJfxGZmi/+JC5EKCyuf54l7KTQ=; b=eGSKJvwPyWf8mUeOaXXuVjd92mAxPEUUN1XrQkAPSSALM07tmDFGoF0J334Q0DtcwQ GxI1KayT998Ik7vOVFqi8adLVh5nTpAOUO7saeQJCO9MDL7ZVkBGH17C957FOvyc6Opc 1HruHL1LzfpKtwWeYHbuLGeECmaQXKANYvUpxC3wYFxxkGPuleLAtfE5E9M0YZ2uKrus Jbnoa5QohCfZxNzaGuaiJ7YH1ljKdNVjmmLF3YWFy8grOtrBuwhXqeMGPVNGQ6SYPF6u AiyG6Uyt5Emm41tTA5JU1QXMSwXSFns4oYmXo5V5Us5DAsdg0gteeW2P8zUn9YTg8CLU 4kJw== X-Gm-Message-State: ALoCoQnh+hUVdS8/FEg5Tg4PYedIHAVZOBQbjlqx4FHMPl3DcSiIHEjsIXhEeMI1bFeJnfRCWteQ X-Received: by 10.70.92.3 with SMTP id ci3mr27048340pdb.28.1418096617319; Mon, 08 Dec 2014 19:43:37 -0800 (PST) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id xx2sm2185pab.17.2014.12.08.19.43.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Dec 2014 19:43:36 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 9 Dec 2014 12:42:34 +0900 Message-Id: <1418096571-27531-12-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418096571-27531-1-git-send-email-mukawa@igel.co.jp> References: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> <1418096571-27531-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 v2 11/28] 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 1d82f69..ed53e66 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -498,6 +498,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 bd921d0..404c41f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1701,6 +1701,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