From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A479A04B5; Mon, 2 Dec 2019 08:31:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A5F4235; Mon, 2 Dec 2019 08:31:42 +0100 (CET) Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by dpdk.org (Postfix) with ESMTP id 656831F5 for ; Mon, 2 Dec 2019 08:31:41 +0100 (CET) Received: by mail-il1-f195.google.com with SMTP id o18so32441936ils.12 for ; Sun, 01 Dec 2019 23:31:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y/8t9kb4eot1eRbv+NAcf3VhtWcbPrkMXcoedjDxwRM=; b=DT6rbVkAk8PtIWxsTgf3SWU5joO3s3seio1SB09uPhlTiC4+mFO2eAvE/xes0YjFzX EEDWhQwLT90HWcdMxezTdTPAoa1x2NfPiO432RDoaCHH7PSj/8cnSHnOUuyBbkFNy7iU rf9OZnQ1wnp6UCEnjuZLpcQmTxEX3RkBwTiBDdqSm/+4YIV4RfP+g45dfKMACkieQZ8m psTmwOCEme0QsZfryIggbJ38/Qs+/qT0RE1L1y/Gi+D0Zq5xfPjK/PBrwpQm564MfsGt X52HwXYcOFGkMhmL0mYUZ+xLuo1cPXJhOlLOX/0SyUQqoJFAOftsJUbfg+g+CbEJ/ZUq c7pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y/8t9kb4eot1eRbv+NAcf3VhtWcbPrkMXcoedjDxwRM=; b=psEQ+1qEZcSC02/p4ACZXmITXwFGQOmLfg/ElOPvp4ztyh4XBnAvmKf1F5fTrjU3zF Ll0SOAkyTci0IUh5TOfIdNYFsttGG4GGqOzGJ/3bgGqSxZr5NNMVZ/dnWPFQK+P/1xZg NkW0bzq0OjF3SCAEzZjQsUU/GTkatlW4YJeOxU/pHKOz3Q8Pg6DseRsLyxR1H/hjzdLV 6IRn0Y3aJvricqGayWoaFFTYwFqo/sN7MwCN0OOs7loLn9ETFUMt4QgdCn9BHv7TX6A9 gRgoo1kGZTGkRjU/Rva1yFv7kNV//ALzllr+/tm4cHTw+fwxoQGLaw7FH8cKsRoySJus NXjQ== X-Gm-Message-State: APjAAAWwOAAlEqzsRbZzeKFaHDBfjgC7OHypHjLZ8Mch7mwKDJWARn+x A2IkrXNor1/md9J/AfPcAmXNJjjyD8mCe/Hp+bMJw9vngHY= X-Google-Smtp-Source: APXvYqxjSZUesmAZ9d67qIwVRBC7qfdDlchcthDFw2hCt5tLzw8jpgQp/oXe+iB7CTpeMUp9CVxdj7RqpW+mLSxx/3c= X-Received: by 2002:a92:7793:: with SMTP id s141mr23580824ilc.162.1575271900331; Sun, 01 Dec 2019 23:31:40 -0800 (PST) MIME-Version: 1.0 References: <20191129081911.92988-1-xiaolong.ye@intel.com> <20191202063423.77504-1-xiaolong.ye@intel.com> In-Reply-To: <20191202063423.77504-1-xiaolong.ye@intel.com> From: Jerin Jacob Date: Mon, 2 Dec 2019 16:31:24 +0900 Message-ID: To: Xiaolong Ye Cc: John McNamara , Marko Kovacevic , dpdk-dev , Bruce Richardson , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] doc: introduce openwrt how-to guide X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Dec 2, 2019 at 3:38 PM Xiaolong Ye wrote: > > This doc describes how to enable DPDK on openwrt in both virtual and > physical x86 environment. Could you split the documentation into generic and x86 specific? So other architectures can add the architecture-specific details instead of duplicating. > > Signed-off-by: Xiaolong Ye > --- > > v2 changes: > > 1. add meson build steps for dpdk > 2. replace steps about build openwrt and running dpdk application with links > > doc/guides/howto/index.rst | 1 + > doc/guides/howto/openwrt.rst | 181 +++++++++++++++++++++++++++++++++++ > 2 files changed, 182 insertions(+) > create mode 100644 doc/guides/howto/openwrt.rst > > diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst > index a4c131652..5a97ea508 100644 > --- a/doc/guides/howto/index.rst > +++ b/doc/guides/howto/index.rst > @@ -19,3 +19,4 @@ HowTo Guides > packet_capture_framework > telemetry > debug_troubleshoot > + openwrt > diff --git a/doc/guides/howto/openwrt.rst b/doc/guides/howto/openwrt.rst > new file mode 100644 > index 000000000..b5ad66466 > --- /dev/null > +++ b/doc/guides/howto/openwrt.rst > @@ -0,0 +1,181 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2019 Intel Corporation. > + > +Enable DPDK on openwrt > +====================== > + > +This document describes how to enable Data Plane Development Kit(DPDK) on > +Openwrt in both virtual and physical x86 environment. > + > +Introduction > +------------ > + > +The OpenWrt project is a Linux operating system targeting embedded devices. > +Instead of trying to create a single, static firmware, OpenWrt provides a fully > +writable filesystem with package management. This frees user from the > +application selection and configuration provided by the vendor and allows user > +to customize the device through the use of packages to suit any application. For > +developers, OpenWrt is the framework to build and application without having to > +build a complete firmware around it, for users this means the ability for full > +customization, to use the device in ways never envisioned. > + > +Pre-requisites > +~~~~~~~~~~~~~~ > + > +You need gcc, binutils, bzip2, flex, python3.5+, perl, make, find, grep, diff, > +unzip, gawk, getopt, subversion, libz-dev and libc headers installed. > + > +Build OpenWrt > +------------- > + > +You can obtain OpenWrt image through https://downloads.openwrt.org/releases. To > +fully customize your own OpenWrt, it is highly recommended to build it through > +the source code, you can clone the OpenWrt source code by: > + > +.. code-block:: console > + > + git clone https://git.openwrt.org/openwrt/openwrt.git > + > +OpenWrt configuration > +~~~~~~~~~~~~~~~~~~~~~ > + > +* Select ``x86`` in ``Target System`` > +* Select ``x86_64`` in ``Subtarget`` > +* Select ``Build the OpenWrt SDK`` for cross-compilation environment > +* Select ``Use glibc`` in ``Advanced configuration options (for developers)`` > + -> ``ToolChain Options`` > + -> ``C Library implementation`` > + > +Kernel configuration > +~~~~~~~~~~~~~~~~~~~~ > + > +Below configurations need to be enabled: > + > +* CONFIG_UIO=y > +* CONFIG_HUGETLBFS=y > +* CONFIG_HUGETLB_PAGE=y > +* CONFIG_PAGE_MONITOR=y > + > +Build steps > +~~~~~~~~~~~ > + > +For detailed OpenWrt build steps, please refer to guide in its official site. > + > +`OpenWrt build guide > +`_. > + > +After build is done, you can find the images and sdk in ``/bin/targets/x86/64-glibc/``. > + > +DPDK Cross Compilation for OpenWrt > +---------------------------------- > + > +Pre-requisites > +~~~~~~~~~~~~~~ > + > +NUMA is required to run dpdk in x86. > + > +.. note:: > + > + For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2, > +otherwise the compilation will fail with errors. > + > +.. code-block:: console > + > + git clone https://github.com/numactl/numactl.git > + cd numactl > + git checkout v2.0.13 -b v2.0.13 > + ./autogen.sh > + autoconf -i > + export PATH=/glibc/openwrt-sdk-x86-64_gcc-8.3.0_glibc.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-8.3.0_glibc/bin/:$PATH > + ./configure CC=x86_64-openwrt-linux-gnu-gcc --prefix= > + make install > + > +The numa header files and lib file is generated in the include and lib folder respectively under . > + > +Build DPDK > +~~~~~~~~~~ > + > +* meson build > + > +To cross compile with meson build, you need to write customized cross file first. > + > +.. code-block:: console > + > + [binaries] > + c = 'x86_64-openwrt-linux-gcc' > + cpp = 'x86_64-openwrt-linux-cpp' > + ar = 'x86_64-openwrt-linux-ar' > + strip = 'x86_64-openwrt-linux-strip' > + > + meson builddir --cross-file openwrt-cross > + ninja -C builddir > + > +.. note:: > + > + For compiling the igb_uio with the kernel version used in target machine, you need to explicitly specify kernel_dir in meson_options.txt. > + > +* make > + > +.. code-block:: console > + > + export STAGING_DIR=/glibc/openwrt-sdk-x86-64_gcc-8.3.0_glibc.Linux-x86_64/staging_dir > + export RTE_SDK=`pwd` > + export RTE_KERNELDIR=/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/ > + make config T=x86_64-native-linuxapp-gcc > + make -j 100 CROSS=x86_64-openwrt-linux-gnu- > + > +Running DPDK application on OpenWrt > +----------------------------------- > + > +Virtual machine > +~~~~~~~~~~~~~~~ > + > +* Extract boot image > + > +.. code-block:: console > + > + gzip -d openwrt-x86-64-combined-ext4.img.gz > + > +* Launch Qemu > + > +.. code-block:: console > + > + qemu-system-x86_64 \ > + -cpu host \ > + -smp 8 \ > + -enable-kvm \ > + -M q35 \ > + -m 2048M \ > + -object memory-backend-file,id=mem,size=2048M,mem-path=/tmp/hugepages,share=on \ > + -drive file=/openwrt-x86-64-combined-ext4.img,id=d0,if=none,bus=0,unit=0 \ > + -device ide-hd,drive=d0,bus=ide.0 \ > + -net nic,vlan=0 \ > + -net nic,vlan=1 \ > + -net user,vlan=1 \ > + -display none \ > + > + > +Physical machine > +~~~~~~~~~~~~~~~~ > + > +If you are using Windows PC, you can use some free and opensource raw disk image writer program such as > +``Win32 Disk Imager`` and ``Etcher`` to write OpenWrt image (openwrt-x86-64-combined-ext4.img) to a USB > +flash driver or USB SDcard with SDcard or a Sata hard drivre or SSD from your PC. > + > +If you are using Linux, you can use old dd tool to write OpenWrt image to the drive you want to write the > +image on. > + > +.. code-block:: console > + > + dd if=openwrt-18.06.1-x86-64-combined-squashfs.img of=/dev/sdX > + > +Where sdX is name of the drive. (You can find it though ``fdisk -l``) > + > +Running DPDK > +~~~~~~~~~~~~ > + > +More detailed info about how to run a DPDK application please refer to ``Running DPDK Applications`` section of :ref:`the DPDK documentation `. > + > +.. note:: > + > + You need to install pre-built numa libraries (including soft link) to /usr/lib64 in OpenWrt. > -- > 2.17.1 >