首页 > > > intel-dpdk-getting-started-guide.pdf

intel-dpdk-getting-started-guide.pdf

intel-dpdk-getting-started-guid…

上传者: 一鸣不惊人的世界 2013-05-21 评分1 评论0 下载109 收藏10 阅读量818 暂无简介 简介 举报

简介:本文档为《intel-dpdk-getting-started-guidepdf》,可适用于电信技术领域,主题内容包含ReferenceNumber:IntelDataPlaneDevelopmentKit(IntelDPDK)GettingStartedGuide符等。

Reference Number: 326002-001 Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 2 Reference Number: 326002-001 Legal Lines and DisclaimersINFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. A “Mission Critical Application” is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked “reserved” or “undefined.” Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548- 4725, or go to: http://www.intel.com/design/literature.htm Any software source code reprinted in this document is furnished for informational purposes only and may only be used or copied and no license, express or implied, by estoppel or otherwise, to any of the reprinted source code is granted by this document. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries. *Other names and brands may be claimed as the property of others. Copyright 2012, Intel Corporation. All rights reserved. Intel Data Plane Development Kit (Intel DPDK) November 2012 Getting Started Guide Reference Number: 326002-001 3 Revision History—Intel DPDK Revision History Contents 1.0 Introduction ..............................................................................................................4 1.1 Documentation Roadmap .....................................................................................4 2.0 System Requirements................................................................................................5 2.1 BIOS Setting Prerequisite .....................................................................................5 2.2 Compilation of the Intel DPDK.............................................................................5 2.3 Running Intel DPDK Applications in a Linux Environment ........................................6 2.3.1 Userspace I/O in a Linux Environment.........................................................6 2.3.2 Use of Hugepages in the Linux Environment.................................................7 2.3.2.1 Reserving Hugepages for Intel DPDK Use.....................................7 2.3.2.2 Using Hugepages with the Intel DPDK .........................................8 3.0 Compiling the Intel DPDK Target from Source .........................................................9 3.1 Install the Intel DPDK and Browse Sources ...........................................................9 3.2 Installation of Intel DPDK Target Environments .....................................................9 3.3 Browsing the Installed Intel DPDK Environment Target......................................... 11 3.4 Loading the Intel DPDK igb_uio Module .............................................................. 11 4.0 Compiling and Running Sample Applications ........................................................... 12 4.1 Compiling a Sample Application........................................................................... 12 4.2 Running a Sample Application ............................................................................. 13 4.3 Additional Sample Applications............................................................................ 13 5.0 Quick Start Setup Script .......................................................................................... 14 5.1 Script Organization............................................................................................ 14 5.2 Use Cases ........................................................................................................ 15 5.3 Applications...................................................................................................... 17 Date Revision Description November 2012 -001 Supports public software release 1.2.3 Intel DPDK—Introduction Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 4 Reference Number: 326002-001 1.0 Introduction This document contains instructions for installing and configuring the Intel Data Plane Development Kit (Intel DPDK) software. It is designed to get customers up and running quickly. The document describes how to compile and run an Intel DPDK application in a Linux* application (linuxapp) environment, without going deeply into the detail. 1.1 Documentation Roadmap The following is a list of Intel DPDK documents in the suggested reading order: • Release Notes: Provides release-specific information, including supported features, limitations, fixed issues, known issues and so on. Also, provides the answers to frequently asked questions in FAQ format. • Getting Started Guide (this document): Describes how to install and configure the Intel DPDK; designed to get users up and running quickly with the software. • Programmer's Guide: Describes: — The software architecture and how to use it (through examples), specifically in a Linux* application (linuxapp) environment — The content of the Intel DPDK, the build system (including the commands that can be used in the root Intel DPDK Makefile to build the development kit and an application) and guidelines for porting an application — Optimizations used in the software and those that should be considered for new development A glossary of terms is also provided. • API Reference: Provides detailed information about Intel DPDK functions, data structures and other programming constructs. • Sample Applications User Guide: Describes a set of sample applications. Each chapter describes a sample application that showcases specific functionality and provides instructions on how to compile, run and use the sample application. Intel Data Plane Development Kit (Intel DPDK) November 2012 Getting Started Guide Reference Number: 326002-001 5 System Requirements—Intel DPDK 2.0 System Requirements This chapter describes the packages required to compile the Intel DPDK. 2.1 BIOS Setting Prerequisite The High Precision Timer (HPET) must be enabled in the platform BIOS. The BIOS is typically accessed by pressing F2 while the platform is starting up. The user can then navigate to the HPET option. On the Crystal Forest platform BIOS, the path is: Advanced -> PCH-IO Configuration -> High Precision Timer -> (Change from Disabled to Enabled if necessary). On a system that has already booted, the following command can be issued to check if HPET is enabled: # grep hpet /proc/timer_list If no entries are returned, HPET must be enabled in the BIOS (as per the instructions above) and the system rebooted. Note: If HPET initialization fails, or is not used, the HPET-based APIs provided by the Intel DPDK transparently falls back to use of the CPU time-stamp count, that is, rdtsc, to provide the time source instead. 2.2 Compilation of the Intel DPDK Required Tools: Note: Testing has been performed using Fedora 14. The setup commands and installed packages needed on other systems may be different. • GNU make • coreutils: cmp, sed, grep, arch • nasm versions later than 2.0 • gcc: versions 4.5.x or later is recommended. On some distributions, some specific compiler flags and linker flags are enabled by default and affect performance (- fstack-protector, for example). Please refer to the documentation of your distribution and to gcc -dumpspecs. • libc headers (glibc-devel.i686 / libc6-dev-i386; glibc-devel.x64_86 for 64-bit compilation) • Additional packages required for 32-bit compilation on 64-bit systems are: glibc.i686, libgcc.i686, libstdc++.i686 and glibc-devel.i686 Optional Tools: • Intel C++ Compiler (icc). For installation, additional libraries may be required. See the icc Installation Guide found in the Documentation directory under the compiler installation. Version 12 is known to work. Intel DPDK—System Requirements Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 6 Reference Number: 326002-001 2.3 Running Intel DPDK Applications in a Linux Environment To run an Intel DPDK application, some customization must be done on the target machine. Running an Intel DPDK application requires some kernel configuration customization (done at build time) and some dynamic kernel tweaks (modules, procfs): Required: • glibc >= 2.7 (for features related to cpuset) The version can be checked using the ldd --version command. A sample output is shown below: # ldd --version ldd (GNU libc) 2.13 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper. • Kernel configuration On Fedora 14 and other common distributions, such as Ubuntu*, the HPET options below are not enabled by default. Consequently, it is necessary to recompile the kernel. See http://fedoraproject.org/wiki/Building_a_custom_kernel for instructions on recompiling the kernel on Fedora 14. For other Linux* distributions, please consult that distribution's documentation for relevant instructions. Note: If the Intel DPDK is being used on a Crystal Forest platform, please consult the Crystal Forest Software for Linux* Getting Started Guide for details on the kernel patching that should be performed before recompiling the kernel. The options that must be configured are: — HPET (enabled by default) and HPET_MMAP (not enabled by default) configuration options enabled — UIO kernel options enabled; the default Fedora 14 settings are sufficient — HUGETLBFS enabled — PROC_PAGE_MONITOR enabled To determine the functionality enabled in the kernel, the following command is useful: # grep HPET /boot/config-`uname -r` CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y CONFIG_HPET=y CONFIG_HPET_MMAP=y 2.3.1 Userspace I/O in a Linux Environment The Intel DPDK igb_uio kernel module depends on kernel uio support to operate. This uio support may be compiled as a module, so this module should be loaded using the modprobe program: sudo /sbin/modprobe uio # needed if uio is built as a module Intel Data Plane Development Kit (Intel DPDK) November 2012 Getting Started Guide Reference Number: 326002-001 7 System Requirements—Intel DPDK Note: By default, modprobe attempts to load the module from the /lib/modules/<kernel-version>/kernel/drivers/ directory. 2.3.2 Use of Hugepages in the Linux Environment Kernels may require patches to support hugepage allocations (the HUGETLBFS option must be enabled as indicated in Section 2.3). Hugepage support is required for the large memory pool allocation used for packet buffers. By using hugepage allocations, performance is increased since fewer pages are needed, and therefore less Translation Lookaside Buffers (TLBs, high speed translation caches), which reduce the time it takes to translate a virtual page address to a physical page address. Without hugepages, high TLB miss rates would occur, slowing performance. The following kernels may require patches to provide hugepage support: Note: Blue text in the list below are direct links to the patch downloads. • kernel >= 2.6.33 (base kernel, with no patches applied) OR • kernel >= 2.6.32, with the following patches applied: — add hugepage support to pagemap — fix hugepage memory leak — add nodemask arg to huge page alloc (not mandatory, but recommended on a NUMA system to support per-NUMA node hugepages allocation) OR • kernel >= 2.6.28, with the following patches applied: — fix hugepage memory leak — add hugepage support to pagemap — add uio name attributes and port regions — add nodemask arg to huge page alloc (not mandatory, but recommended on a NUMA system to support per-NUMA node hugepages allocation) 2.3.2.1 Reserving Hugepages for Intel DPDK Use The allocation of hugepages should be done at boot time or as soon as possible after system boot to prevent memory from being fragmented in physical memory. To reserve hugepages at boot time, a parameter is passed to the Linux kernel on the kernel command line. For 2 MB pages, just pass the hugepages option to the kernel. For example, to reserve 1024 pages of 2 MB, use: hugepages=1024 For other hugepage sizes, for example 1G pages, the size must be specified explicitly and also set as the default hugepage size for the system. For example, to reserve 4G of hugepage memory in the form of four 1G pages, the following options should be passed to the kernel: default_hugepagesz=1G hugepagesz=1G hugepages=4 Intel DPDK—System Requirements Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 8 Reference Number: 326002-001 Note: The hugepage sizes that a CPU supports can be determined from the CPU flags. If “pse” exists, 2M hugepages are supported; if “pdpe1gb” exists, 1G hugepages are supported. Note: For 64-bit applications, it is recommending to use 1 GB hugepages if the platform supports them. In the case of a dual-socket NUMA system, the number of hugepages reserved at boot time is generally divided equally between the two sockets (on the assumption that sufficient memory is present on both sockets). See the Documentation/kernel-parameters.txt file in your Linux source tree for further details of these and other kernel options. Alternative: For 2 MB pages, there is also the option of allocating hugepages after the system has booted. This is done by echoing the number of hugepages required to a nr_hugepages file in the /sys/devices/ directory. For a single-node system, the command to use is as follows (assuming that 1024 pages are required): echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages On a NUMA machine, pages should be allocated explicitly on separate nodes: echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages Note: For 1G pages, it is not possible to reserve the hugepage memory after the system has booted. 2.3.2.2 Using Hugepages with the Intel DPDK Once the hugepage memory is reserved, to make the memory available for Intel DPDK use, perform the following steps: mkdir /mnt/huge mount -t hugetlbfs nodev /mnt/huge When running an application (see Chapter 4.0, “Compiling and Running Sample Applications”), it is recommended to use the same amount of memory as that allocated for hugepages. This is done automatically by the Intel DPDK application at startup, if no -m parameter is passed to it when run. If more memory is requested by explicitly passing a -m value, the application fails. However, the application can also fail if the user requests less memory than the reserved amount of hugepage-memory. The reason is as follows. Suppose the system has 1024 reserved pages in socket 0 and 1024 in socket 1. If the user requests 128 MB of memory, the 64 pages may not match the constraints: • It can be in socket 1 only. In this case, if the application asks for memory in socket 0, it fails. • These pages can be located anywhere in physical memory, and it is likely that the pages will not be contiguous. In this case, the application is not able to allocate big memory pools. Even if hugepages are allocated very early after the boot process, it is likely that the allocated memory will not be contiguous. Intel Data Plane Development Kit (Intel DPDK) November 2012 Getting Started Guide Reference Number: 326002-001 9 Compiling the Intel DPDK Target from Source—Intel DPDK 3.0 Compiling the Intel DPDK Target from Source 3.1 Install the Intel DPDK and Browse Sources Note: In the following description, rte-source represents the name and location of the software to be installed. First, uncompress the archive and move to the root directory: user@droid:~$ unzip DPDK.L<version>.zip user@droid:~$ cd rte-source user@droid:~$ ls app config COPYRIGHT doc examples lib Makefile mk scripts tools The Intel DPDK is composed of several directories: • lib: Source code of Intel DPDK libraries • app: Source code of Intel DPDK applications (automatic tests) • examples: Source code of Intel DPDK application examples • config, tools, scripts, mk: Framework-related makefiles, scripts and configuration • doc: Documentation 3.2 Installation of Intel DPDK Target Environments The format of a Intel DPDK target is: ARCH-MACHINE-EXECENV-TOOLCHAIN where: • ARCH can be: i686, x86_64 • MACHINE can be: default • EXECENV can be: linuxapp • TOOLCHAIN can be: gcc, icc The targets to be installed depend on the 32-bit and/or 64-bit packages and compilers installed on the host. Available targets can be found in the rte-source/config directory. The defconfig_ prefix should not be used. Note: Configuration files are provided with RTE_MACHINE set to default. However, other valid values for RTE_MACHINE include native, which tunes the software for the platform it is built on, as well as microarchitecture-specific values. See the Intel DPDK Programmer's Guide for more information on possible values. Intel DPDK—Compiling the Intel DPDK Target from Source Intel Data Plane Development Kit (Intel DPDK) Getting Started Guide November 2012 10 Reference Number: 326002-001 Those targets with an EXECENV value of linuxapp run in Linux* user space. These targets create the Intel DPDK target environments on which customer applications can be built. When using the Intel C++ Compiler (icc), one of the following commands should be invoked for 32-bit or 64-bit use. Notice that the shell scripts update the $PATH variable and therefore should not be performed in the same session. Also, verify the compiler's

编辑推荐

  • 名称/格式
  • 评分
  • 下载次数
  • 资料大小
  • 上传时间

用户评论

0/200
    暂无评论
上传我的资料

相关资料

资料评价:

/ 0
所需积分:0 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!