From: Gavin Li <[email protected]>

Extract vxlan gbp option encoding to odp_encode_gbp_raw to be used in
following commits.

Signed-off-by: Gavin Li <[email protected]>
Reviewed-by: Roi Dayan <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
---
 lib/odp-util.c | 2 +-
 lib/odp-util.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index f62dc86c5f9e..bf34c61fec58 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -3281,7 +3281,7 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl 
*tun_key,
 
         vxlan_opts_ofs = nl_msg_start_nested(a, 
OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS);
         nl_msg_put_u32(a, OVS_VXLAN_EXT_GBP,
-                       (tun_key->gbp_flags << 16) | ntohs(tun_key->gbp_id));
+                       odp_encode_gbp_raw(tun_key->gbp_flags, 
tun_key->gbp_id));
         nl_msg_end_nested(a, vxlan_opts_ofs);
     }
 
diff --git a/lib/odp-util.h b/lib/odp-util.h
index cf762bdc3547..163efe7a87b5 100644
--- a/lib/odp-util.h
+++ b/lib/odp-util.h
@@ -382,6 +382,11 @@ static inline void odp_decode_gbp_raw(uint32_t gbp_raw,
     *flags = (gbp_raw >> 16) & 0xFF;
 }
 
+static inline uint32_t odp_encode_gbp_raw(uint8_t flags, ovs_be16 id)
+{
+    return (flags << 16) | ntohs(id);
+}
+
 struct attr_len_tbl {
     int len;
     const struct attr_len_tbl *next;
-- 
2.38.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to