You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2013/07/24 13:27:08 UTC

git commit: updated refs/heads/4.2 to ce8a869

Updated Branches:
  refs/heads/4.2 8e30ee3f1 -> ce8a869a9


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/ce8a869a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ce8a869a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ce8a869a

Branch: refs/heads/4.2
Commit: ce8a869a924d572d3486ee296550217080e6434f
Parents: 8e30ee3
Author: Jayapal <ja...@apache.org>
Authored: Wed Jul 24 16:53:48 2013 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Wed Jul 24 16:55:36 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/ce8a869a/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/ce8a869a/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/ce8a869a/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}')