From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by dpdk.org (Postfix) with ESMTP id 05B197FC0 for ; Wed, 29 Oct 2014 09:41:30 +0100 (CET) Received: by mail-pd0-f175.google.com with SMTP id y13so2557547pdi.6 for ; Wed, 29 Oct 2014 01:50:21 -0700 (PDT) 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=qOJnUJ2uNdmQC4cHtD7Pf80f4DlRvJuPYkI9ds24RTY=; b=gcwll6GRgg9WnO2tzqTbcnRk6t0nZkyWhmjAbSN+KAvZj92KsflS2L3VgDz1vwMGV0 UjuSQU7ADAKM1vyjmaGOg7YOgsLhpbN+rSnzACqvWf5MT4KEQe1e+F+4qR1oFRC/wZu0 pYtHVMalfrOxNZlENaCm1g6PVlndbvq1gN6cy6oPZW8KmmFA162Sx2ZSITfbeQKbCWZJ yJ1cUGWuXIZXoAdfBs/h4ImqxZe1LcHN8rN8a3bTWMdMo8Mj+Yr+TwFClIqXU6Wm1woh +V8GDah11Ra4WiqsNds4quRKTsW1Hv946PUQw90Sfgz46cf+lyxt7pgJAB8Q0jmXVMDf WCaw== X-Gm-Message-State: ALoCoQkVkRC48386ksIeOVUKDzwp5DCYRvDex0HuG/IJWeeNQMdCiDvBlB0Jv07bhGlnpq27AkO4 X-Received: by 10.66.237.98 with SMTP id vb2mr468318pac.144.1414572621354; Wed, 29 Oct 2014 01:50:21 -0700 (PDT) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ky4sm3686872pbc.55.2014.10.29.01.50.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Oct 2014 01:50:20 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org Date: Wed, 29 Oct 2014 17:49:22 +0900 Message-Id: <1414572576-21371-12-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> Cc: nakajima.yoshihiro@lab.ntt.co.jp, masutani.hitoshi@lab.ntt.co.jp Subject: [dpdk-dev] [RFC 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: , X-List-Received-Date: Wed, 29 Oct 2014 08:41:32 -0000 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 dea28c2..92a846a 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -464,6 +464,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 11853f5..5cc438c 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1677,6 +1677,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 -- 1.9.1