diff options
author | Gavin Li <gavinl@nvidia.com> | 2023-03-16 10:07:55 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-03-18 08:41:16 +0300 |
commit | c641e9279f3530aa2fe4bcb250477b555b75104a (patch) | |
tree | a22f5f36690cec705c9916fe6ddf8e02c5757882 /include/net/vxlan.h | |
parent | df5e87f16c338aa4f62ed3353e73e39e68af965e (diff) | |
download | linux-c641e9279f3530aa2fe4bcb250477b555b75104a.tar.xz |
vxlan: Expose helper vxlan_build_gbp_hdr
The function vxlan_build_gbp_hdr will be used by other modules to build
gbp option in vxlan header according to gbp flags.
Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Gavi Teitz <gavi@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Acked-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/vxlan.h')
-rw-r--r-- | include/net/vxlan.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index b7b2e9abfb37..20bd7d893e10 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -572,4 +572,23 @@ static inline bool vxlan_fdb_nh_path_select(struct nexthop *nh, return true; } +static inline void vxlan_build_gbp_hdr(struct vxlanhdr *vxh, const struct vxlan_metadata *md) +{ + struct vxlanhdr_gbp *gbp; + + if (!md->gbp) + return; + + gbp = (struct vxlanhdr_gbp *)vxh; + vxh->vx_flags |= VXLAN_HF_GBP; + + if (md->gbp & VXLAN_GBP_DONT_LEARN) + gbp->dont_learn = 1; + + if (md->gbp & VXLAN_GBP_POLICY_APPLIED) + gbp->policy_applied = 1; + + gbp->policy_id = htons(md->gbp & VXLAN_GBP_ID_MASK); +} + #endif |