doc: update sphinx installation instructions
[dpdk.git] / tools / setup.sh
index 5a8b2f3..6097ab7 100755 (executable)
@@ -44,6 +44,8 @@ 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).
 #
@@ -57,6 +59,12 @@ quit()
        QUIT=$1
 }
 
+# Shortcut for quit.
+q()
+{
+       quit
+}
+
 #
 # Sets up environmental variables for ICC.
 #
@@ -104,14 +112,6 @@ setup_target()
        echo "------------------------------------------------------------------------------"
 }
 
-#
-# Uninstall all targets.
-#
-uninstall_targets()
-{
-       make uninstall
-}
-
 #
 # Creates hugepage filesystem.
 #
@@ -327,7 +327,7 @@ 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
+               echo "echo 0 > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
        done
        echo "Removing currently reserved hugepages"
        sudo sh .echo_tmp
@@ -344,13 +344,13 @@ set_non_numa_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 "  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-2048kB/nr_hugepages" > .echo_tmp
+       echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
 
        echo "Reserving hugepages"
        sudo sh .echo_tmp
@@ -367,8 +367,8 @@ 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 "  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
@@ -376,7 +376,7 @@ set_numa_pages()
                node=$(basename $d)
                echo -n "Number of pages for $node: "
                read Pages
-               echo "echo $Pages > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp
+               echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
        done
        echo "Reserving hugepages"
        sudo sh .echo_tmp
@@ -427,7 +427,7 @@ grep_meminfo()
 #
 show_nics()
 {
-       if  /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then
+       if [ -d /sys/module/vfio_pci -o -d /sys/module/igb_uio ]; then
                ${RTE_SDK}/tools/dpdk_nic_bind.py --status
        else
                echo "# Please load the 'igb_uio' or 'vfio-pci' kernel module before "
@@ -440,7 +440,7 @@ show_nics()
 #
 bind_nics_to_vfio()
 {
-       if /sbin/lsmod  | grep -q vfio_pci ; then
+       if [ -d /sys/module/vfio_pci ]; then
                ${RTE_SDK}/tools/dpdk_nic_bind.py --status
                echo ""
                echo -n "Enter PCI address of device to bind to VFIO driver: "
@@ -458,7 +458,7 @@ bind_nics_to_vfio()
 #
 bind_nics_to_igb_uio()
 {
-       if  /sbin/lsmod  | grep -q igb_uio ; then
+       if [ -d /sys/module/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: "
@@ -571,23 +571,20 @@ step5_func()
 {
        TITLE="Uninstall and system cleanup"
 
-       TEXT[1]="Uninstall all targets"
-       FUNC[1]="uninstall_targets"
+       TEXT[1]="Unbind NICs from IGB UIO or VFIO driver"
+       FUNC[1]="unbind_nics"
 
-       TEXT[2]="Unbind NICs from IGB UIO or VFIO driver"
-       FUNC[2]="unbind_nics"
+       TEXT[2]="Remove IGB UIO module"
+       FUNC[2]="remove_igb_uio_module"
 
-       TEXT[3]="Remove IGB UIO module"
-       FUNC[3]="remove_igb_uio_module"
+       TEXT[3]="Remove VFIO module"
+       FUNC[3]="remove_vfio_module"
 
-       TEXT[4]="Remove VFIO module"
-       FUNC[4]="remove_vfio_module"
+       TEXT[4]="Remove KNI module"
+       FUNC[4]="remove_kni_module"
 
-       TEXT[5]="Remove KNI module"
-       FUNC[5]="remove_kni_module"
-
-       TEXT[6]="Remove hugepage mappings"
-       FUNC[6]="clear_huge_pages"
+       TEXT[5]="Remove hugepage mappings"
+       FUNC[5]="clear_huge_pages"
 }
 
 STEPS[1]="step1_func"
@@ -628,6 +625,10 @@ while [ "$QUIT" == "0" ]; do
        read our_entry
        echo ""
        ${OPTIONS[our_entry]} ${our_entry}
-       echo
-       echo -n "Press enter to continue ..."; read
+
+       if [ "$QUIT" == "0" ] ; then
+               echo
+               echo -n "Press enter to continue ..."; read
+       fi
+
 done