From fdce0e46d9e72293d9adc0415c360592b77e7359 Mon Sep 17 00:00:00 2001
From: Roy Tang <rt7380@att.com>
Date: Sat, 25 Jan 2020 11:04:45 -0800
Subject: [PATCH] Add QOS support for neutron sriov

Change-Id: I5a1df5d7f6cf179e8cd26a288b5749340b8827dd
---
 neutron/templates/bin/_neutron-sriov-agent-init.sh.tpl | 7 +++++++
 neutron/values.yaml                                    | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/neutron/templates/bin/_neutron-sriov-agent-init.sh.tpl b/neutron/templates/bin/_neutron-sriov-agent-init.sh.tpl
index e86202f3ba..4677b0ecdc 100644
--- a/neutron/templates/bin/_neutron-sriov-agent-init.sh.tpl
+++ b/neutron/templates/bin/_neutron-sriov-agent-init.sh.tpl
@@ -43,6 +43,13 @@ else
   echo "${NUM_VFS}" > /sys/class/net/{{ $sriov.device }}/device/sriov_numvfs
 fi
 
+{{- if hasKey $sriov "qos" -}}
+{{- range $v, $qos := $sriov.qos }}
+echo "{{ $qos.share }}" > /sys/class/net/{{ $sriov.device }}/device/sriov/{{ $qos.vf_num }}/qos/share
+{{- end}}
+echo "1" > /sys/class/net/{{ $sriov.device }}/device/sriov/qos/apply
+{{- end }}
+
 {{- if $sriov.mtu }}
 ip link set dev {{ $sriov.device }} mtu {{ $sriov.mtu }}
 {{- end }}
diff --git a/neutron/values.yaml b/neutron/values.yaml
index 8dee9d4c52..f132b44376 100644
--- a/neutron/values.yaml
+++ b/neutron/values.yaml
@@ -108,7 +108,6 @@ network:
   # If tunnel is null there is a fallback mechanism to search
   # for interface with routing using tunnel network cidr.
     tunnel_network_cidr: "0/0"
-  sriov:
   # To perform setup of network interfaces using the SR-IOV init
   # container you can use a section similar to:
   # sriov:
@@ -116,6 +115,9 @@ network:
   #     num_vfs: 8
   #     mtu: 9214
   #     promisc: false
+  #     qos:
+  #       - vf_num: 0
+  #         share: 10
   server:
     ingress:
       public: true