[ovs-dev] [PATCH] ovn: Fix QoS marking without match

Babu Shanmugam bschanmu at redhat.com
Wed Nov 2 15:08:29 UTC 2016


When a Logical_Switch's qos_rule does not have a match set, the rule should
apply for all the logical ports in that switch.

Signed-off-by: Babu Shanmugam <bschanmu at redhat.com>
---
 ovn/northd/ovn-northd.c | 8 +++++++-
 tests/ovn.at            | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 91affe4..512abb7 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -2644,12 +2644,18 @@ build_qos(struct ovn_datapath *od, struct hmap *lflows) {
 
         if (!strcmp(qos->key_action, "dscp")) {
             struct ds dscp_action = DS_EMPTY_INITIALIZER;
+            const char *match;
 
+            if (!strcmp(qos->match, "")) {
+                match = "1";
+            } else {
+                match = qos->match;
+            }
             ds_put_format(&dscp_action, "ip.dscp = %d; next;",
                           (uint8_t)qos->value_action);
             ovn_lflow_add(lflows, od, stage,
                           qos->priority,
-                          qos->match, ds_cstr(&dscp_action));
+                          match, ds_cstr(&dscp_action));
             ds_destroy(&dscp_action);
         }
     }
diff --git a/tests/ovn.at b/tests/ovn.at
index cb3e7dd..24dd12f 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -5459,6 +5459,10 @@ check_tos 63
 ovn-nbctl --wait=hv clear Logical_Switch lsw0 qos_rules
 check_tos 0
 
+# without match, packets from all all logical port should be marked
+qos_id=$(ovn-nbctl --wait=hv -- --id=@lp1-qos create QoS priority=100 action=dscp=48 direction="from-lport" -- set Logical_Switch lsw0 qos_rules=@lp1-qos)
+check_tos 48
+
 OVN_CLEANUP([hv])
 AT_CLEANUP
 
-- 
1.9.1




More information about the dev mailing list