get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/7735/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 7735,
    "url": "https://patches.dpdk.org/api/patches/7735/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/2857D8E1E6DE32419229277EB538AE337BEB01F7@szxema508-mbx.china.huawei.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<2857D8E1E6DE32419229277EB538AE337BEB01F7@szxema508-mbx.china.huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/2857D8E1E6DE32419229277EB538AE337BEB01F7@szxema508-mbx.china.huawei.com",
    "date": "2015-10-19T09:01:34",
    "name": "[dpdk-dev] tools/setup.sh: let function quit to exit directly (may convenient for use); replace tab by space;",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "dcca02cbaa9f539ca254bd92f98cfbb52378b58b",
    "submitter": {
        "id": 355,
        "url": "https://patches.dpdk.org/api/people/355/?format=api",
        "name": "Zhangjun (Kenny)",
        "email": "kenny.zhangjun@huawei.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/2857D8E1E6DE32419229277EB538AE337BEB01F7@szxema508-mbx.china.huawei.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7735/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7735/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id C79DE8E7E;\n\tMon, 19 Oct 2015 11:01:43 +0200 (CEST)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65])\n\tby dpdk.org (Postfix) with ESMTP id BA2C08E7C\n\tfor <dev@dpdk.org>; Mon, 19 Oct 2015 11:01:40 +0200 (CEST)",
            "from 172.24.1.50 (EHLO szxema411-hub.china.huawei.com)\n\t([172.24.1.50])\n\tby szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued)\n\twith ESMTP id CUM04230; Mon, 19 Oct 2015 17:01:38 +0800 (CST)",
            "from SZXEMA508-MBX.china.huawei.com ([169.254.7.15]) by\n\tszxema411-hub.china.huawei.com ([10.82.72.70]) with mapi id\n\t14.03.0235.001; Mon, 19 Oct 2015 17:01:35 +0800"
        ],
        "From": "\"Zhangjun (Kenny)\" <kenny.zhangjun@huawei.com>",
        "To": "\"dev@dpdk.org\" <dev@dpdk.org>",
        "Thread-Topic": "[dpdk-dev] [PATCH] tools/setup.sh: let function quit to exit\n\tdirectly (may convenient for use); replace tab by space;",
        "Thread-Index": "AdEKTLoizF6Grhb0S06A4Idn7bQagQ==",
        "Date": "Mon, 19 Oct 2015 09:01:34 +0000",
        "Message-ID": "<2857D8E1E6DE32419229277EB538AE337BEB01F7@szxema508-mbx.china.huawei.com>",
        "Accept-Language": "zh-CN, en-US",
        "Content-Language": "zh-CN",
        "X-MS-Has-Attach": "yes",
        "X-MS-TNEF-Correlator": "",
        "x-originating-ip": "[10.177.25.145]",
        "MIME-Version": "1.0",
        "X-CFilter-Loop": "Reflected",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-Content-Filtered-By": "Mailman/MimeDel 2.1.15",
        "Subject": "[dpdk-dev] [PATCH] tools/setup.sh: let function quit to exit\n\tdirectly (may convenient for use); replace tab by space; ",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From 49090c56383f1255e3ea1991f51e83b1ed6fb8d6 Mon Sep 17 00:00:00 2001\nFrom: z00182565 <kenny.zhangjun@huawei.com>\nDate: Mon, 19 Oct 2015 16:43:59 +0800\nSubject: [PATCH] tools/setup.sh: let function quit to exit directly (may\n convenient for use); replace tab by space;\n\n---\n tools/setup.sh | 679 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 338 insertions(+), 341 deletions(-)",
    "diff": "diff --git a/tools/setup.sh b/tools/setup.sh\nindex 5a8b2f3..a43d16d 100755\n--- a/tools/setup.sh\n+++ b/tools/setup.sh\n@@ -50,11 +50,11 @@ echo \"--------------------------------------------------------------------------\n EAL_PARAMS='-n 4'\n \n #\n-# Sets QUIT variable so script will finish.\n+# finish script.\n #\n quit()\n {\n-\tQUIT=$1\n+    exit 0\n }\n \n #\n@@ -62,21 +62,21 @@ quit()\n #\n setup_icc()\n {\n-\tDEFAULT_PATH=/opt/intel/bin/iccvars.sh\n-\tparam=$1\n-\tshpath=`which iccvars.sh 2> /dev/null`\n-\tif [ $? -eq 0 ] ; then\n-\t\techo \"Loading iccvars.sh from $shpath for $param\"\n-\t\tsource $shpath $param\n-\telif [ -f $DEFAULT_PATH ] ; then\n-\t\techo \"Loading iccvars.sh from $DEFAULT_PATH for $param\"\n-\t\tsource $DEFAULT_PATH $param\n-\telse\n-\t\techo \"## ERROR: cannot find 'iccvars.sh' script to set up ICC.\"\n-\t\techo \"##     To fix, please add the directory that contains\"\n-\t\techo \"##     iccvars.sh  to your 'PATH' environment variable.\"\n-\t\tquit\n-\tfi\n+    DEFAULT_PATH=/opt/intel/bin/iccvars.sh\n+    param=$1\n+    shpath=`which iccvars.sh 2> /dev/null`\n+    if [ $? -eq 0 ] ; then\n+        echo \"Loading iccvars.sh from $shpath for $param\"\n+        source $shpath $param\n+    elif [ -f $DEFAULT_PATH ] ; then\n+        echo \"Loading iccvars.sh from $DEFAULT_PATH for $param\"\n+        source $DEFAULT_PATH $param\n+    else\n+        echo \"## ERROR: cannot find 'iccvars.sh' script to set up ICC.\"\n+        echo \"##     To fix, please add the directory that contains\"\n+        echo \"##     iccvars.sh  to your 'PATH' environment variable.\"\n+        quit\n+    fi\n }\n \n #\n@@ -84,24 +84,22 @@ setup_icc()\n #\n setup_target()\n {\n-\toption=$1\n-\texport RTE_TARGET=${TARGETS[option]}\n-\n-\tcompiler=${RTE_TARGET##*-}\n-\tif [ \"$compiler\" == \"icc\" ] ; then\n-\t\tplatform=${RTE_TARGET%%-*}\n-\t\tif [ \"$platform\" == \"x86_64\" ] ; then\n-\t\t\tsetup_icc intel64\n-\t\telse\n-\t\t\tsetup_icc ia32\n-\t\tfi\n-\tfi\n-\tif [ \"$QUIT\" == \"0\" ] ; then\n-\t\tmake install T=${RTE_TARGET}\n-\tfi\n-\techo \"------------------------------------------------------------------------------\"\n-\techo \" RTE_TARGET exported as $RTE_TARGET\"\n-\techo \"------------------------------------------------------------------------------\"\n+    option=$1\n+    export RTE_TARGET=${TARGETS[option]}\n+\n+    compiler=${RTE_TARGET##*-}\n+    if [ \"$compiler\" == \"icc\" ] ; then\n+        platform=${RTE_TARGET%%-*}\n+        if [ \"$platform\" == \"x86_64\" ] ; then\n+            setup_icc intel64\n+        else\n+            setup_icc ia32\n+        fi\n+    fi\n+    make install T=${RTE_TARGET}\n+    echo \"------------------------------------------------------------------------------\"\n+    echo \" RTE_TARGET exported as $RTE_TARGET\"\n+    echo \"------------------------------------------------------------------------------\"\n }\n \n #\n@@ -109,7 +107,7 @@ setup_target()\n #\n uninstall_targets()\n {\n-\tmake uninstall\n+    make uninstall\n }\n \n #\n@@ -117,13 +115,13 @@ uninstall_targets()\n #\n create_mnt_huge()\n {\n-\techo \"Creating /mnt/huge and mounting as hugetlbfs\"\n-\tsudo mkdir -p /mnt/huge\n+    echo \"Creating /mnt/huge and mounting as hugetlbfs\"\n+    sudo mkdir -p /mnt/huge\n \n-\tgrep -s '/mnt/huge' /proc/mounts > /dev/null\n-\tif [ $? -ne 0 ] ; then\n-\t\tsudo mount -t hugetlbfs nodev /mnt/huge\n-\tfi\n+    grep -s '/mnt/huge' /proc/mounts > /dev/null\n+    if [ $? -ne 0 ] ; then\n+        sudo mount -t hugetlbfs nodev /mnt/huge\n+    fi\n }\n \n #\n@@ -131,15 +129,15 @@ create_mnt_huge()\n #\n remove_mnt_huge()\n {\n-\techo \"Unmounting /mnt/huge and removing directory\"\n-\tgrep -s '/mnt/huge' /proc/mounts > /dev/null\n-\tif [ $? -eq 0 ] ; then\n-\t\tsudo umount /mnt/huge\n-\tfi\n-\n-\tif [ -d /mnt/huge ] ; then\n-\t\tsudo rm -R /mnt/huge\n-\tfi\n+    echo \"Unmounting /mnt/huge and removing directory\"\n+    grep -s '/mnt/huge' /proc/mounts > /dev/null\n+    if [ $? -eq 0 ] ; then\n+        sudo umount /mnt/huge\n+    fi\n+\n+    if [ -d /mnt/huge ] ; then\n+        sudo rm -R /mnt/huge\n+    fi\n }\n \n #\n@@ -147,11 +145,11 @@ remove_mnt_huge()\n #\n remove_igb_uio_module()\n {\n-\techo \"Unloading any existing DPDK UIO module\"\n-\t/sbin/lsmod | grep -s igb_uio > /dev/null\n-\tif [ $? -eq 0 ] ; then\n-\t\tsudo /sbin/rmmod igb_uio\n-\tfi\n+    echo \"Unloading any existing DPDK UIO module\"\n+    /sbin/lsmod | grep -s igb_uio > /dev/null\n+    if [ $? -eq 0 ] ; then\n+        sudo /sbin/rmmod igb_uio\n+    fi\n }\n \n #\n@@ -159,32 +157,32 @@ remove_igb_uio_module()\n #\n load_igb_uio_module()\n {\n-\tif [ ! -f $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko ];then\n-\t\techo \"## ERROR: Target does not have the DPDK UIO Kernel Module.\"\n-\t\techo \"       To fix, please try to rebuild target.\"\n-\t\treturn\n-\tfi\n-\n-\tremove_igb_uio_module\n-\n-\t/sbin/lsmod | grep -s uio > /dev/null\n-\tif [ $? -ne 0 ] ; then\n-\t\tmodinfo uio > /dev/null\n-\t\tif [ $? -eq 0 ]; then\n-\t\t\techo \"Loading uio module\"\n-\t\t\tsudo /sbin/modprobe uio\n-\t\tfi\n-\tfi\n-\n-\t# UIO may be compiled into kernel, so it may not be an error if it can't\n-\t# be loaded.\n-\n-\techo \"Loading DPDK UIO module\"\n-\tsudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko\n-\tif [ $? -ne 0 ] ; then\n-\t\techo \"## ERROR: Could not load kmod/igb_uio.ko.\"\n-\t\tquit\n-\tfi\n+    if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko ];then\n+        echo \"## ERROR: Target does not have the DPDK UIO Kernel Module.\"\n+        echo \"       To fix, please try to rebuild target.\"\n+        return\n+    fi\n+\n+    remove_igb_uio_module\n+\n+    /sbin/lsmod | grep -s uio > /dev/null\n+    if [ $? -ne 0 ] ; then\n+        modinfo uio > /dev/null\n+        if [ $? -eq 0 ]; then\n+            echo \"Loading uio module\"\n+            sudo /sbin/modprobe uio\n+        fi\n+    fi\n+\n+    # UIO may be compiled into kernel, so it may not be an error if it can't\n+    # be loaded.\n+\n+    echo \"Loading DPDK UIO module\"\n+    sudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko\n+    if [ $? -ne 0 ] ; then\n+        echo \"## ERROR: Could not load kmod/igb_uio.ko.\"\n+        quit\n+    fi\n }\n \n #\n@@ -192,13 +190,13 @@ load_igb_uio_module()\n #\n remove_vfio_module()\n {\n-\techo \"Unloading any existing VFIO module\"\n-\t/sbin/lsmod | grep -s vfio > /dev/null\n-\tif [ $? -eq 0 ] ; then\n-\t\tsudo /sbin/rmmod vfio-pci\n-\t\tsudo /sbin/rmmod vfio_iommu_type1\n-\t\tsudo /sbin/rmmod vfio\n-\tfi\n+    echo \"Unloading any existing VFIO module\"\n+    /sbin/lsmod | grep -s vfio > /dev/null\n+    if [ $? -eq 0 ] ; then\n+        sudo /sbin/rmmod vfio-pci\n+        sudo /sbin/rmmod vfio_iommu_type1\n+        sudo /sbin/rmmod vfio\n+    fi\n }\n \n #\n@@ -206,33 +204,33 @@ remove_vfio_module()\n #\n load_vfio_module()\n {\n-\tremove_vfio_module\n-\n-\tVFIO_PATH=\"kernel/drivers/vfio/pci/vfio-pci.ko\"\n-\n-\techo \"Loading VFIO module\"\n-\t/sbin/lsmod | grep -s vfio_pci > /dev/null\n-\tif [ $? -ne 0 ] ; then\n-\t\tif [ -f /lib/modules/$(uname -r)/$VFIO_PATH ] ; then\n-\t\t\tsudo /sbin/modprobe vfio-pci\n-\t\tfi\n-\tfi\n-\n-\t# make sure regular users can read /dev/vfio\n-\techo \"chmod /dev/vfio\"\n-\tsudo chmod a+x /dev/vfio\n-\tif [ $? -ne 0 ] ; then\n-\t\techo \"FAIL\"\n-\t\tquit\n-\tfi\n-\techo \"OK\"\n-\n-\t# check if /dev/vfio/vfio exists - that way we\n-\t# know we either loaded the module, or it was\n-\t# compiled into the kernel\n-\tif [ ! -e /dev/vfio/vfio ] ; then\n-\t\techo \"## ERROR: VFIO not found!\"\n-\tfi\n+    remove_vfio_module\n+\n+    VFIO_PATH=\"kernel/drivers/vfio/pci/vfio-pci.ko\"\n+\n+    echo \"Loading VFIO module\"\n+    /sbin/lsmod | grep -s vfio_pci > /dev/null\n+    if [ $? -ne 0 ] ; then\n+        if [ -f /lib/modules/$(uname -r)/$VFIO_PATH ] ; then\n+            sudo /sbin/modprobe vfio-pci\n+        fi\n+    fi\n+\n+    # make sure regular users can read /dev/vfio\n+    echo \"chmod /dev/vfio\"\n+    sudo chmod a+x /dev/vfio\n+    if [ $? -ne 0 ] ; then\n+        echo \"FAIL\"\n+        quit\n+    fi\n+    echo \"OK\"\n+\n+    # check if /dev/vfio/vfio exists - that way we\n+    # know we either loaded the module, or it was\n+    # compiled into the kernel\n+    if [ ! -e /dev/vfio/vfio ] ; then\n+        echo \"## ERROR: VFIO not found!\"\n+    fi\n }\n \n #\n@@ -240,11 +238,11 @@ load_vfio_module()\n #\n remove_kni_module()\n {\n-\techo \"Unloading any existing DPDK KNI module\"\n-\t/sbin/lsmod | grep -s rte_kni > /dev/null\n-\tif [ $? -eq 0 ] ; then\n-\t\tsudo /sbin/rmmod rte_kni\n-\tfi\n+    echo \"Unloading any existing DPDK KNI module\"\n+    /sbin/lsmod | grep -s rte_kni > /dev/null\n+    if [ $? -eq 0 ] ; then\n+        sudo /sbin/rmmod rte_kni\n+    fi\n }\n \n #\n@@ -253,22 +251,22 @@ remove_kni_module()\n load_kni_module()\n {\n     # Check that the KNI module is already built.\n-\tif [ ! -f $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko ];then\n-\t\techo \"## ERROR: Target does not have the DPDK KNI Module.\"\n-\t\techo \"       To fix, please try to rebuild target.\"\n-\t\treturn\n-\tfi\n+    if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko ];then\n+        echo \"## ERROR: Target does not have the DPDK KNI Module.\"\n+        echo \"       To fix, please try to rebuild target.\"\n+        return\n+    fi\n \n     # Unload existing version if present.\n-\tremove_kni_module\n+    remove_kni_module\n \n     # Now try load the KNI module.\n-\techo \"Loading DPDK KNI module\"\n-\tsudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko\n-\tif [ $? -ne 0 ] ; then\n-\t\techo \"## ERROR: Could not load kmod/rte_kni.ko.\"\n-\t\tquit\n-\tfi\n+    echo \"Loading DPDK KNI module\"\n+    sudo /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko\n+    if [ $? -ne 0 ] ; then\n+        echo \"## ERROR: Could not load kmod/rte_kni.ko.\"\n+        quit\n+    fi\n }\n \n #\n@@ -276,48 +274,48 @@ load_kni_module()\n #\n set_vfio_permissions()\n {\n-\t# make sure regular users can read /dev/vfio\n-\techo \"chmod /dev/vfio\"\n-\tsudo chmod a+x /dev/vfio\n-\tif [ $? -ne 0 ] ; then\n-\t\techo \"FAIL\"\n-\t\tquit\n-\tfi\n-\techo \"OK\"\n-\n-\t# make sure regular user can access everything inside /dev/vfio\n-\techo \"chmod /dev/vfio/*\"\n-\tsudo chmod 0666 /dev/vfio/*\n-\tif [ $? -ne 0 ] ; then\n-\t\techo \"FAIL\"\n-\t\tquit\n-\tfi\n-\techo \"OK\"\n-\n-\t# since permissions are only to be set when running as\n-\t# regular user, we only check ulimit here\n-\t#\n-\t# warn if regular user is only allowed\n-\t# to memlock <64M of memory\n-\tMEMLOCK_AMNT=`ulimit -l`\n-\n-\tif [ \"$MEMLOCK_AMNT\" != \"unlimited\" ] ; then\n-\t\tMEMLOCK_MB=`expr $MEMLOCK_AMNT / 1024`\n-\t\techo \"\"\n-\t\techo \"Current user memlock limit: ${MEMLOCK_MB} MB\"\n-\t\techo \"\"\n-\t\techo \"This is the maximum amount of memory you will be\"\n-\t\techo \"able to use with DPDK and VFIO if run as current user.\"\n-\t\techo -n \"To change this, please adjust limits.conf memlock \"\n-\t\techo \"limit for current user.\"\n-\n-\t\tif [ $MEMLOCK_AMNT -lt 65536 ] ; then\n-\t\t\techo \"\"\n-\t\t\techo \"## WARNING: memlock limit is less than 64MB\"\n-\t\t\techo -n \"## DPDK with VFIO may not be able to initialize \"\n-\t\t\techo \"if run as current user.\"\n-\t\tfi\n-\tfi\n+    # make sure regular users can read /dev/vfio\n+    echo \"chmod /dev/vfio\"\n+    sudo chmod a+x /dev/vfio\n+    if [ $? -ne 0 ] ; then\n+        echo \"FAIL\"\n+        quit\n+    fi\n+    echo \"OK\"\n+\n+    # make sure regular user can access everything inside /dev/vfio\n+    echo \"chmod /dev/vfio/*\"\n+    sudo chmod 0666 /dev/vfio/*\n+    if [ $? -ne 0 ] ; then\n+        echo \"FAIL\"\n+        quit\n+    fi\n+    echo \"OK\"\n+\n+    # since permissions are only to be set when running as\n+    # regular user, we only check ulimit here\n+    #\n+    # warn if regular user is only allowed\n+    # to memlock <64M of memory\n+    MEMLOCK_AMNT=`ulimit -l`\n+\n+    if [ \"$MEMLOCK_AMNT\" != \"unlimited\" ] ; then\n+        MEMLOCK_MB=`expr $MEMLOCK_AMNT / 1024`\n+        echo \"\"\n+        echo \"Current user memlock limit: ${MEMLOCK_MB} MB\"\n+        echo \"\"\n+        echo \"This is the maximum amount of memory you will be\"\n+        echo \"able to use with DPDK and VFIO if run as current user.\"\n+        echo -n \"To change this, please adjust limits.conf memlock \"\n+        echo \"limit for current user.\"\n+\n+        if [ $MEMLOCK_AMNT -lt 65536 ] ; then\n+            echo \"\"\n+            echo \"## WARNING: memlock limit is less than 64MB\"\n+            echo -n \"## DPDK with VFIO may not be able to initialize \"\n+            echo \"if run as current user.\"\n+        fi\n+    fi\n }\n \n #\n@@ -325,15 +323,15 @@ set_vfio_permissions()\n #\n clear_huge_pages()\n {\n-\techo > .echo_tmp\n-\tfor d in /sys/devices/system/node/node? ; do\n-\t\techo \"echo 0 > $d/hugepages/hugepages-2048kB/nr_hugepages\" >> .echo_tmp\n-\tdone\n-\techo \"Removing currently reserved hugepages\"\n-\tsudo sh .echo_tmp\n-\trm -f .echo_tmp\n-\n-\tremove_mnt_huge\n+    echo > .echo_tmp\n+    for d in /sys/devices/system/node/node? ; do\n+        echo \"echo 0 > $d/hugepages/hugepages-2048kB/nr_hugepages\" >> .echo_tmp\n+    done\n+    echo \"Removing currently reserved hugepages\"\n+    sudo sh .echo_tmp\n+    rm -f .echo_tmp\n+\n+    remove_mnt_huge\n }\n \n #\n@@ -341,22 +339,22 @@ clear_huge_pages()\n #\n set_non_numa_pages()\n {\n-\tclear_huge_pages\n+    clear_huge_pages\n \n-\techo \"\"\n-\techo \"  Input the number of 2MB pages\"\n-\techo \"  Example: to have 128MB of hugepages available, enter '64' to\"\n-\techo \"  reserve 64 * 2MB pages\"\n-\techo -n \"Number of pages: \"\n-\tread Pages\n+    echo \"\"\n+    echo \"  Input the number of 2MB pages\"\n+    echo \"  Example: to have 128MB of hugepages available, enter '64' to\"\n+    echo \"  reserve 64 * 2MB pages\"\n+    echo -n \"Number of pages: \"\n+    read Pages\n \n-\techo \"echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages\" > .echo_tmp\n+    echo \"echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages\" > .echo_tmp\n \n-\techo \"Reserving hugepages\"\n-\tsudo sh .echo_tmp\n-\trm -f .echo_tmp\n+    echo \"Reserving hugepages\"\n+    sudo sh .echo_tmp\n+    rm -f .echo_tmp\n \n-\tcreate_mnt_huge\n+    create_mnt_huge\n }\n \n #\n@@ -364,25 +362,25 @@ set_non_numa_pages()\n #\n set_numa_pages()\n {\n-\tclear_huge_pages\n-\n-\techo \"\"\n-\techo \"  Input the number of 2MB pages for each node\"\n-\techo \"  Example: to have 128MB of hugepages available per node,\"\n-\techo \"  enter '64' to reserve 64 * 2MB pages on each node\"\n-\n-\techo > .echo_tmp\n-\tfor d in /sys/devices/system/node/node? ; do\n-\t\tnode=$(basename $d)\n-\t\techo -n \"Number of pages for $node: \"\n-\t\tread Pages\n-\t\techo \"echo $Pages > $d/hugepages/hugepages-2048kB/nr_hugepages\" >> .echo_tmp\n-\tdone\n-\techo \"Reserving hugepages\"\n-\tsudo sh .echo_tmp\n-\trm -f .echo_tmp\n-\n-\tcreate_mnt_huge\n+    clear_huge_pages\n+\n+    echo \"\"\n+    echo \"  Input the number of 2MB pages for each node\"\n+    echo \"  Example: to have 128MB of hugepages available per node,\"\n+    echo \"  enter '64' to reserve 64 * 2MB pages on each node\"\n+\n+    echo > .echo_tmp\n+    for d in /sys/devices/system/node/node? ; do\n+        node=$(basename $d)\n+        echo -n \"Number of pages for $node: \"\n+        read Pages\n+        echo \"echo $Pages > $d/hugepages/hugepages-2048kB/nr_hugepages\" >> .echo_tmp\n+    done\n+    echo \"Reserving hugepages\"\n+    sudo sh .echo_tmp\n+    rm -f .echo_tmp\n+\n+    create_mnt_huge\n }\n \n #\n@@ -390,13 +388,13 @@ set_numa_pages()\n #\n run_test_app()\n {\n-\techo \"\"\n-\techo \"  Enter hex bitmask of cores to execute test app on\"\n-\techo \"  Example: to execute app on cores 0 to 7, enter 0xff\"\n-\techo -n \"bitmask: \"\n-\tread Bitmask\n-\techo \"Launching app\"\n-\tsudo ${RTE_TARGET}/app/test -c $Bitmask $EAL_PARAMS\n+    echo \"\"\n+    echo \"  Enter hex bitmask of cores to execute test app on\"\n+    echo \"  Example: to execute app on cores 0 to 7, enter 0xff\"\n+    echo -n \"bitmask: \"\n+    read Bitmask\n+    echo \"Launching app\"\n+    sudo ${RTE_TARGET}/app/test -c $Bitmask $EAL_PARAMS\n }\n \n #\n@@ -404,13 +402,13 @@ run_test_app()\n #\n run_testpmd_app()\n {\n-\techo \"\"\n-\techo \"  Enter hex bitmask of cores to execute testpmd app on\"\n-\techo \"  Example: to execute app on cores 0 to 7, enter 0xff\"\n-\techo -n \"bitmask: \"\n-\tread Bitmask\n-\techo \"Launching app\"\n-\tsudo ${RTE_TARGET}/app/testpmd -c $Bitmask $EAL_PARAMS -- -i\n+    echo \"\"\n+    echo \"  Enter hex bitmask of cores to execute testpmd app on\"\n+    echo \"  Example: to execute app on cores 0 to 7, enter 0xff\"\n+    echo -n \"bitmask: \"\n+    read Bitmask\n+    echo \"Launching app\"\n+    sudo ${RTE_TARGET}/app/testpmd -c $Bitmask $EAL_PARAMS -- -i\n }\n \n #\n@@ -418,7 +416,7 @@ run_testpmd_app()\n #\n grep_meminfo()\n {\n-\tgrep -i huge /proc/meminfo\n+    grep -i huge /proc/meminfo\n }\n \n #\n@@ -427,12 +425,12 @@ grep_meminfo()\n #\n show_nics()\n {\n-\tif  /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then\n-\t\t${RTE_SDK}/tools/dpdk_nic_bind.py --status\n-\telse\n-\t\techo \"# Please load the 'igb_uio' or 'vfio-pci' kernel module before \"\n-\t\techo \"# querying or adjusting NIC device bindings\"\n-\tfi\n+    if  /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then\n+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status\n+    else\n+        echo \"# Please load the 'igb_uio' or 'vfio-pci' kernel module before \"\n+        echo \"# querying or adjusting NIC device bindings\"\n+    fi\n }\n \n #\n@@ -440,17 +438,17 @@ show_nics()\n #\n bind_nics_to_vfio()\n {\n-\tif /sbin/lsmod  | grep -q vfio_pci ; then\n-\t\t${RTE_SDK}/tools/dpdk_nic_bind.py --status\n-\t\techo \"\"\n-\t\techo -n \"Enter PCI address of device to bind to VFIO driver: \"\n-\t\tread PCI_PATH\n-\t\tsudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b vfio-pci $PCI_PATH &&\n-\t\t\techo \"OK\"\n-\telse\n-\t\techo \"# Please load the 'vfio-pci' kernel module before querying or \"\n-\t\techo \"# adjusting NIC device bindings\"\n-\tfi\n+    if /sbin/lsmod  | grep -q vfio_pci ; then\n+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status\n+        echo \"\"\n+        echo -n \"Enter PCI address of device to bind to VFIO driver: \"\n+        read PCI_PATH\n+        sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b vfio-pci $PCI_PATH &&\n+            echo \"OK\"\n+    else\n+        echo \"# Please load the 'vfio-pci' kernel module before querying or \"\n+        echo \"# adjusting NIC device bindings\"\n+    fi\n }\n \n #\n@@ -458,16 +456,16 @@ bind_nics_to_vfio()\n #\n bind_nics_to_igb_uio()\n {\n-\tif  /sbin/lsmod  | grep -q igb_uio ; then\n-\t\t${RTE_SDK}/tools/dpdk_nic_bind.py --status\n-\t\techo \"\"\n-\t\techo -n \"Enter PCI address of device to bind to IGB UIO driver: \"\n-\t\tread PCI_PATH\n-\t\tsudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b igb_uio $PCI_PATH && echo \"OK\"\n-\telse\n-\t\techo \"# Please load the 'igb_uio' kernel module before querying or \"\n-\t\techo \"# adjusting NIC device bindings\"\n-\tfi\n+    if  /sbin/lsmod  | grep -q igb_uio ; then\n+        ${RTE_SDK}/tools/dpdk_nic_bind.py --status\n+        echo \"\"\n+        echo -n \"Enter PCI address of device to bind to IGB UIO driver: \"\n+        read PCI_PATH\n+        sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b igb_uio $PCI_PATH && echo \"OK\"\n+    else\n+        echo \"# Please load the 'igb_uio' kernel module before querying or \"\n+        echo \"# adjusting NIC device bindings\"\n+    fi\n }\n \n #\n@@ -475,14 +473,14 @@ bind_nics_to_igb_uio()\n #\n unbind_nics()\n {\n-\t${RTE_SDK}/tools/dpdk_nic_bind.py --status\n-\techo \"\"\n-\techo -n \"Enter PCI address of device to unbind: \"\n-\tread PCI_PATH\n-\techo \"\"\n-\techo -n \"Enter name of kernel driver to bind the device to: \"\n-\tread DRV\n-\tsudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b $DRV $PCI_PATH && echo \"OK\"\n+    ${RTE_SDK}/tools/dpdk_nic_bind.py --status\n+    echo \"\"\n+    echo -n \"Enter PCI address of device to unbind: \"\n+    read PCI_PATH\n+    echo \"\"\n+    echo -n \"Enter name of kernel driver to bind the device to: \"\n+    read DRV\n+    sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b $DRV $PCI_PATH && echo \"OK\"\n }\n \n #\n@@ -492,15 +490,15 @@ unbind_nics()\n #\n step1_func()\n {\n-\tTITLE=\"Select the DPDK environment to build\"\n-\tCONFIG_NUM=1\n-\tfor cfg in config/defconfig_* ; do\n-\t\tcfg=${cfg/config\\/defconfig_/}\n-\t\tTEXT[$CONFIG_NUM]=\"$cfg\"\n-\t\tTARGETS[$CONFIG_NUM]=$cfg\n-\t\tFUNC[$CONFIG_NUM]=\"setup_target\"\n-\t\tlet \"CONFIG_NUM+=1\"\n-\tdone\n+    TITLE=\"Select the DPDK environment to build\"\n+    CONFIG_NUM=1\n+    for cfg in config/defconfig_* ; do\n+        cfg=${cfg/config\\/defconfig_/}\n+        TEXT[$CONFIG_NUM]=\"$cfg\"\n+        TARGETS[$CONFIG_NUM]=$cfg\n+        FUNC[$CONFIG_NUM]=\"setup_target\"\n+        let \"CONFIG_NUM+=1\"\n+    done\n }\n \n #\n@@ -508,34 +506,34 @@ step1_func()\n #\n step2_func()\n {\n-\tTITLE=\"Setup linuxapp environment\"\n+    TITLE=\"Setup linuxapp environment\"\n \n-\tTEXT[1]=\"Insert IGB UIO module\"\n-\tFUNC[1]=\"load_igb_uio_module\"\n+    TEXT[1]=\"Insert IGB UIO module\"\n+    FUNC[1]=\"load_igb_uio_module\"\n \n-\tTEXT[2]=\"Insert VFIO module\"\n-\tFUNC[2]=\"load_vfio_module\"\n+    TEXT[2]=\"Insert VFIO module\"\n+    FUNC[2]=\"load_vfio_module\"\n \n-\tTEXT[3]=\"Insert KNI module\"\n-\tFUNC[3]=\"load_kni_module\"\n+    TEXT[3]=\"Insert KNI module\"\n+    FUNC[3]=\"load_kni_module\"\n \n-\tTEXT[4]=\"Setup hugepage mappings for non-NUMA systems\"\n-\tFUNC[4]=\"set_non_numa_pages\"\n+    TEXT[4]=\"Setup hugepage mappings for non-NUMA systems\"\n+    FUNC[4]=\"set_non_numa_pages\"\n \n-\tTEXT[5]=\"Setup hugepage mappings for NUMA systems\"\n-\tFUNC[5]=\"set_numa_pages\"\n+    TEXT[5]=\"Setup hugepage mappings for NUMA systems\"\n+    FUNC[5]=\"set_numa_pages\"\n \n-\tTEXT[6]=\"Display current Ethernet device settings\"\n-\tFUNC[6]=\"show_nics\"\n+    TEXT[6]=\"Display current Ethernet device settings\"\n+    FUNC[6]=\"show_nics\"\n \n-\tTEXT[7]=\"Bind Ethernet device to IGB UIO module\"\n-\tFUNC[7]=\"bind_nics_to_igb_uio\"\n+    TEXT[7]=\"Bind Ethernet device to IGB UIO module\"\n+    FUNC[7]=\"bind_nics_to_igb_uio\"\n \n-\tTEXT[8]=\"Bind Ethernet device to VFIO module\"\n-\tFUNC[8]=\"bind_nics_to_vfio\"\n+    TEXT[8]=\"Bind Ethernet device to VFIO module\"\n+    FUNC[8]=\"bind_nics_to_vfio\"\n \n-\tTEXT[9]=\"Setup VFIO permissions\"\n-\tFUNC[9]=\"set_vfio_permissions\"\n+    TEXT[9]=\"Setup VFIO permissions\"\n+    FUNC[9]=\"set_vfio_permissions\"\n }\n \n #\n@@ -543,13 +541,13 @@ step2_func()\n #\n step3_func()\n {\n-\tTITLE=\"Run test application for linuxapp environment\"\n+    TITLE=\"Run test application for linuxapp environment\"\n \n-\tTEXT[1]=\"Run test application (\\$RTE_TARGET/app/test)\"\n-\tFUNC[1]=\"run_test_app\"\n+    TEXT[1]=\"Run test application (\\$RTE_TARGET/app/test)\"\n+    FUNC[1]=\"run_test_app\"\n \n-\tTEXT[2]=\"Run testpmd application in interactive mode (\\$RTE_TARGET/app/testpmd)\"\n-\tFUNC[2]=\"run_testpmd_app\"\n+    TEXT[2]=\"Run testpmd application in interactive mode (\\$RTE_TARGET/app/testpmd)\"\n+    FUNC[2]=\"run_testpmd_app\"\n }\n \n #\n@@ -557,10 +555,10 @@ step3_func()\n #\n step4_func()\n {\n-\tTITLE=\"Other tools\"\n+    TITLE=\"Other tools\"\n \n-\tTEXT[1]=\"List hugepage info from /proc/meminfo\"\n-\tFUNC[1]=\"grep_meminfo\"\n+    TEXT[1]=\"List hugepage info from /proc/meminfo\"\n+    FUNC[1]=\"grep_meminfo\"\n \n }\n \n@@ -569,25 +567,25 @@ step4_func()\n #\n step5_func()\n {\n-\tTITLE=\"Uninstall and system cleanup\"\n+    TITLE=\"Uninstall and system cleanup\"\n \n-\tTEXT[1]=\"Uninstall all targets\"\n-\tFUNC[1]=\"uninstall_targets\"\n+    TEXT[1]=\"Uninstall all targets\"\n+    FUNC[1]=\"uninstall_targets\"\n \n-\tTEXT[2]=\"Unbind NICs from IGB UIO or VFIO driver\"\n-\tFUNC[2]=\"unbind_nics\"\n+    TEXT[2]=\"Unbind NICs from IGB UIO or VFIO driver\"\n+    FUNC[2]=\"unbind_nics\"\n \n-\tTEXT[3]=\"Remove IGB UIO module\"\n-\tFUNC[3]=\"remove_igb_uio_module\"\n+    TEXT[3]=\"Remove IGB UIO module\"\n+    FUNC[3]=\"remove_igb_uio_module\"\n \n-\tTEXT[4]=\"Remove VFIO module\"\n-\tFUNC[4]=\"remove_vfio_module\"\n+    TEXT[4]=\"Remove VFIO module\"\n+    FUNC[4]=\"remove_vfio_module\"\n \n-\tTEXT[5]=\"Remove KNI module\"\n-\tFUNC[5]=\"remove_kni_module\"\n+    TEXT[5]=\"Remove KNI module\"\n+    FUNC[5]=\"remove_kni_module\"\n \n-\tTEXT[6]=\"Remove hugepage mappings\"\n-\tFUNC[6]=\"clear_huge_pages\"\n+    TEXT[6]=\"Remove hugepage mappings\"\n+    FUNC[6]=\"clear_huge_pages\"\n }\n \n STEPS[1]=\"step1_func\"\n@@ -596,38 +594,37 @@ STEPS[3]=\"step3_func\"\n STEPS[4]=\"step4_func\"\n STEPS[5]=\"step5_func\"\n \n-QUIT=0\n \n-while [ \"$QUIT\" == \"0\" ]; do\n-\tOPTION_NUM=1\n+while true ; do\n+    OPTION_NUM=1\n \n-\tfor s in $(seq ${#STEPS[@]}) ; do\n-\t\t${STEPS[s]}\n+    for s in $(seq ${#STEPS[@]}) ; do\n+        ${STEPS[s]}\n \n-\t\techo \"----------------------------------------------------------\"\n-\t\techo \" Step $s: ${TITLE}\"\n-\t\techo \"----------------------------------------------------------\"\n+        echo \"----------------------------------------------------------\"\n+        echo \" Step $s: ${TITLE}\"\n+        echo \"----------------------------------------------------------\"\n \n-\t\tfor i in $(seq ${#TEXT[@]}) ; do\n-\t\t\techo \"[$OPTION_NUM] ${TEXT[i]}\"\n-\t\t\tOPTIONS[$OPTION_NUM]=${FUNC[i]}\n-\t\t\tlet \"OPTION_NUM+=1\"\n-\t\tdone\n+        for i in $(seq ${#TEXT[@]}) ; do\n+            echo \"[$OPTION_NUM] ${TEXT[i]}\"\n+            OPTIONS[$OPTION_NUM]=${FUNC[i]}\n+            let \"OPTION_NUM+=1\"\n+        done\n \n-\t\t# Clear TEXT and FUNC arrays before next step\n-\t\tunset TEXT\n-\t\tunset FUNC\n+        # Clear TEXT and FUNC arrays before next step\n+        unset TEXT\n+        unset FUNC\n \n-\t\techo \"\"\n-\tdone\n+        echo \"\"\n+    done\n \n-\techo \"[$OPTION_NUM] Exit Script\"\n-\tOPTIONS[$OPTION_NUM]=\"quit\"\n-\techo \"\"\n-\techo -n \"Option: \"\n-\tread our_entry\n-\techo \"\"\n-\t${OPTIONS[our_entry]} ${our_entry}\n-\techo\n-\techo -n \"Press enter to continue ...\"; read\n+    echo \"[$OPTION_NUM] Exit Script\"\n+    OPTIONS[$OPTION_NUM]=\"quit\"\n+    echo \"\"\n+    echo -n \"Option: \"\n+    read our_entry\n+    echo \"\"\n+    ${OPTIONS[our_entry]} ${our_entry}\n+    echo\n+    echo -n \"Press enter to continue ...\"; read\n done\n",
    "prefixes": [
        "dpdk-dev"
    ]
}