diff mbox series

[ovs-dev,v2,3/7] odp-util: Extract vxlan gbp option encoding to a function

Message ID 20230425124122.2443376-4-roid@nvidia.com
State Changes Requested
Headers show
Series Add vxlan gbp offload with TC | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Roi Dayan April 25, 2023, 12:41 p.m. UTC
From: Gavin Li <gavinl@nvidia.com>

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

Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
---
 lib/odp-util.c | 2 +-
 lib/odp-util.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Horman May 10, 2023, 3:19 p.m. UTC | #1
On Tue, Apr 25, 2023 at 03:41:18PM +0300, Roi Dayan via dev wrote:
> From: Gavin Li <gavinl@nvidia.com>
> 
> Extract vxlan gbp option encoding to odp_encode_gbp_raw to be used in
> following commits.
> 
> Signed-off-by: Gavin Li <gavinl@nvidia.com>
> Reviewed-by: Roi Dayan <roid@nvidia.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff mbox series

Patch

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;