diff mbox

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

Message ID 1478099309-3144-1-git-send-email-bschanmu@redhat.com
State Changes Requested
Headers show

Commit Message

Babu Shanmugam Nov. 2, 2016, 3:08 p.m. UTC
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@redhat.com>
---
 ovn/northd/ovn-northd.c | 8 +++++++-
 tests/ovn.at            | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 2, 2016, 3:51 p.m. UTC | #1
On Wed, Nov 02, 2016 at 08:38:29PM +0530, Babu Shanmugam wrote:
> 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@redhat.com>

I don't think this is really a bug fix, since the documentation for the
QoS table says "match" is an expression in the syntax for the OVN
expression language, and it doesn't say anything about the behavior for
an empty "match".

I suggest that anything that wants to apply a qos rule to every port
should use "1" as the match.
diff mbox

Patch

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