Skip to content

Commit

Permalink
updated systemd related scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
akoepsel committed May 20, 2017
1 parent 6c7c32c commit ad9bd2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 13 additions & 10 deletions tools/systemd/dpdk-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,31 @@ unbind_dpdk_devices()
create_sr_iov()
{
# create SR-IOV interfaces
j=0;
for HFACE in $SR_IOV_INTERFACES;
do
# get the interface name
IFACE=$(echo $HFACE | python -c "import sys; print sys.stdin.read().split(':')[0];")
# get the VLAN id
VLAN=$(echo $HFACE | python -c "import sys; print sys.stdin.read().split(':')[1];")
# get VLAN ids
#VLANS=$(echo $HFACE | python -c "import sys; ''.join([x for x in sys.stdin.read().split(':')[1].split(',')]);")
VLANS=$(echo $HFACE | python -c "import sys; print ''.join(['{} '.format(x) for x in sys.stdin.read().split(':')[1].split(',')]);")
# get the target interface name (eno1 => em0) wtf ????
JFACE=$(echo $IFACE | python -c "import sys; str=sys.stdin.read().split('eno'); print 'em'+str[1] if len(str) > 1 else str[0];")
# get number of SR-IOV VFs for this interface (one per vlan)
NUM_SRIOV=$(echo $VLANS | wc -w)

echo "echo $NUM_SRIOV > /sys/class/net/$IFACE/device/sriov_numvfs"
echo $NUM_SRIOV > /sys/class/net/$IFACE/device/sriov_numvfs
sleep 3
for i in $(seq 0 $((NUM_SRIOV-1)));
j=0
for VLAN in $VLANS;
do
HWADDR=$(ip link show ${JFACE}_${i} | grep "link/ether" | python -c "import sys; print sys.stdin.read().split()[1];")
echo "ip link set $IFACE vf $i mac $HWADDR"
ip link set $IFACE vf $i mac $HWADDR
echo "ip link set $IFACE vf $i vlan $(($VLAN+i))"
ip link set $IFACE vf $i vlan $(($VLAN+i))
HWADDR=$(ip link show ${JFACE}_${j} | grep "link/ether" | python -c "import sys; print sys.stdin.read().split()[1];")
echo "ip link set $IFACE vf $j mac $HWADDR"
ip link set $IFACE vf $j mac $HWADDR
echo "ip link set $IFACE vf $j vlan $VLAN"
ip link set $IFACE vf $j vlan $VLAN
((j++));
done
((j++));
done
}

Expand Down
4 changes: 1 addition & 3 deletions tools/systemd/etc_sysconfig_dpdk
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
NUM_SRIOV=6
SR_IOV_INTERFACES="eno1:100 eno2:200 p4p2:100 p6p2:200"
#DPDK_BIND_INTERFACES="0000:01:10.0 0000:01:10.1 0000:01:10.2 0000:01:10.3 0000:01:10.4 0000:01:10.5 0000:01:10.6 0000:01:10.7 0000:01:11.0 0000:01:11.1 0000:01:11.2 0000:01:11.3 0000:04:0a.0 0000:04:0a.1 0000:04:0a.2 0000:04:0a.3 0000:04:0a.4 0000:04:0a.5 0000:82:0a.0 0000:82:0a.1 0000:82:0a.2 0000:82:0a.3 0000:82:0a.4 0000:82:0a.5"
SR_IOV_INTERFACES="eno1:103,104,203,204 p4p2:101,102 p6p2:201,202"

0 comments on commit ad9bd2a

Please sign in to comment.