From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id 595877F58 for ; Tue, 4 Nov 2014 04:37:20 +0100 (CET) Received: by mail-pd0-f171.google.com with SMTP id r10so12812207pdi.2 for ; Mon, 03 Nov 2014 19:46:36 -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=cH1NN5zYP40PWkhOfJmg1IveeMqAPkW+fzujVjYSGBc=; b=d5uF44Voaeb9VuDdISkNxpTgQiOwXlPhKVnTByTx4Fi2GPCTFTnZt4lRXMS4yRwCd/ 4lUq4AXRXB25oDt7BWYzsoMBTk8sYDS/lrbIiIPl/2RlKWLdmP9jO6fRu/nNZIWu0gct 2jMpP3F9MuW6qROC0vsoQSQjTH0Yc9kalWe7Vjg0Zj7wJqbjR2eIpjy4xK0H8pIUqyQO HKbAaHbuUgmz06vwy+IT2mbKzXgCiZLh361RFKYW7Z+4xVUKt6Sg/xyJGP8SHM7PKkaS KmpqLqWnxOdhdEkXgf5lst6pZ/VusSwsZOLrDqLvu3c3UJD36Dy1NwW1mecRiXz0pZp4 BOtw== X-Gm-Message-State: ALoCoQmv1L7l0bHyDwPWRTfpw4qmncfjL+V4gtdBCqHT5H/asgqhfllWHn0qNUwYdE3t198xPBAh X-Received: by 10.66.120.49 with SMTP id kz17mr47478231pab.71.1415072796525; Mon, 03 Nov 2014 19:46:36 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id jc3sm18430580pbb.49.2014.11.03.19.46.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Nov 2014 19:46:35 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 4 Nov 2014 12:45:31 +0900 Message-Id: <1415072748-31937-12-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415072748-31937-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> <1415072748-31937-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 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: , X-List-Received-Date: Tue, 04 Nov 2014 03:37:22 -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 e3f2713..17f3ae4 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -451,6 +451,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