2 ##############################################################################
3 # Copyright (c) 2017 ZTE corporation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
14 # Commandline arguments
15 DST_MAC=$1 # MAC address of the peer port
19 DPDK_VERSION="dpdk-17.02"
23 if lsmod | grep "uio" &> /dev/null ; then
24 echo "uio module is loaded"
29 if lsmod | grep "igb_uio" &> /dev/null ; then
30 echo "igb_uio module is loaded"
32 insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
35 if lsmod | grep "rte_kni" &> /dev/null ; then
36 echo "rte_kni module is loaded"
38 insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
44 chmod 777 /sys/bus/pci/drivers/virtio-pci/*
45 chmod 777 /sys/bus/pci/drivers/igb_uio/*
48 add_interface_to_dpdk(){
49 ip link set $ETH1 down
50 ip link set $ETH2 down
51 interfaces=$(lspci |grep Eth |tail -n +2 |awk '{print $1}')
52 /opt/tempT/$DPDK_VERSION/usertools//dpdk-devbind.py --bind=igb_uio $interfaces
57 blacklist=$(lspci |grep Eth |awk '{print $1}'|head -1)
58 cd /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/app
59 sudo ./testpmd -c 0x07 -n 4 -b $blacklist -- -a --eth-peer=1,$DST_MAC --forward-mode=mac