diff options
Diffstat (limited to 'nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local')
-rw-r--r-- | nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local deleted file mode 100644 index dddc787..0000000 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash - -touch /var/lock/subsys/local - -# Waiting for cloud-init to generate $TESTPMD_CONF, retry 60 seconds -NFVBENCH_CONF=/etc/nfvbenchvm.conf -retry=30 -until [ $retry -eq 0 ]; do - if [ -f $NFVBENCH_CONF ]; then break; fi - retry=$[$retry-1] - sleep 2 -done -if [ ! -f $NFVBENCH_CONF ]; then - exit 0 -fi - -# Parse and obtain all configurations -echo "Generating configurations for forwarder..." -eval $(cat $NFVBENCH_CONF) -touch /nfvbench_configured.flag -NICS=`lspci -D | grep Ethernet | cut -d' ' -f1 | xargs` -PCI_ADDRESS_1=`echo $NICS | awk '{ print $1 }'` -PCI_ADDRESS_2=`echo $NICS | awk '{ print $2 }'` -CPU_CORES=`grep -c ^processor /proc/cpuinfo` -CPU_MASKS=0x`echo "obase=16; 2 ^ $CPU_CORES - 1" | bc` -WORKER_CORES=`expr $CPU_CORES - 1` - -# CPU isolation optimizations -echo 1 > /sys/bus/workqueue/devices/writeback/cpumask -echo 1 > /sys/devices/virtual/workqueue/cpumask -echo 1 > /proc/irq/default_smp_affinity -for irq in `ls /proc/irq/`; do - echo 1 > /proc/irq/$irq/smp_affinity -done -tuna -c $(seq -s, 1 1 $WORKER_CORES) --isolate - -# Sometimes the interfaces on the loopback VM will use different drivers, e.g. -# one from vswitch which is virtio based, one is from SRIOV VF. In this case, -# we have to make sure the forwarder uses them in the right order, which is -# especially important if the VM is in a PVVP chain. -SWAP_FLAG=0 -if [ $INTF_MAC1 ] && [ $INTF_MAC2 ]; then - NET_PATH=/sys/class/net - EXP_INTF_1=$(for f in $(ls $NET_PATH/); do if grep -q "$INTF_MAC1" $NET_PATH/$f/address; then echo $f; break; fi; done) - EXP_PCI_ADDRESS_1=$(ethtool -i $EXP_INTF_1 | grep "bus-info" | awk -F' ' '{ print $2 }') - EXP_INTF_2=$(for f in $(ls $NET_PATH/); do if grep -q "$INTF_MAC2" $NET_PATH/$f/address; then echo $f; break; fi; done) - EXP_PCI_ADDRESS_2=$(ethtool -i $EXP_INTF_2 | grep "bus-info" | awk -F' ' '{ print $2 }') - if [ "$PCI_ADDRESS_1" == "$EXP_PCI_ADDRESS_2" ] && [ "$PCI_ADDRESS_2" == "$EXP_PCI_ADDRESS_1" ]; then - # Interfaces are not coming in the expected order: - # (1) Swap the traffic generator MAC in the case of testpmd; - # (2) Swap the interface configs in the case of VPP; - SWAP_FLAG=1 - fi -fi - -# 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..." - if [ $SWAP_FLAG -eq 1 ]; then - TEMP=$TG_MAC1; TG_MAC1=$TG_MAC2; TG_MAC2=$TEMP - fi - # Binding ports to DPDK - /dpdk/dpdk-devbind.py -b igb_uio $PCI_ADDRESS_1 - /dpdk/dpdk-devbind.py -b igb_uio $PCI_ADDRESS_2 - screen -dmSL testpmd /dpdk/testpmd \ - -c $CPU_MASKS \ - -n 4 \ - -- \ - --burst=32 \ - --txd=2048 \ - --rxd=2048 \ - --txqflags=0xf00 \ - --disable-hw-vlan \ - --eth-peer=0,$TG_MAC1 \ - --eth-peer=1,$TG_MAC2 \ - --forward-mode=mac \ - --nb-cores=$WORKER_CORES \ - --max-pkt-len=9000 \ - --cmdline-file=/dpdk/testpmd_cmd.txt -else - echo "Configuring vpp..." - cp /vpp/startup.conf /etc/vpp/startup.conf - cp /vpp/vm.conf /etc/vpp/vm.conf - - sed -i "s/{{PCI_ADDRESS_1}}/$PCI_ADDRESS_1/g" /etc/vpp/startup.conf - sed -i "s/{{PCI_ADDRESS_2}}/$PCI_ADDRESS_2/g" /etc/vpp/startup.conf - sed -i "s/{{WORKER_CORES}}/$WORKER_CORES/g" /etc/vpp/startup.conf - service vpp start - sleep 10 - - INTFS=`vppctl show int | grep Ethernet | xargs` - INTF_1=`echo $INTFS | awk '{ print $1 }'` - INTF_2=`echo $INTFS | awk '{ print $4 }'` - if [ $SWAP_FLAG -eq 1 ]; then - TEMP=$INTF_1; INTF_1=$INTF_2; INTF_2=$TEMP - fi - sed -i "s/{{INTF_1}}/${INTF_1//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{INTF_2}}/${INTF_2//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{VNF_GATEWAY1_CIDR}}/${VNF_GATEWAY1_CIDR//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{VNF_GATEWAY2_CIDR}}/${VNF_GATEWAY2_CIDR//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_MAC1}}/${TG_MAC1}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_MAC2}}/${TG_MAC2}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_NET1}}/${TG_NET1//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_NET2}}/${TG_NET2//\//\/}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_GATEWAY1_IP}}/${TG_GATEWAY1_IP}/g" /etc/vpp/vm.conf - sed -i "s/{{TG_GATEWAY2_IP}}/${TG_GATEWAY2_IP}/g" /etc/vpp/vm.conf - service vpp restart -fi |