diff mbox

[ovs-dev,2/2] ofproto-dpif-xlate: Tidy up ct_mark xlate code.

Message ID 1460745365-29259-2-git-send-email-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer April 15, 2016, 6:36 p.m. UTC
Make the ct_mark netlink serialization more consistent with the way that
ct_label is serialized.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 ofproto/ofproto-dpif-xlate.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Comments

Ben Pfaff April 22, 2016, 3:40 p.m. UTC | #1
On Fri, Apr 15, 2016 at 11:36:05AM -0700, Joe Stringer wrote:
> Make the ct_mark netlink serialization more consistent with the way that
> ct_label is serialized.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>

This is nice, I noticed and wondered about the inconsistency while
reviewing the previous patch.

Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer April 22, 2016, 10:50 p.m. UTC | #2
On 22 April 2016 at 08:40, Ben Pfaff <blp@ovn.org> wrote:
> On Fri, Apr 15, 2016 at 11:36:05AM -0700, Joe Stringer wrote:
>> Make the ct_mark netlink serialization more consistent with the way that
>> ct_label is serialized.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
> This is nice, I noticed and wondered about the inconsistency while
> reviewing the previous patch.
>
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks for the review, applied to master.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 2d0d76912cc3..7a201bde1fd2 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -4285,17 +4285,16 @@  static void
 put_ct_mark(const struct flow *flow, struct ofpbuf *odp_actions,
             struct flow_wildcards *wc)
 {
-    struct {
-        uint32_t key;
-        uint32_t mask;
-    } odp_attr;
-
-    odp_attr.key = flow->ct_mark & wc->masks.ct_mark;
-    odp_attr.mask = wc->masks.ct_mark;
-
-    if (odp_attr.mask) {
-        nl_msg_put_unspec(odp_actions, OVS_CT_ATTR_MARK, &odp_attr,
-                          sizeof(odp_attr));
+    if (wc->masks.ct_mark) {
+        struct {
+            uint32_t key;
+            uint32_t mask;
+        } *odp_ct_mark;
+
+        odp_ct_mark = nl_msg_put_unspec_uninit(odp_actions, OVS_CT_ATTR_MARK,
+                                               sizeof(*odp_ct_mark));
+        odp_ct_mark->key = flow->ct_mark & wc->masks.ct_mark;
+        odp_ct_mark->mask = wc->masks.ct_mark;
     }
 }