aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-05-30 17:53:57 -0700
committerDavid S. Miller <davem@davemloft.net>2020-05-30 17:53:57 -0700
commit4300c7e7fe152be96b41b2135e3ace9a1e8db308 (patch)
tree6317281b4933c74b8716ed6e01dbf4d67d8f8a6d /include/net
parentMerge branch 'hns3-next' (diff)
parentnet/mlx5e: Make mlx5e_dcbnl_ops static (diff)
downloadlinux-dev-4300c7e7fe152be96b41b2135e3ace9a1e8db308.tar.xz
linux-dev-4300c7e7fe152be96b41b2135e3ace9a1e8db308.zip
Merge tag 'mlx5-cleanup-2020-05-29' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-cleanup-2020-05-29 Accumulated cleanup patches and sparse warning fixes for mlx5 driver. 1) sync with mlx5-next branch 2) Eli Cohen declares mpls_entry_encode() helper in mpls.h as suggested by Jakub Kicinski and David Ahern, and use it in mlx5 3) Jesper Fixes xdp data_meta setup in mlx5 4) Many sparse and build warnings cleanup ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/mpls.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/mpls.h b/include/net/mpls.h
index ccaf238e8ea7..0bb7944e7b08 100644
--- a/include/net/mpls.h
+++ b/include/net/mpls.h
@@ -8,6 +8,7 @@
#include <linux/if_ether.h>
#include <linux/netdevice.h>
+#include <linux/mpls.h>
#define MPLS_HLEN 4
@@ -25,4 +26,20 @@ static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
{
return (struct mpls_shim_hdr *)skb_network_header(skb);
}
+
+static inline struct mpls_shim_hdr mpls_entry_encode(u32 label,
+ unsigned int ttl,
+ unsigned int tc,
+ bool bos)
+{
+ struct mpls_shim_hdr result;
+
+ result.label_stack_entry =
+ cpu_to_be32((label << MPLS_LS_LABEL_SHIFT) |
+ (tc << MPLS_LS_TC_SHIFT) |
+ (bos ? (1 << MPLS_LS_S_SHIFT) : 0) |
+ (ttl << MPLS_LS_TTL_SHIFT));
+ return result;
+}
+
#endif