From patchwork Thu Feb 19 02:49:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 3479 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 EDB6AB59B; Thu, 19 Feb 2015 03:51:14 +0100 (CET) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id EA7ECB4F6 for ; Thu, 19 Feb 2015 03:50:38 +0100 (CET) Received: by pabrd3 with SMTP id rd3so5994284pab.4 for ; Wed, 18 Feb 2015 18:50:38 -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=zjLSHEfXjCsFnmLCdiqhLpy60sm3zXwUicl0LTZj6zw=; b=ivCxrwMiURUoqmf/W10w9YqqF/GNF3AHvnJxPaAzw6w7OpvgBNKh0FM4TAhWin+gOa 3eptqehfY/zALyvNfc1EsvE0/KBfszG+YHr+CEgzO3o2qquGDhiNQ6PiI2CkZhLTNSvX fcTLWhHZhze9BX9bcQfiiyvxUIQCDa/JaxHqUs+bVTn7WW57ypy4r0vF4RA+y6zyCYeh BRBmbigIRm29YsoiIBxk0ogI0dVgeFWorW2vGYgEqrlSwJa69A99BGGa6F+xZJMQYuD3 o2Ayn+jIxeSVtc/k3e0YnxUnUR5/7H66nMNTS0tDSNMQlFvMjaEZte6Rs1KQggUpMVj1 8Ang== X-Gm-Message-State: ALoCoQkid05p7YRTXAfL/ILz/4BS9P9t457VaEnQpZBC4jRsSXWLlLdif1BsU9y5C52ZW0qc2Ddd X-Received: by 10.68.253.233 with SMTP id ad9mr3496121pbd.167.1424314238392; Wed, 18 Feb 2015 18:50:38 -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.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Feb 2015 18:50:37 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 19 Feb 2015 11:49:45 +0900 Message-Id: <1424314187-25177-15-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 14/14] doc: Add port hotplug framework section to programmers guide 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" This patch adds a new section for describing port hotplug framework. Signed-off-by: Tetsuya Mukawa --- doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/port_hotplug_framework.rst | 110 +++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 doc/guides/prog_guide/port_hotplug_framework.rst diff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst index 8d86dd4..428b76b 100644 --- a/doc/guides/prog_guide/index.rst +++ b/doc/guides/prog_guide/index.rst @@ -70,6 +70,7 @@ Programmer's Guide packet_classif_access_ctrl packet_framework vhost_lib + port_hotplug_framework source_org dev_kit_build_system dev_kit_root_make_help diff --git a/doc/guides/prog_guide/port_hotplug_framework.rst b/doc/guides/prog_guide/port_hotplug_framework.rst new file mode 100644 index 0000000..355ae28 --- /dev/null +++ b/doc/guides/prog_guide/port_hotplug_framework.rst @@ -0,0 +1,110 @@ +.. BSD LICENSE + Copyright(c) 2015 IGEL Co.,Ltd. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of IGEL Co.,Ltd. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Port Hotplug Framework +====================== + +The Port Hotplug Framework provides DPDK applications with the ability to +attach and detach ports at runtime. Because the framework depends on PMD +implementation, the ports that PMDs cannot handle are out of scope of this +framework. Furthermore, after detaching a port from a DPDK application, the +framework doesn't provide a way for removing the devices from the system. +For the ports backed by a physical NIC, the kernel will need to support PCI +Hotplug feature. + +Overview +-------- + +The basic requirements of the Port Hotplug Framework are: + +* DPDK applications that use the Port Hotplug Framework must manage their + own ports. + + The Port Hotplug Framework is implemented to allow DPDK applications to + manage ports. For example, when DPDK applications call the port attach + function, the attached port number is returned. DPDK applications can + also detach the port by port number. + +* Kernel support is needed for attaching or detaching physical device + ports. + + To attach new physical device ports, the device will be recognized by + userspace driver I/O framework in kernel at first. Then DPDK + applications can call the Port Hotplug functions to attach the ports. + For detaching, steps are vice versa. + +* Before detaching, they must be stopped and closed. + + DPDK applications must call "rte_eth_dev_stop()" and + "rte_eth_dev_close()" APIs before detaching ports. These functions will + start finalization sequence of the PMDs. + +* The framework doesn't affect legacy DPDK applications behavior. + + If the Port Hotplug functions aren't called, all legacy DPDK apps can + still work without modifications. + +Port Hotplug API overview +------------------------- + +* Attaching a port + + "rte_eal_dev_attach()" API attaches a port to DPDK application, and + returns the attached port number. Before calling the API, the device + should be recognized by an userspace driver I/O framework. The API + receives a pci address like "0000:01:00.0" or a virtual device name + like "eth_pcap0,iface=eth0". In the case of virtual device name, the + format is the same as the general "--vdev" option of DPDK. + +* Detaching a port + + "rte_eal_dev_detach()" API detaches a port from DPDK application, and + returns a pci address of the detached device or a virtual device name + of the device. + +Reference +--------- + + "testpmd" supports the Port Hotplug Framework. + +Limitations +----------- + +* The Port Hotplug APIs are not thread safe. + +* The framework can only be enabled with Linux. BSD is not supported. + +* To detach a port, the port should be backed by a device that igb_uio + manages. VFIO is not supported. + +* Not all PMDs support detaching feature. + To know whether a PMD can support detaching, search for the + "RTE_PCI_DRV_DETACHABLE" flag in PMD implementation. If the flag is + defined in the PMD, detaching is supported.