Updated Branches: refs/heads/master b8a38ca7b -> 5dd111640
CLOUDSTACK-3623 Enabled rps, rfs on vpc VR Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5dd11164 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5dd11164 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5dd11164 Branch: refs/heads/master Commit: 5dd11164027f0d8fb471825efebf353c704caba7 Parents: b8a38ca Author: Jayapal <[email protected]> Authored: Wed Jul 24 16:53:48 2013 +0530 Committer: Jayapal <[email protected]> Committed: Wed Jul 24 16:56:09 2013 +0530 ---------------------------------------------------------------------- .../debian/config/etc/init.d/cloud-early-config | 15 ++++++- .../debian/config/opt/cloud/bin/vpc_guestnw.sh | 44 +++++++++++++++++++ .../debian/config/opt/cloud/bin/vpc_ipassoc.sh | 45 ++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5dd11164/patches/systemvm/debian/config/etc/init.d/cloud-early-config ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index c04ff90..168c012 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -366,6 +366,18 @@ disable_hvc() { [ -d /proc/xen ] && sed -i 's/^#vc/vc/' /etc/inittab && telinit q } +enable_vpc_rpsrfs() { + local enable=$1 + if [ $eanble -eq 0] + then + echo 0 > /etc/rpsrfsenable + else + echo 1 > /etc/rpsrfsenable + fi + + return 0 +} + enable_rpsrfs() { local enable=$1 @@ -400,7 +412,7 @@ enable_rpsrfs() { echo $hex > /sys/class/net/eth0/queues/rx-0/rps_cpus echo $hex > /sys/class/net/eth2/queues/rx-0/rps_cpus - #enble rps + #enble rfs echo 256 > /proc/sys/net/core/rps_sock_flow_entries echo 256 > /sys/class/net/eth0/queues/rx-0/rps_flow_cnt echo 256 > /sys/class/net/eth2/queues/rx-0/rps_flow_cnt @@ -848,6 +860,7 @@ EOF enable_svc dnsmasq 1 enable_svc haproxy 1 enable_irqbalance 1 + enable_vpc_rpsrfs 1 enable_svc cloud 0 disable_rpfilter enable_fwding 1 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5dd11164/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh index 3100345..e5da2e0 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh @@ -159,6 +159,50 @@ create_guest_network() { setup_dnsmasq setup_apache2 setup_passwdsvcs + + #enable rps, rfs + enable_rpsrfs $dev +} + +enable_rpsrfs() { + + if [ -f /etc/rpsrfsenable ] + then + enable=$(cat /etc/rpsrfsenable) + if [ $enable -eq 0 ] + then + return 0 + fi + else + return 0 + fi + + proc=$(cat /proc/cpuinfo | grep "processor" | wc -l) + if [ $proc -le 1 ] + then + return 0 + fi + dev=$1 + + num=1 + num=$(($num<<$proc)) + num=$(($num-1)); + echo $num; + hex=$(printf "%x\n" $num) + echo $hex; + #enable rps + echo $hex > /sys/class/net/$dev/queues/rx-0/rps_cpus + + #enble rfs + rps_flow_entries=$(cat /proc/sys/net/core/rps_sock_flow_entries) + + if [ $rps_flow_entries -eq 0 ] + then + echo 256 > /proc/sys/net/core/rps_sock_flow_entries + fi + + echo 256 > /sys/class/net/$dev/queues/rx-0/rps_flow_cnt + } destroy_guest_network() { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5dd11164/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh index a5b0239..8c5e0e4 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh @@ -85,10 +85,55 @@ add_an_ip () { then sudo iptables -t mangle -A PREROUTING -i $ethDev -m state --state NEW -j CONNMARK --set-mark $tableNo 2>/dev/null fi + + enable_rpsrfs $ethDev add_routing return $? } +enable_rpsrfs() { + + if [ -f /etc/rpsrfsenable ] + then + enable=$(cat /etc/rpsrfsenable) + if [ $enable -eq 0 ] + then + return 0 + fi + else + return 0 + fi + + proc=$(cat /proc/cpuinfo | grep "processor" | wc -l) + if [ $proc -le 1 ] + then + return 0 + fi + dev=$1 + + num=1 + num=$(($num<<$proc)) + num=$(($num-1)); + echo $num; + hex=$(printf "%x\n" $num) + echo $hex; + #enable rps + echo $hex > /sys/class/net/$dev/queues/rx-0/rps_cpus + + #enble rfs + rps_flow_entries=$(cat /proc/sys/net/core/rps_sock_flow_entries) + + if [ $rps_flow_entries -eq 0 ] + then + echo 256 > /proc/sys/net/core/rps_sock_flow_entries + fi + + if [ $(cat /sys/class/net/$dev/queues/rx-0/rps_flow_cnt) -eq 0 ] + then + echo 256 > /sys/class/net/$dev/queues/rx-0/rps_flow_cnt + fi +} + remove_an_ip () { logger -t cloud "$(basename $0):Removing ip $pubIp on interface $ethDev" local existingIpMask=$(sudo ip addr show dev $ethDev | grep -v "inet6" | grep "inet " | awk '{print $2}')
