[dpdk-dev] [PATCH] tools/setup.sh: let function quit to exit directly (may convenient for use); replace tab by space;

Zhangjun (Kenny) kenny.zhangjun at huawei.com
Mon Oct 19 11:01:34 CEST 2015


>From 49090c56383f1255e3ea1991f51e83b1ed6fb8d6 Mon Sep 17 00:00:00 2001
From: z00182565 <kenny.zhangjun at huawei.com>
Date: Mon, 19 Oct 2015 16:43:59 +0800
Subject: [PATCH] tools/setup.sh: let function quit to exit directly (may
 convenient for use); replace tab by space;

---
 tools/setup.sh | 679 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 338 insertions(+), 341 deletions(-)

diff --git a/tools/setup.sh b/tools/setup.sh
index 5a8b2f3..a43d16d 100755
--- a/tools/setup.sh
+++ b/tools/setup.sh
@@ -50,11 +50,11 @@ echo "--------------------------------------------------------------------------
 EAL_PARAMS='-n 4'
 
 #
-# Sets QUIT variable so script will finish.
+# finish script.
 #
 quit()
 {
-	QUIT=$1
+    exit 0
 }
 
 #
@@ -62,21 +62,21 @@ quit()
 #
 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
+    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
 }
 
 #
@@ -84,24 +84,22 @@ setup_icc()
 #
 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 "------------------------------------------------------------------------------"
+    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
+    make install T=${RTE_TARGET}
+    echo "------------------------------------------------------------------------------"
+    echo " RTE_TARGET exported as $RTE_TARGET"
+    echo "------------------------------------------------------------------------------"
 }
 
 #
@@ -109,7 +107,7 @@ setup_target()
 #
 uninstall_targets()
 {
-	make uninstall
+    make uninstall
 }
 
 #
@@ -117,13 +115,13 @@ uninstall_targets()
 #
 create_mnt_huge()
 {
-	echo "Creating /mnt/huge and mounting as hugetlbfs"
-	sudo mkdir -p /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
+    grep -s '/mnt/huge' /proc/mounts > /dev/null
+    if [ $? -ne 0 ] ; then
+        sudo mount -t hugetlbfs nodev /mnt/huge
+    fi
 }
 
 #
@@ -131,15 +129,15 @@ create_mnt_huge()
 #
 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
+    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
 }
 
 #
@@ -147,11 +145,11 @@ remove_mnt_huge()
 #
 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
+    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
 }
 
 #
@@ -159,32 +157,32 @@ remove_igb_uio_module()
 #
 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
+    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
 }
 
 #
@@ -192,13 +190,13 @@ load_igb_uio_module()
 #
 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
+    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
 }
 
 #
@@ -206,33 +204,33 @@ remove_vfio_module()
 #
 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
+    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
 }
 
 #
@@ -240,11 +238,11 @@ load_vfio_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
+    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
 }
 
 #
@@ -253,22 +251,22 @@ remove_kni_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
+    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
+    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
+    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
 }
 
 #
@@ -276,48 +274,48 @@ load_kni_module()
 #
 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
+    # 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
 }
 
 #
@@ -325,15 +323,15 @@ set_vfio_permissions()
 #
 clear_huge_pages()
 {
-	echo > .echo_tmp
-	for d in /sys/devices/system/node/node? ; do
-		echo "echo 0 > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp
-	done
-	echo "Removing currently reserved hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	remove_mnt_huge
+    echo > .echo_tmp
+    for d in /sys/devices/system/node/node? ; do
+        echo "echo 0 > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp
+    done
+    echo "Removing currently reserved hugepages"
+    sudo sh .echo_tmp
+    rm -f .echo_tmp
+
+    remove_mnt_huge
 }
 
 #
@@ -341,22 +339,22 @@ clear_huge_pages()
 #
 set_non_numa_pages()
 {
-	clear_huge_pages
+    clear_huge_pages
 
-	echo ""
-	echo "  Input the number of 2MB pages"
-	echo "  Example: to have 128MB of hugepages available, enter '64' to"
-	echo "  reserve 64 * 2MB pages"
-	echo -n "Number of pages: "
-	read Pages
+    echo ""
+    echo "  Input the number of 2MB pages"
+    echo "  Example: to have 128MB of hugepages available, enter '64' to"
+    echo "  reserve 64 * 2MB pages"
+    echo -n "Number of pages: "
+    read Pages
 
-	echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > .echo_tmp
+    echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > .echo_tmp
 
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
+    echo "Reserving hugepages"
+    sudo sh .echo_tmp
+    rm -f .echo_tmp
 
-	create_mnt_huge
+    create_mnt_huge
 }
 
 #
