DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] remove dpdk-setup.sh
@ 2020-11-27 15:07 David Marchand
  2020-11-27 15:09 ` Bruce Richardson
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: David Marchand @ 2020-11-27 15:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, Nicolas Chautru, Ray Kinsella, Neil Horman

This old script relied on deprecated stuff, and especially make.
It also applied some scary 666 permissions on files under /dev/vfio.

Its deprecation had been notified in a previous release, remove it.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/bbdevs/acc100.rst               |  15 +-
 doc/guides/bbdevs/fpga_5gnr_fec.rst        |  20 +-
 doc/guides/bbdevs/fpga_lte_fec.rst         |  20 +-
 doc/guides/faq/faq.rst                     |   3 +-
 doc/guides/linux_gsg/build_dpdk.rst        |   5 -
 doc/guides/linux_gsg/build_sample_apps.rst |   5 -
 doc/guides/linux_gsg/index.rst             |   1 -
 doc/guides/linux_gsg/linux_drivers.rst     |   1 -
 doc/guides/linux_gsg/quick_start.rst       | 304 ----------
 doc/guides/rel_notes/deprecation.rst       |   5 -
 doc/guides/rel_notes/release_20_11.rst     |   2 +
 usertools/dpdk-setup.sh                    | 609 ---------------------
 12 files changed, 6 insertions(+), 984 deletions(-)
 delete mode 100644 doc/guides/linux_gsg/quick_start.rst
 delete mode 100755 usertools/dpdk-setup.sh

diff --git a/doc/guides/bbdevs/acc100.rst b/doc/guides/bbdevs/acc100.rst
index 9c37bc3be1..129216b65e 100644
--- a/doc/guides/bbdevs/acc100.rst
+++ b/doc/guides/bbdevs/acc100.rst
@@ -96,7 +96,7 @@ Bind PF UIO driver(s)
 Install the DPDK igb_uio driver, bind it with the PF PCI device ID and use
 ``lspci`` to confirm the PF device is under use by ``igb_uio`` DPDK UIO driver.
 
-The igb_uio driver may be bound to the PF PCI device using one of three methods:
+The igb_uio driver may be bound to the PF PCI device using one of two methods:
 
 
 1. PCI functions (physical or virtual, depending on the use case) can be bound to
@@ -120,19 +120,6 @@ the UIO driver by repeating this command for every function.
 where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd8086:0d5c
 
 
-3. A third way to bind is to use ``dpdk-setup.sh`` tool
-
-.. code-block:: console
-
-  cd <dpdk-top-level-directory>
-  ./usertools/dpdk-setup.sh
-
-  select 'Bind Ethernet/Crypto/Baseband device to IGB UIO module'
-  enter PCI device ID
-  select 'Display current Ethernet/Crypto/Baseband device settings' to confirm binding
-
-In a similar way the ACC100 5G/4G FEC PF may be bound with vfio-pci as any PCIe device.
-
 Enable Virtual Functions
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/bbdevs/fpga_5gnr_fec.rst b/doc/guides/bbdevs/fpga_5gnr_fec.rst
index 161f5e2ae4..814dbf1720 100644
--- a/doc/guides/bbdevs/fpga_5gnr_fec.rst
+++ b/doc/guides/bbdevs/fpga_5gnr_fec.rst
@@ -82,7 +82,7 @@ Bind PF UIO driver(s)
 Install the DPDK igb_uio driver, bind it with the PF PCI device ID and use
 ``lspci`` to confirm the PF device is under use by ``igb_uio`` DPDK UIO driver.
 
-The igb_uio driver may be bound to the PF PCI device using one of three methods:
+The igb_uio driver may be bound to the PF PCI device using one of two methods:
 
 
 1. PCI functions (physical or virtual, depending on the use case) can be bound to
@@ -105,24 +105,6 @@ the UIO driver by repeating this command for every function.
 where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd8086:0d8f
 
 
-3. A third way to bind is to use ``dpdk-setup.sh`` tool
-
-.. code-block:: console
-
-  cd <dpdk-top-level-directory>
-  ./usertools/dpdk-setup.sh
-
-  select 'Bind Ethernet/Crypto/Baseband device to IGB UIO module'
-  or
-  select 'Bind Ethernet/Crypto/Baseband device to VFIO module' depending on driver required
-  enter PCI device ID
-  select 'Display current Ethernet/Crypto/Baseband device settings' to confirm binding
-
-
-In the same way the FPGA 5GNR FEC PF can be bound with vfio, but vfio driver does not
-support SR-IOV configuration right out of the box, so it will need to be patched.
-
-
 Enable Virtual Functions
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/bbdevs/fpga_lte_fec.rst b/doc/guides/bbdevs/fpga_lte_fec.rst
index e268e5b9dc..4d9ac86e9f 100644
--- a/doc/guides/bbdevs/fpga_lte_fec.rst
+++ b/doc/guides/bbdevs/fpga_lte_fec.rst
@@ -81,7 +81,7 @@ Bind PF UIO driver(s)
 Install the DPDK igb_uio driver, bind it with the PF PCI device ID and use
 ``lspci`` to confirm the PF device is under use by ``igb_uio`` DPDK UIO driver.
 
-The igb_uio driver may be bound to the PF PCI device using one of three methods:
+The igb_uio driver may be bound to the PF PCI device using one of two methods:
 
 
 1. PCI functions (physical or virtual, depending on the use case) can be bound to
@@ -104,24 +104,6 @@ the UIO driver by repeating this command for every function.
 where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd1172:
 
 
-3. A third way to bind is to use ``dpdk-setup.sh`` tool
-
-.. code-block:: console
-
-  cd <dpdk-top-level-directory>
-  ./usertools/dpdk-setup.sh
-
-  select 'Bind Ethernet/Crypto/Baseband device to IGB UIO module'
-  or
-  select 'Bind Ethernet/Crypto/Baseband device to VFIO module' depending on driver required
-  enter PCI device ID
-  select 'Display current Ethernet/Crypto/Baseband device settings' to confirm binding
-
-
-In the same way the FPGA LTE FEC PF can be bound with vfio, but vfio driver does not
-support SR-IOV configuration right out of the box, so it will need to be patched.
-
-
 Enable Virtual Functions
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index ee8c1697b4..2aec432d75 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -22,8 +22,7 @@ When you stop and restart the test application, it looks to see if the pages are
 If you look in the directory, you will see ``n`` number of 2M pages files. If you specified 1024, you will see 1024 page files.
 These are then placed in memory segments to get contiguous memory.
 
-If you need to change the number of pages, it is easier to first remove the pages. The usertools/dpdk-setup.sh script provides an option to do this.
-See the "Quick Start Setup Script" section in the :ref:`DPDK Getting Started Guide <linux_gsg>` for more information.
+If you need to change the number of pages, it is easier to first remove the pages.
 
 
 If I execute "l2fwd -l 0-3 -m 64 -n 3 -- -p 3", I get the following output, indicating that there are no socket 0 hugepages to allocate the mbuf and ring structures to?
diff --git a/doc/guides/linux_gsg/build_dpdk.rst b/doc/guides/linux_gsg/build_dpdk.rst
index 8ce0f23097..f78eef2517 100644
--- a/doc/guides/linux_gsg/build_dpdk.rst
+++ b/doc/guides/linux_gsg/build_dpdk.rst
@@ -6,11 +6,6 @@
 Compiling the DPDK Target from Source
 =====================================
 
-.. note::
-
-    Parts of this process can also be done using the setup script described in
-    the :ref:`linux_setup_script` section of this document.
-
 Uncompress DPDK and Browse Sources
 ----------------------------------
 
diff --git a/doc/guides/linux_gsg/build_sample_apps.rst b/doc/guides/linux_gsg/build_sample_apps.rst
index 994db4b6a0..78652549a7 100644
--- a/doc/guides/linux_gsg/build_sample_apps.rst
+++ b/doc/guides/linux_gsg/build_sample_apps.rst
@@ -7,11 +7,6 @@ Running Sample Applications
 The chapter describes how to compile and run applications in a DPDK environment.
 It also provides a pointer to where sample applications are stored.
 
-.. note::
-
-    Parts of this process can also be done using the setup script described the
-    :ref:`linux_setup_script` section of this document.
-
 Compiling a Sample Application
 ------------------------------
 
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 0f9f6242c1..16a9a67260 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -18,5 +18,4 @@ Getting Started Guide for Linux
     build_sample_apps
     linux_eal_parameters
     enable_func
-    quick_start
     nic_perf_intel_platform
diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 2d750b4c33..65373f1448 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -107,7 +107,6 @@ Also, to use VFIO, both kernel and BIOS must support and be configured to use IO
     ``vfio-pci`` module doesn't support the creation of virtual functions before Linux version 5.7.
 
 For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
-This can be done by using the DPDK setup script (called dpdk-setup.sh and located in the usertools directory).
 
 .. note::
 
diff --git a/doc/guides/linux_gsg/quick_start.rst b/doc/guides/linux_gsg/quick_start.rst
deleted file mode 100644
index 181ec00ad4..0000000000
--- a/doc/guides/linux_gsg/quick_start.rst
+++ /dev/null
@@ -1,304 +0,0 @@
-..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
-
-.. _linux_setup_script:
-
-Quick Start Setup Script
-========================
-
-The dpdk-setup.sh script, found in the usertools subdirectory, allows the user to perform the following tasks:
-
-*   Build the DPDK libraries
-
-*   Insert and remove the DPDK IGB_UIO kernel module
-
-*   Insert and remove VFIO kernel modules
-
-*   Insert and remove the DPDK KNI kernel module
-
-*   Create and delete hugepages for NUMA and non-NUMA cases
-
-*   View network port status and reserve ports for DPDK application use
-
-*   Set up permissions for using VFIO as a non-privileged user
-
-*   Run the test and testpmd applications
-
-*   Look at hugepages in the meminfo
-
-*   List hugepages in ``/mnt/huge``
-
-*   Remove built DPDK libraries
-
-Once these steps have been completed for one of the EAL targets,
-the user may compile their own application that links in the EAL libraries to create the DPDK image.
-
-Script Organization
--------------------
-
-The dpdk-setup.sh script is logically organized into a series of steps that a user performs in sequence.
-Each step provides a number of options that guide the user to completing the desired task.
-The following is a brief synopsis of each step.
-
-**Step 1: Build DPDK Libraries**
-
-Initially, the user must select a DPDK target to choose the correct target type and compiler options to use when building the libraries.
-
-The user must have all libraries, modules, updates and compilers installed in the system prior to this,
-as described in the earlier chapters in this Getting Started Guide.
-
-**Step 2: Setup Environment**
-
-The user configures the Linux* environment to support the running of DPDK applications.
-Hugepages can be set up for NUMA or non-NUMA systems. Any existing hugepages will be removed.
-The DPDK kernel module that is needed can also be inserted in this step,
-and network ports may be bound to this module for DPDK application use.
-
-**Step 3: Run an Application**
-
-The user may run the test application once the other steps have been performed.
-The test application allows the user to run a series of functional tests for the DPDK.
-The testpmd application, which supports the receiving and sending of packets, can also be run.
-
-**Step 4: Examining the System**
-
-This step provides some tools for examining the status of hugepage mappings.
-
-**Step 5: System Cleanup**
-
-The final step has options for restoring the system to its original state.
-
-Use Cases
----------
-
-The following are some example of how to use the dpdk-setup.sh script.
-The script should be run using the source command.
-Some options in the script prompt the user for further data before proceeding.
-
-.. warning::
-
-    The dpdk-setup.sh script should be run with root privileges.
-
-.. code-block:: console
-
-    source usertools/dpdk-setup.sh
-
-    ------------------------------------------------------------------------
-
-    RTE_SDK exported as /home/user/rte
-
-    ------------------------------------------------------------------------
-
-    Step 1: Select the DPDK environment to build
-
-    ------------------------------------------------------------------------
-
-    [1] i686-native-linux-gcc
-
-    [2] i686-native-linux-icc
-
-    [3] ppc_64-power8-linux-gcc
-
-    [4] x86_64-native-freebsd-clang
-
-    [5] x86_64-native-freebsd-gcc
-
-    [6] x86_64-native-linux-clang
-
-    [7] x86_64-native-linux-gcc
-
-    [8] x86_64-native-linux-icc
-
-    ------------------------------------------------------------------------
-
-    Step 2: Setup linux environment
-
-    ------------------------------------------------------------------------
-
-    [11] Insert IGB UIO module
-
-    [12] Insert VFIO module
-
-    [13] Insert KNI module
-
-    [14] Setup hugepage mappings for non-NUMA systems
-
-    [15] Setup hugepage mappings for NUMA systems
-
-    [16] Display current Ethernet device settings
-
-    [17] Bind Ethernet device to IGB UIO module
-
-    [18] Bind Ethernet device to VFIO module
-
-    [19] Setup VFIO permissions
-
-    ------------------------------------------------------------------------
-
-    Step 3: Run test application for linux environment
-
-    ------------------------------------------------------------------------
-
-    [20] Run test application ($RTE_TARGET/app/test)
-
-    [21] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)
-
-    ------------------------------------------------------------------------
-
-    Step 4: Other tools
-
-    ------------------------------------------------------------------------
-
-    [22] List hugepage info from /proc/meminfo
-
-    ------------------------------------------------------------------------
-
-    Step 5: Uninstall and system cleanup
-
-    ------------------------------------------------------------------------
-
-    [23] Uninstall all targets
-
-    [24] Unbind NICs from IGB UIO driver
-
-    [25] Remove IGB UIO module
-
-    [26] Remove VFIO module
-
-    [27] Remove KNI module
-
-    [28] Remove hugepage mappings
-
-    [29] Exit Script
-
-Option:
-
-The following selection demonstrates the creation of the ``x86_64-native-linux-gcc`` DPDK library.
-
-.. code-block:: console
-
-    Option: 9
-
-    ================== Installing x86_64-native-linux-gcc
-
-    Configuration done
-    == Build lib
-    ...
-    Build complete
-    RTE_TARGET exported as x86_64-native-linux-gcc
-
-The following selection demonstrates the starting of the DPDK UIO driver.
-
-.. code-block:: console
-
-    Option: 25
-
-    Unloading any existing DPDK UIO module
-    Loading DPDK UIO module
-
-The following selection demonstrates the creation of hugepages in a NUMA system.
-1024 2 MByte pages are assigned to each node.
-The result is that the application should use -m 4096 for starting the application to access both memory areas
-(this is done automatically if the -m option is not provided).
-
-.. note::
-
-    If prompts are displayed to remove temporary files, type 'y'.
-
-.. code-block:: console
-
-    Option: 15
-
-    Removing currently reserved hugepages
-    mounting /mnt/huge and removing directory
-    Input the number of 2MB pages for each node
-    Example: to have 128MB of hugepages available per node,
-    enter '64' to reserve 64 * 2MB pages on each node
-    Number of pages for node0: 1024
-    Number of pages for node1: 1024
-    Reserving hugepages
-    Creating /mnt/huge and mounting as hugetlbfs
-
-The following selection demonstrates the launch of the test application to run on a single core.
-
-.. code-block:: console
-
-    Option: 20
-
-    Enter hex bitmask of cores to execute test app on
-    Example: to execute app on cores 0 to 7, enter 0xff
-    bitmask: 0x01
-    Launching app
-    EAL: coremask set to 1
-    EAL: Detected lcore 0 on socket 0
-    ...
-    EAL: Main core 0 is ready (tid=1b2ad720)
-    RTE>>
-
-Applications
-------------
-
-Once the user has run the dpdk-setup.sh script, built one of the EAL targets and set up hugepages (if using one of the Linux EAL targets),
-the user can then move on to building and running their application or one of the examples provided.
-
-The examples in the /examples directory provide a good starting point to gain an understanding of the operation of the DPDK.
-The following command sequence shows how the helloworld sample application is built and run.
-As recommended in Section 4.2.1 , "Logical Core Use by Applications",
-the logical core layout of the platform should be determined when selecting a core mask to use for an application.
-
-.. code-block:: console
-
-    cd helloworld/
-    make
-      CC main.o
-      LD helloworld
-      INSTALL-APP helloworld
-      INSTALL-MAP helloworld.map
-
-    sudo ./build/app/helloworld -l 0-3 -n 3
-    [sudo] password for rte:
-
-    EAL: coremask set to f
-    EAL: Detected lcore 0 as core 0 on socket 0
-    EAL: Detected lcore 1 as core 0 on socket 1
-    EAL: Detected lcore 2 as core 1 on socket 0
-    EAL: Detected lcore 3 as core 1 on socket 1
-    EAL: Setting up hugepage memory...
-    EAL: Ask a virtual area of 0x200000 bytes
-    EAL: Virtual area found at 0x7f0add800000 (size = 0x200000)
-    EAL: Ask a virtual area of 0x3d400000 bytes
-    EAL: Virtual area found at 0x7f0aa0200000 (size = 0x3d400000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9fc00000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9f600000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9f000000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x800000 bytes
-    EAL: Virtual area found at 0x7f0a9e600000 (size = 0x800000)
-    EAL: Ask a virtual area of 0x800000 bytes
-    EAL: Virtual area found at 0x7f0a9dc00000 (size = 0x800000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9d600000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9d000000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x400000 bytes
-    EAL: Virtual area found at 0x7f0a9ca00000 (size = 0x400000)
-    EAL: Ask a virtual area of 0x200000 bytes
-    EAL: Virtual area found at 0x7f0a9c600000 (size = 0x200000)
-    EAL: Ask a virtual area of 0x200000 bytes
-    EAL: Virtual area found at 0x7f0a9c200000 (size = 0x200000)
-    EAL: Ask a virtual area of 0x3fc00000 bytes
-    EAL: Virtual area found at 0x7f0a5c400000 (size = 0x3fc00000)
-    EAL: Ask a virtual area of 0x200000 bytes
-    EAL: Virtual area found at 0x7f0a5c000000 (size = 0x200000)
-    EAL: Requesting 1024 pages of size 2MB from socket 0
-    EAL: Requesting 1024 pages of size 2MB from socket 1
-    EAL: Main core 0 is ready (tid=de25b700)
-    EAL: Core 1 is ready (tid=5b7fe700)
-    EAL: Core 3 is ready (tid=5a7fc700)
-    EAL: Core 2 is ready (tid=5affd700)
-    hello from core 1
-    hello from core 2
-    hello from core 3
-    hello from core 0
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 1271a7cf28..f418285d28 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -100,8 +100,3 @@ Deprecation Notices
 * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific
   content. On Linux and FreeBSD, supported prior to DPDK 20.11,
   original structure will be kept until DPDK 21.11.
-
-* dpdk-setup.sh: This old script relies on deprecated stuff, and especially
-  ``make``. Given environments are too much variables for such a simple script,
-  it will be removed in DPDK 20.11.
-  Some useful parts may be converted into specific scripts.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 24a078c995..7405a9864f 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -457,6 +457,8 @@ Removed Items
 
 * Removed TEP termination sample application.
 
+* Removed the deprecated ``dpdk-setup.sh`` script.
+
 
 API Changes
 -----------
diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
deleted file mode 100755
index 411bf2e07f..0000000000
--- a/usertools/dpdk-setup.sh
+++ /dev/null
@@ -1,609 +0,0 @@
-#! /bin/bash
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
-
-#
-# Run with "source /path/to/dpdk-setup.sh"
-#
-
-#
-# Change to DPDK directory ( <this-script's-dir>/.. ), and export it as RTE_SDK
-#
-cd $(dirname ${BASH_SOURCE[0]})/..
-export RTE_SDK=$PWD
-echo "------------------------------------------------------------------------------"
-echo " RTE_SDK exported as $RTE_SDK"
-echo "------------------------------------------------------------------------------"
-
-HUGEPGSZ=`cat /proc/meminfo  | grep Hugepagesize | cut -d : -f 2 | tr -d ' '`
-
-#
-# Application EAL parameters for setting memory options (amount/channels/ranks).
-#
-EAL_PARAMS='-n 4'
-
-#
-# Sets QUIT variable so script will finish.
-#
-quit()
-{
-	QUIT=$1
-}
-
-# Shortcut for quit.
-q()
-{
-	quit
-}
-
-#
-# Sets up environmental variables for ICC.
-#
-setup_icc()
-{
-	DEFAULT_PATH=/opt/intel/bin/iccvars.sh
-	param=$1
-	shpath=`which iccvars.sh 2> /dev/null`
-	if [ $? -eq 0 ] ; then
-		echo "Loading iccvars.sh from $shpath for $param"
-		source $shpath $param
-	elif [ -f $DEFAULT_PATH ] ; then
-		echo "Loading iccvars.sh from $DEFAULT_PATH for $param"
-		source $DEFAULT_PATH $param
-	else
-		echo "## ERROR: cannot find 'iccvars.sh' script to set up ICC."
-		echo "##     To fix, please add the directory that contains"
-		echo "##     iccvars.sh  to your 'PATH' environment variable."
-		quit
-	fi
-}
-
-#
-# Sets RTE_TARGET and does a "make install".
-#
-setup_target()
-{
-	option=$1
-	export RTE_TARGET=${TARGETS[option]}
-
-	compiler=${RTE_TARGET##*-}
-	if [ "$compiler" == "icc" ] ; then
-		platform=${RTE_TARGET%%-*}
-		if [ "$platform" == "x86_64" ] ; then
-			setup_icc intel64
-		else
-			setup_icc ia32
-		fi
-	fi
-	if [ "$QUIT" == "0" ] ; then
-		make install T=${RTE_TARGET}
-	fi
-	echo "------------------------------------------------------------------------------"
-	echo " RTE_TARGET exported as $RTE_TARGET"
-	echo "------------------------------------------------------------------------------"
-}
-
-#
-# Creates hugepage filesystem.
-#
-create_mnt_huge()
-{
-	echo "Creating /mnt/huge and mounting as hugetlbfs"
-	sudo mkdir -p /mnt/huge
-
-	grep -s '/mnt/huge' /proc/mounts > /dev/null
-	if [ $? -ne 0 ] ; then
-		sudo mount -t hugetlbfs nodev /mnt/huge
-	fi
-}
-
-#
-# Removes hugepage filesystem.
-#
-remove_mnt_huge()
-{
-	echo "Unmounting /mnt/huge and removing directory"
-	grep -s '/mnt/huge' /proc/mounts > /dev/null
-	if [ $? -eq 0 ] ; then
-		sudo umount /mnt/huge
-	fi
-
-	if [ -d /mnt/huge ] ; then
-		sudo rm -R /mnt/huge
-	fi
-}
-
-#
-# Unloads igb_uio.ko.
-#
-remove_igb_uio_module()
-{
-	echo "Unloading any existing DPDK UIO module"
-	/sbin/lsmod | grep -s igb_uio > /dev/null
-	if [ $? -eq 0 ] ; then
-		sudo /sbin/rmmod igb_uio
-	fi
-}
-
-#
-# Loads new igb_uio.ko (and uio module if needed).
-#
-load_igb_uio_module()
-{
-	if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko ];then
-		echo "## ERROR: Target does not have the DPDK UIO Kernel Module."
-		echo "       To fix, please try to rebuild target."
-		return
-	fi
-
-	remove_igb_uio_module
-
-	/sbin/lsmod | grep -s uio > /dev/null
-	if [ $? -ne 0 ] ; then
-		modinfo uio > /dev/null
-		if [ $? -eq 0 ]; then
-			echo "Loading uio module"
-			sudo /sbin/modprobe uio
-		fi
-	fi
-
-	# UIO may be compiled into kernel, so it may not be an error if it can't
-	# be loaded.
-
-	echo "Loading DPDK UIO module"
-	sudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko
-	if [ $? -ne 0 ] ; then
-		echo "## ERROR: Could not load kmod/igb_uio.ko."
-		quit
-	fi
-}
-
-#
-# Unloads VFIO modules.
-#
-remove_vfio_module()
-{
-	echo "Unloading any existing VFIO module"
-	/sbin/lsmod | grep -s vfio > /dev/null
-	if [ $? -eq 0 ] ; then
-		sudo /sbin/rmmod vfio-pci
-		sudo /sbin/rmmod vfio_iommu_type1
-		sudo /sbin/rmmod vfio
-	fi
-}
-
-#
-# Loads new vfio-pci (and vfio module if needed).
-#
-load_vfio_module()
-{
-	remove_vfio_module
-
-	VFIO_PATH="kernel/drivers/vfio/pci/vfio-pci.ko"
-
-	echo "Loading VFIO module"
-	/sbin/lsmod | grep -s vfio_pci > /dev/null
-	if [ $? -ne 0 ] ; then
-		if [ -f /lib/modules/$(uname -r)/$VFIO_PATH ] ; then
-			sudo /sbin/modprobe vfio-pci
-		fi
-	fi
-
-	# make sure regular users can read /dev/vfio
-	echo "chmod /dev/vfio"
-	sudo chmod a+x /dev/vfio
-	if [ $? -ne 0 ] ; then
-		echo "FAIL"
-		quit
-	fi
-	echo "OK"
-
-	# check if /dev/vfio/vfio exists - that way we
-	# know we either loaded the module, or it was
-	# compiled into the kernel
-	if [ ! -e /dev/vfio/vfio ] ; then
-		echo "## ERROR: VFIO not found!"
-	fi
-}
-
-#
-# Unloads the rte_kni.ko module.
-#
-remove_kni_module()
-{
-	echo "Unloading any existing DPDK KNI module"
-	/sbin/lsmod | grep -s rte_kni > /dev/null
-	if [ $? -eq 0 ] ; then
-		sudo /sbin/rmmod rte_kni
-	fi
-}
-
-#
-# Loads the rte_kni.ko module.
-#
-load_kni_module()
-{
-    # Check that the KNI module is already built.
-	if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko ];then
-		echo "## ERROR: Target does not have the DPDK KNI Module."
-		echo "       To fix, please try to rebuild target."
-		return
-	fi
-
-    # Unload existing version if present.
-	remove_kni_module
-
-    # Now try load the KNI module.
-	echo "Loading DPDK KNI module"
-	sudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko
-	if [ $? -ne 0 ] ; then
-		echo "## ERROR: Could not load kmod/rte_kni.ko."
-		quit
-	fi
-}
-
-#
-# Sets appropriate permissions on /dev/vfio/* files
-#
-set_vfio_permissions()
-{
-	# make sure regular users can read /dev/vfio
-	echo "chmod /dev/vfio"
-	sudo chmod a+x /dev/vfio
-	if [ $? -ne 0 ] ; then
-		echo "FAIL"
-		quit
-	fi
-	echo "OK"
-
-	# make sure regular user can access everything inside /dev/vfio
-	echo "chmod /dev/vfio/*"
-	sudo chmod 0666 /dev/vfio/*
-	if [ $? -ne 0 ] ; then
-		echo "FAIL"
-		quit
-	fi
-	echo "OK"
-
-	# since permissions are only to be set when running as
-	# regular user, we only check ulimit here
-	#
-	# warn if regular user is only allowed
-	# to memlock <64M of memory
-	MEMLOCK_AMNT=`ulimit -l`
-
-	if [ "$MEMLOCK_AMNT" != "unlimited" ] ; then
-		MEMLOCK_MB=`expr $MEMLOCK_AMNT / 1024`
-		echo ""
-		echo "Current user memlock limit: ${MEMLOCK_MB} MB"
-		echo ""
-		echo "This is the maximum amount of memory you will be"
-		echo "able to use with DPDK and VFIO if run as current user."
-		echo -n "To change this, please adjust limits.conf memlock "
-		echo "limit for current user."
-
-		if [ $MEMLOCK_AMNT -lt 65536 ] ; then
-			echo ""
-			echo "## WARNING: memlock limit is less than 64MB"
-			echo -n "## DPDK with VFIO may not be able to initialize "
-			echo "if run as current user."
-		fi
-	fi
-}
-
-#
-# Removes all reserved hugepages.
-#
-clear_huge_pages()
-{
-	echo > .echo_tmp
-	for d in /sys/devices/system/node/node? ; do
-		echo "echo 0 > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
-	done
-	echo "Removing currently reserved hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	remove_mnt_huge
-}
-
-#
-# Creates hugepages.
-#
-set_non_numa_pages()
-{
-	clear_huge_pages
-
-	echo ""
-	echo "  Input the number of ${HUGEPGSZ} hugepages"
-	echo "  Example: to have 128MB of hugepages available in a 2MB huge page system,"
-	echo "  enter '64' to reserve 64 * 2MB pages"
-	echo -n "Number of pages: "
-	read Pages
-
-	echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
-
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	create_mnt_huge
-}
-
-#
-# Creates hugepages on specific NUMA nodes.
-#
-set_numa_pages()
-{
-	clear_huge_pages
-
-	echo ""
-	echo "  Input the number of ${HUGEPGSZ} hugepages for each node"
-	echo "  Example: to have 128MB of hugepages available per node in a 2MB huge page system,"
-	echo "  enter '64' to reserve 64 * 2MB pages on each node"
-
-	echo > .echo_tmp
-	for d in /sys/devices/system/node/node? ; do
-		node=$(basename $d)
-		echo -n "Number of pages for $node: "
-		read Pages
-		echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
-	done
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	create_mnt_huge
-}
-
-#
-# Run unit test application.
-#
-run_test_app()
-{
-	echo ""
-	echo "  Enter hex bitmask of cores to execute test app on"
-	echo "  Example: to execute app on cores 0 to 7, enter 0xff"
-	echo -n "bitmask: "
-	read Bitmask
-	echo "Launching app"
-	sudo ${RTE_TARGET}/app/test -c $Bitmask $EAL_PARAMS
-}
-
-#
-# Run unit testpmd application.
-#
-run_testpmd_app()
-{
-	echo ""
-	echo "  Enter hex bitmask of cores to execute testpmd app on"
-	echo "  Example: to execute app on cores 0 to 7, enter 0xff"
-	echo -n "bitmask: "
-	read Bitmask
-	echo "Launching app"
-	sudo ${RTE_TARGET}/app/testpmd -c $Bitmask $EAL_PARAMS -- -i
-}
-
-#
-# Print hugepage information.
-#
-grep_meminfo()
-{
-	grep -i huge /proc/meminfo
-}
-
-#
-# Calls dpdk-devbind.py --status to show the devices and what they
-# are all bound to, in terms of drivers.
-#
-show_devices()
-{
-	if [ -d /sys/module/vfio_pci -o -d /sys/module/igb_uio ]; then
-		${RTE_SDK}/usertools/dpdk-devbind.py --status
-	else
-		echo "# Please load the 'igb_uio' or 'vfio-pci' kernel module before "
-		echo "# querying or adjusting device bindings"
-	fi
-}
-
-#
-# Uses dpdk-devbind.py to move devices to work with vfio-pci
-#
-bind_devices_to_vfio()
-{
-	if [ -d /sys/module/vfio_pci ]; then
-		${RTE_SDK}/usertools/dpdk-devbind.py --status
-		echo ""
-		echo -n "Enter PCI address of device to bind to VFIO driver: "
-		read PCI_PATH
-		sudo ${RTE_SDK}/usertools/dpdk-devbind.py -b vfio-pci $PCI_PATH &&
-			echo "OK"
-	else
-		echo "# Please load the 'vfio-pci' kernel module before querying or "
-		echo "# adjusting device bindings"
-	fi
-}
-
-#
-# Uses dpdk-devbind.py to move devices to work with igb_uio
-#
-bind_devices_to_igb_uio()
-{
-	if [ -d /sys/module/igb_uio ]; then
-		${RTE_SDK}/usertools/dpdk-devbind.py --status
-		echo ""
-		echo -n "Enter PCI address of device to bind to IGB UIO driver: "
-		read PCI_PATH
-		sudo ${RTE_SDK}/usertools/dpdk-devbind.py -b igb_uio $PCI_PATH && echo "OK"
-	else
-		echo "# Please load the 'igb_uio' kernel module before querying or "
-		echo "# adjusting device bindings"
-	fi
-}
-
-#
-# Uses dpdk-devbind.py to move devices to work with kernel drivers again
-#
-unbind_devices()
-{
-	${RTE_SDK}/usertools/dpdk-devbind.py --status
-	echo ""
-	echo -n "Enter PCI address of device to unbind: "
-	read PCI_PATH
-	echo ""
-	echo -n "Enter name of kernel driver to bind the device to: "
-	read DRV
-	sudo ${RTE_SDK}/usertools/dpdk-devbind.py -b $DRV $PCI_PATH && echo "OK"
-}
-
-#
-# Options for building a target. Note that this step MUST be first as it sets
-# up TARGETS[] starting from 1, and this is accessed in setup_target using the
-# user entered option.
-#
-step1_func()
-{
-	TITLE="Select the DPDK environment to build"
-	CONFIG_NUM=1
-	for cfg in config/defconfig_* ; do
-		cfg=${cfg/config\/defconfig_/}
-		TEXT[$CONFIG_NUM]="$cfg"
-		TARGETS[$CONFIG_NUM]=$cfg
-		FUNC[$CONFIG_NUM]="setup_target"
-		let "CONFIG_NUM+=1"
-	done
-}
-
-#
-# Options for setting up environment.
-#
-step2_func()
-{
-	TITLE="Setup linux environment"
-
-	TEXT[1]="Insert IGB UIO module"
-	FUNC[1]="load_igb_uio_module"
-
-	TEXT[2]="Insert VFIO module"
-	FUNC[2]="load_vfio_module"
-
-	TEXT[3]="Insert KNI module"
-	FUNC[3]="load_kni_module"
-
-	TEXT[4]="Setup hugepage mappings for non-NUMA systems"
-	FUNC[4]="set_non_numa_pages"
-
-	TEXT[5]="Setup hugepage mappings for NUMA systems"
-	FUNC[5]="set_numa_pages"
-
-	TEXT[6]="Display current Ethernet/Baseband/Crypto device settings"
-	FUNC[6]="show_devices"
-
-	TEXT[7]="Bind Ethernet/Baseband/Crypto device to IGB UIO module"
-	FUNC[7]="bind_devices_to_igb_uio"
-
-	TEXT[8]="Bind Ethernet/Baseband/Crypto device to VFIO module"
-	FUNC[8]="bind_devices_to_vfio"
-
-	TEXT[9]="Setup VFIO permissions"
-	FUNC[9]="set_vfio_permissions"
-}
-
-#
-# Options for running applications.
-#
-step3_func()
-{
-	TITLE="Run test application for linux environment"
-
-	TEXT[1]="Run test application (\$RTE_TARGET/app/test)"
-	FUNC[1]="run_test_app"
-
-	TEXT[2]="Run testpmd application in interactive mode (\$RTE_TARGET/app/testpmd)"
-	FUNC[2]="run_testpmd_app"
-}
-
-#
-# Other options
-#
-step4_func()
-{
-	TITLE="Other tools"
-
-	TEXT[1]="List hugepage info from /proc/meminfo"
-	FUNC[1]="grep_meminfo"
-
-}
-
-#
-# Options for cleaning up the system
-#
-step5_func()
-{
-	TITLE="Uninstall and system cleanup"
-
-	TEXT[1]="Unbind devices from IGB UIO or VFIO driver"
-	FUNC[1]="unbind_devices"
-
-	TEXT[2]="Remove IGB UIO module"
-	FUNC[2]="remove_igb_uio_module"
-
-	TEXT[3]="Remove VFIO module"
-	FUNC[3]="remove_vfio_module"
-
-	TEXT[4]="Remove KNI module"
-	FUNC[4]="remove_kni_module"
-
-	TEXT[5]="Remove hugepage mappings"
-	FUNC[5]="clear_huge_pages"
-}
-
-STEPS[1]="step1_func"
-STEPS[2]="step2_func"
-STEPS[3]="step3_func"
-STEPS[4]="step4_func"
-STEPS[5]="step5_func"
-
-QUIT=0
-
-while [ "$QUIT" == "0" ]; do
-	OPTION_NUM=1
-
-	for s in $(seq ${#STEPS[@]}) ; do
-		${STEPS[s]}
-
-		echo "----------------------------------------------------------"
-		echo " Step $s: ${TITLE}"
-		echo "----------------------------------------------------------"
-
-		for i in $(seq ${#TEXT[@]}) ; do
-			echo "[$OPTION_NUM] ${TEXT[i]}"
-			OPTIONS[$OPTION_NUM]=${FUNC[i]}
-			let "OPTION_NUM+=1"
-		done
-
-		# Clear TEXT and FUNC arrays before next step
-		unset TEXT
-		unset FUNC
-
-		echo ""
-	done
-
-	echo "[$OPTION_NUM] Exit Script"
-	OPTIONS[$OPTION_NUM]="quit"
-	echo ""
-	echo '--------------------------------------------------'
-	echo 'WARNING: This tool will be removed from DPDK 20.11'
-	echo '--------------------------------------------------'
-	echo
-	echo -n "Option: "
-	read our_entry
-	echo ""
-	${OPTIONS[our_entry]} ${our_entry}
-
-	if [ "$QUIT" == "0" ] ; then
-		echo
-		echo -n "Press enter to continue ..."; read
-	fi
-
-done
-- 
2.23.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-27 16:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 15:07 [dpdk-dev] [PATCH] remove dpdk-setup.sh David Marchand
2020-11-27 15:09 ` Bruce Richardson
2020-11-27 15:13   ` Thomas Monjalon
2020-11-27 15:27     ` Ferruh Yigit
2020-11-27 15:15 ` David Marchand
2020-11-27 15:29 ` Maxime Coquelin
2020-11-27 16:12 ` David Marchand
2020-11-27 16:20   ` Chautru, Nicolas
2020-11-27 16:27     ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).