nfvbenchvm: set mgmt interface MTU=1500 by default
[nfvbench.git] / nfvbenchvm / dib / elements / nfvbenchvm / static / etc / rc.d / rc.local.loopvm
index a83e7ba..608c2c7 100644 (file)
@@ -137,6 +137,24 @@ if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then
     else
         ETH_PORT="eth0"
     fi
+
+    # By default, configure the MTU of the management interface to the
+    # conservative value of 1500: this will reduce the risk to get an
+    # unmanageable VM in some setups.
+    #
+    # To set the MTU to a different value, configure the INTF_MGMT_MTU variable
+    # in /etc/nfvbenchvm.conf.  If INTF_MGMT_MTU is set to the special value
+    # "auto", the MTU will not be configured and it will keep the value set by
+    # the hypervisor ("legacy" nfvbenchvm behavior).  If INTF_MGMT_MTU is unset,
+    # the MTU will be set to 1500.  In other cases, the MTU will be set to the
+    # value of INTF_MGMT_MTU.
+    #
+    if [[ -z "$INTF_MGMT_MTU" ]]; then
+        ip link set $ETH_PORT mtu 1500
+    elif [[ "$INTF_MGMT_MTU" != "auto" ]]; then
+        ip link set $ETH_PORT mtu $INTF_MGMT_MTU
+    fi
+
     ip addr add $INTF_MGMT_CIDR dev $ETH_PORT
     ip link set $ETH_PORT up
     ip route add default via $INTF_MGMT_IP_GW dev $ETH_PORT
@@ -167,17 +185,17 @@ fi
 if [ $PCI_ADDRESS_1 ] && [ $PCI_ADDRESS_2 ]; then
     logger "NFVBENCHVM: Using pci $PCI_ADDRESS_1 ($INTF_MAC1)"
     logger "NFVBENCHVM: Using pci $PCI_ADDRESS_2 ($INTF_MAC2)"
+    # active uio_pci_generic driver
+    modprobe uio_pci_generic
     # Configure the forwarder
-    if [ -z "`lsmod | grep igb_uio`" ]; then
-        modprobe uio
-        insmod /dpdk/igb_uio.ko
-    fi
     if [ "$FORWARDER" == "testpmd" ]; then
         echo "Configuring testpmd..."
-        # Binding ports to DPDK
-        dpdk-devbind -b igb_uio $PCI_ADDRESS_1
-        dpdk-devbind -b igb_uio $PCI_ADDRESS_2
-        screen -dmSL testpmd /dpdk/testpmd \
+        mkdir /dpdk
+        echo "set promisc all off" > /dpdk/testpmd_cmd.txt
+        # Binding ports to DPDK VFIO or UIO
+        dpdk-devbind -b vfio-pci $PCI_ADDRESS_1 || dpdk-devbind -b uio_pci_generic $PCI_ADDRESS_1
+        dpdk-devbind -b vfio-pci $PCI_ADDRESS_2 || dpdk-devbind -b uio_pci_generic $PCI_ADDRESS_2
+        screen -dmSL testpmd testpmd \
                             -c $CORE_MASK \
                             -n 4 \
                             -- \
@@ -244,4 +262,4 @@ else
     logger "NFVBENCHVM ERROR: Cannot find PCI Address from MAC"
 fi
 
-exit 0
\ No newline at end of file
+exit 0