@@ -364,25 +362,25 @@ set_non_numa_pages()
 #
 set_numa_pages()
 {
-	clear_huge_pages
-
-	echo ""
-	echo "  Input the number of 2MB pages for each node"
-	echo "  Example: to have 128MB of hugepages available per node,"
-	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-2048kB/nr_hugepages" >> .echo_tmp
-	done
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	create_mnt_huge
+    clear_huge_pages
+
+    echo ""
+    echo "  Input the number of 2MB pages for each node"
+    echo "  Example: to have 128MB of hugepages available per node,"
+    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-2048kB/nr_hugepages" >> .echo_tmp
+    done
+    echo "Reserving hugepages"
+    sudo sh .echo_tmp
+    rm -f .echo_tmp
+
+    create_mnt_huge
 }
 
 #
@@ -390,13 +388,13 @@ set_numa_pages()
 #
 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
+    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
 }
 
 #
@@ -404,13 +402,13 @@ run_test_app()
 #
 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
+    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
 }
 
 #
@@ -418,7 +416,7 @@ run_testpmd_app()
 #
 grep_meminfo()
 {
-	grep -i huge /proc/meminfo
+    grep -i huge /proc/meminfo
 }
 
 #
@@ -427,12 +425,12 @@ grep_meminfo()
 #
 show_nics()
 {
-	if  /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then
-		${RTE_SDK}/tools/dpdk_nic_bind.py --status
-	else
-		echo "# Please load the 'igb_uio' or 'vfio-pci' kernel module before "
-		echo "# querying or adjusting NIC device bindings"
-	fi
+    if  /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then
+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status
+    else
+        echo "# Please load the 'igb_uio' or 'vfio-pci' kernel module before "
+        echo "# querying or adjusting NIC device bindings"
+    fi
 }
 
 #
@@ -440,17 +438,17 @@ show_nics()
 #
 bind_nics_to_vfio()
 {
-	if /sbin/lsmod  | grep -q vfio_pci ; then
-		${RTE_SDK}/tools/dpdk_nic_bind.py --status
-		echo ""
-		echo -n "Enter PCI address of device to bind to VFIO driver: "
-		read PCI_PATH
-		sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b vfio-pci $PCI_PATH &&
-			echo "OK"
-	else
-		echo "# Please load the 'vfio-pci' kernel module before querying or "
-		echo "# adjusting NIC device bindings"
-	fi
+    if /sbin/lsmod  | grep -q vfio_pci ; then
+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status
+        echo ""
+        echo -n "Enter PCI address of device to bind to VFIO driver: "
+        read PCI_PATH
+        sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b vfio-pci $PCI_PATH &&
+            echo "OK"
+    else
+        echo "# Please load the 'vfio-pci' kernel module before querying or "
+        echo "# adjusting NIC device bindings"
+    fi
 }
 
 #
@@ -458,16 +456,16 @@ bind_nics_to_vfio()
 #
 bind_nics_to_igb_uio()
 {
-	if  /sbin/lsmod  | grep -q igb_uio ; then
-		${RTE_SDK}/tools/dpdk_nic_bind.py --status
-		echo ""
-		echo -n "Enter PCI address of device to bind to IGB UIO driver: "
-		read PCI_PATH
-		sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b igb_uio $PCI_PATH && echo "OK"
-	else
-		echo "# Please load the 'igb_uio' kernel module before querying or "
-		echo "# adjusting NIC device bindings"
-	fi
+    if  /sbin/lsmod  | grep -q igb_uio ; then
+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status
+        echo ""
+        echo -n "Enter PCI address of device to bind to IGB UIO driver: "
+        read PCI_PATH
+        sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b igb_uio $PCI_PATH && echo "OK"
+    else
+        echo "# Please load the 'igb_uio' kernel module before querying or "
+        echo "# adjusting NIC device bindings"
+    fi
 }
 
 #
@@ -475,14 +473,14 @@ bind_nics_to_igb_uio()
 #
 unbind_nics()
 {
-	${RTE_SDK}/tools/dpdk_nic_bind.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}/tools/dpdk_nic_bind.py -b $DRV $PCI_PATH && echo "OK"
+    ${RTE_SDK}/tools/dpdk_nic_bind.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}/tools/dpdk_nic_bind.py -b $DRV $PCI_PATH && echo "OK"
 }
 
 #
@@ -492,15 +490,15 @@ unbind_nics()
 #
 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
+    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
 }
 
 #
