Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Gavin Li and committed by
Jakub Kicinski
c641e927 df5e87f1

+19 -19
-19
drivers/net/vxlan/vxlan_core.c
··· 2093 2093 return false; 2094 2094 } 2095 2095 2096 - static void vxlan_build_gbp_hdr(struct vxlanhdr *vxh, struct vxlan_metadata *md) 2097 - { 2098 - struct vxlanhdr_gbp *gbp; 2099 - 2100 - if (!md->gbp) 2101 - return; 2102 - 2103 - gbp = (struct vxlanhdr_gbp *)vxh; 2104 - vxh->vx_flags |= VXLAN_HF_GBP; 2105 - 2106 - if (md->gbp & VXLAN_GBP_DONT_LEARN) 2107 - gbp->dont_learn = 1; 2108 - 2109 - if (md->gbp & VXLAN_GBP_POLICY_APPLIED) 2110 - gbp->policy_applied = 1; 2111 - 2112 - gbp->policy_id = htons(md->gbp & VXLAN_GBP_ID_MASK); 2113 - } 2114 - 2115 2096 static int vxlan_build_gpe_hdr(struct vxlanhdr *vxh, __be16 protocol) 2116 2097 { 2117 2098 struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)vxh;
+19
include/net/vxlan.h
··· 572 572 return true; 573 573 } 574 574 575 + static inline void vxlan_build_gbp_hdr(struct vxlanhdr *vxh, const struct vxlan_metadata *md) 576 + { 577 + struct vxlanhdr_gbp *gbp; 578 + 579 + if (!md->gbp) 580 + return; 581 + 582 + gbp = (struct vxlanhdr_gbp *)vxh; 583 + vxh->vx_flags |= VXLAN_HF_GBP; 584 + 585 + if (md->gbp & VXLAN_GBP_DONT_LEARN) 586 + gbp->dont_learn = 1; 587 + 588 + if (md->gbp & VXLAN_GBP_POLICY_APPLIED) 589 + gbp->policy_applied = 1; 590 + 591 + gbp->policy_id = htons(md->gbp & VXLAN_GBP_ID_MASK); 592 + } 593 + 575 594 #endif