diff mbox

[ovs-dev,6/6] nx-match: Add nxm_put_128m() function.

Message ID 1447208184-66714-6-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit Nov. 11, 2015, 2:16 a.m. UTC
From: Justin Pettit <jpettit@nicira.com>

This allows us to remove nxm_put_ct_label() with something more general.
It will also have other callers later.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
---
 lib/nx-match.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

Comments

Ben Pfaff Nov. 23, 2015, 6:07 p.m. UTC | #1
On Tue, Nov 10, 2015 at 06:16:24PM -0800, Justin Pettit wrote:
> From: Justin Pettit <jpettit@nicira.com>
> 
> This allows us to remove nxm_put_ct_label() with something more general.
> It will also have other callers later.
> 
> Signed-off-by: Justin Pettit <jpettit@nicira.com>

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox

Patch

diff --git a/lib/nx-match.c b/lib/nx-match.c
index f98b710..34c6139 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -754,6 +754,14 @@  nxm_put_64m(struct ofpbuf *b, enum mf_field_id field, enum ofp_version version,
 }
 
 static void
+nxm_put_128m(struct ofpbuf *b,
+             enum mf_field_id field, enum ofp_version version,
+             const ovs_be128 value, const ovs_be128 mask)
+{
+    nxm_put(b, field, version, &value, &mask, sizeof(value));
+}
+
+static void
 nxm_put_eth_masked(struct ofpbuf *b,
                    enum mf_field_id field, enum ofp_version version,
                    const struct eth_addr value, const struct eth_addr mask)
@@ -781,16 +789,6 @@  nxm_put_frag(struct ofpbuf *b, const struct match *match,
                nw_frag_mask == FLOW_NW_FRAG_MASK ? UINT8_MAX : nw_frag_mask);
 }
 
-static void
-nxm_put_ct_label(struct ofpbuf *b,
-                 enum mf_field_id field, enum ofp_version version,
-                 const ovs_u128 value, const ovs_u128 mask)
-{
-    ovs_be128 bevalue = hton128(value);
-    ovs_be128 bemask = hton128(mask);
-    nxm_put(b, field, version, &bevalue, &bemask, sizeof(bevalue));
-}
-
 /* Appends to 'b' a set of OXM or NXM matches for the IPv4 or IPv6 fields in
  * 'match'.  */
 static void
@@ -1053,8 +1051,8 @@  nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
                 htons(match->wc.masks.ct_zone));
     nxm_put_32m(b, MFF_CT_MARK, oxm, htonl(flow->ct_mark),
                 htonl(match->wc.masks.ct_mark));
-    nxm_put_ct_label(b, MFF_CT_LABEL, oxm, flow->ct_label,
-                     match->wc.masks.ct_label);
+    nxm_put_128m(b, MFF_CT_LABEL, oxm, hton128(flow->ct_label),
+                 hton128(match->wc.masks.ct_label));
 
     /* OpenFlow 1.1+ Metadata. */
     nxm_put_64m(b, MFF_METADATA, oxm,