summaryrefslogtreecommitdiffstats
path: root/scripts/trex-cfg
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/trex-cfg')
-rwxr-xr-xscripts/trex-cfg57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/trex-cfg b/scripts/trex-cfg
new file mode 100755
index 00000000..2aebf026
--- /dev/null
+++ b/scripts/trex-cfg
@@ -0,0 +1,57 @@
+#! /bin/bash
+SYS=`uname -r`
+if [ -f /etc/debian_version ]; then
+ OS=debian
+elif [ -f /etc/redhat-release ]; then
+ OS=redhat
+ systemctl stop firewalld.service
+else
+ OS=unknown
+fi
+
+
+if [ -d /mnt/huge ]; then
+ echo >> /dev/null
+else
+ echo "Create huge node"
+ mkdir -p /mnt/huge
+fi
+
+if ! mount | grep hugetlbfs >> /dev/null ; then
+ mount -t hugetlbfs nodev /mnt/huge
+fi
+
+
+for file in /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages ; do
+ if [ -e $file ] ; then
+ if [ "$(cat $file)" != "2048" ] ; then
+ echo 2048 > $file
+ fi
+ fi
+done
+
+if ! lsmod | grep -q igb_uio ; then
+ echo "Load the drivers for the first time "
+ modprobe uio
+ km=ko/$SYS/igb_uio.ko
+ if [ -e $km ] ; then
+ insmod $km
+ else
+ echo "ERROR kernel module is not supported for this OS"
+ echo "Please run the following commands: "
+ echo "\$cd ko/src "
+ echo "\$make "
+ echo "\$make install "
+ echo "\$cd - "
+ echo "and try to run it again "
+ exit 1
+ fi
+fi
+
+# try to bind the ports from the configuration file (new DPDK)
+PARENT_ARGS="$0 $@"
+if ! ./dpdk_setup_ports.py --parent "$PARENT_ARGS"; then
+ exit 1
+fi
+
+