@@ -508,34 +506,34 @@ step1_func()
 #
 step2_func()
 {
-	TITLE="Setup linuxapp environment"
+    TITLE="Setup linuxapp environment"
 
-	TEXT[1]="Insert IGB UIO module"
-	FUNC[1]="load_igb_uio_module"
+    TEXT[1]="Insert IGB UIO module"
+    FUNC[1]="load_igb_uio_module"
 
-	TEXT[2]="Insert VFIO module"
-	FUNC[2]="load_vfio_module"
+    TEXT[2]="Insert VFIO module"
+    FUNC[2]="load_vfio_module"
 
-	TEXT[3]="Insert KNI module"
-	FUNC[3]="load_kni_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[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[5]="Setup hugepage mappings for NUMA systems"
+    FUNC[5]="set_numa_pages"
 
-	TEXT[6]="Display current Ethernet device settings"
-	FUNC[6]="show_nics"
+    TEXT[6]="Display current Ethernet device settings"
+    FUNC[6]="show_nics"
 
-	TEXT[7]="Bind Ethernet device to IGB UIO module"
-	FUNC[7]="bind_nics_to_igb_uio"
+    TEXT[7]="Bind Ethernet device to IGB UIO module"
+    FUNC[7]="bind_nics_to_igb_uio"
 
-	TEXT[8]="Bind Ethernet device to VFIO module"
-	FUNC[8]="bind_nics_to_vfio"
+    TEXT[8]="Bind Ethernet device to VFIO module"
+    FUNC[8]="bind_nics_to_vfio"
 
-	TEXT[9]="Setup VFIO permissions"
-	FUNC[9]="set_vfio_permissions"
+    TEXT[9]="Setup VFIO permissions"
+    FUNC[9]="set_vfio_permissions"
 }
 
 #
@@ -543,13 +541,13 @@ step2_func()
 #
 step3_func()
 {
-	TITLE="Run test application for linuxapp environment"
+    TITLE="Run test application for linuxapp environment"
 
-	TEXT[1]="Run test application (\$RTE_TARGET/app/test)"
-	FUNC[1]="run_test_app"
+    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"
+    TEXT[2]="Run testpmd application in interactive mode (\$RTE_TARGET/app/testpmd)"
+    FUNC[2]="run_testpmd_app"
 }
 
 #
@@ -557,10 +555,10 @@ step3_func()
 #
 step4_func()
 {
-	TITLE="Other tools"
+    TITLE="Other tools"
 
-	TEXT[1]="List hugepage info from /proc/meminfo"
-	FUNC[1]="grep_meminfo"
+    TEXT[1]="List hugepage info from /proc/meminfo"
+    FUNC[1]="grep_meminfo"
 
 }
 
@@ -569,25 +567,25 @@ step4_func()
 #
 step5_func()
 {
-	TITLE="Uninstall and system cleanup"
+    TITLE="Uninstall and system cleanup"
 
-	TEXT[1]="Uninstall all targets"
-	FUNC[1]="uninstall_targets"
+    TEXT[1]="Uninstall all targets"
+    FUNC[1]="uninstall_targets"
 
-	TEXT[2]="Unbind NICs from IGB UIO or VFIO driver"
-	FUNC[2]="unbind_nics"
+    TEXT[2]="Unbind NICs from IGB UIO or VFIO driver"
+    FUNC[2]="unbind_nics"
 
-	TEXT[3]="Remove IGB UIO module"
-	FUNC[3]="remove_igb_uio_module"
+    TEXT[3]="Remove IGB UIO module"
+    FUNC[3]="remove_igb_uio_module"
 
-	TEXT[4]="Remove VFIO module"
-	FUNC[4]="remove_vfio_module"
+    TEXT[4]="Remove VFIO module"
+    FUNC[4]="remove_vfio_module"
 
-	TEXT[5]="Remove KNI module"
-	FUNC[5]="remove_kni_module"
+    TEXT[5]="Remove KNI module"
+    FUNC[5]="remove_kni_module"
 
-	TEXT[6]="Remove hugepage mappings"
-	FUNC[6]="clear_huge_pages"
+    TEXT[6]="Remove hugepage mappings"
+    FUNC[6]="clear_huge_pages"
 }
 
 STEPS[1]="step1_func"
@@ -596,38 +594,37 @@ STEPS[3]="step3_func"
 STEPS[4]="step4_func"
 STEPS[5]="step5_func"
 
-QUIT=0
 
-while [ "$QUIT" == "0" ]; do
-	OPTION_NUM=1
+while true ; do
+    OPTION_NUM=1
 
-	for s in $(seq ${#STEPS[@]}) ; do
-		${STEPS[s]}
+    for s in $(seq ${#STEPS[@]}) ; do
+        ${STEPS[s]}
 
-		echo "----------------------------------------------------------"
-		echo " Step $s: ${TITLE}"
-		echo "----------------------------------------------------------"
+        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
+        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
+        # Clear TEXT and FUNC arrays before next step
+        unset TEXT
+        unset FUNC
 
-		echo ""
-	done
+        echo ""
+    done
 
-	echo "[$OPTION_NUM] Exit Script"
-	OPTIONS[$OPTION_NUM]="quit"
-	echo ""
-	echo -n "Option: "
-	read our_entry
-	echo ""
-	${OPTIONS[our_entry]} ${our_entry}
-	echo
-	echo -n "Press enter to continue ..."; read
+    echo "[$OPTION_NUM] Exit Script"
+    OPTIONS[$OPTION_NUM]="quit"
+    echo ""
+    echo -n "Option: "
+    read our_entry
+    echo ""
+    ${OPTIONS[our_entry]} ${our_entry}
+    echo
+    echo -n "Press enter to continue ..."; read
 done
-- 
2.5.0.windows.1



More information about the dev mailing list