Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __NET_DST_METADATA_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __NET_DST_METADATA_H 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <net/ip_tunnels.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <net/dst.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) enum metadata_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	METADATA_IP_TUNNEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	METADATA_HW_PORT_MUX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct hw_port_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	struct net_device *lower_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	u32 port_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct metadata_dst {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	struct dst_entry		dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	enum metadata_type		type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 		struct ip_tunnel_info	tun_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		struct hw_port_info	port_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	} u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static inline struct metadata_dst *skb_metadata_dst(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	struct metadata_dst *md_dst = (struct metadata_dst *) skb_dst(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	if (md_dst && md_dst->dst.flags & DST_METADATA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		return md_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static inline struct ip_tunnel_info *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) skb_tunnel_info(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	struct metadata_dst *md_dst = skb_metadata_dst(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct dst_entry *dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	if (md_dst && md_dst->type == METADATA_IP_TUNNEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		return &md_dst->u.tun_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	dst = skb_dst(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (dst && dst->lwtstate &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	    (dst->lwtstate->type == LWTUNNEL_ENCAP_IP ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	     dst->lwtstate->type == LWTUNNEL_ENCAP_IP6))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		return lwt_tun_info(dst->lwtstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static inline bool skb_valid_dst(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct dst_entry *dst = skb_dst(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	return dst && !(dst->flags & DST_METADATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 				       const struct sk_buff *skb_b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	const struct metadata_dst *a, *b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	if (!(skb_a->_skb_refdst | skb_b->_skb_refdst))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	a = (const struct metadata_dst *) skb_dst(skb_a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	b = (const struct metadata_dst *) skb_dst(skb_b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	if (!a != !b || a->type != b->type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	switch (a->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	case METADATA_HW_PORT_MUX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		return memcmp(&a->u.port_info, &b->u.port_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			      sizeof(a->u.port_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	case METADATA_IP_TUNNEL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		return memcmp(&a->u.tun_info, &b->u.tun_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			      sizeof(a->u.tun_info) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 					 a->u.tun_info.options_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void metadata_dst_free(struct metadata_dst *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) struct metadata_dst *metadata_dst_alloc(u8 optslen, enum metadata_type type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 					gfp_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) void metadata_dst_free_percpu(struct metadata_dst __percpu *md_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) struct metadata_dst __percpu *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) metadata_dst_alloc_percpu(u8 optslen, enum metadata_type type, gfp_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline struct metadata_dst *tun_rx_dst(int md_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	struct metadata_dst *tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	tun_dst = metadata_dst_alloc(md_size, METADATA_IP_TUNNEL, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	if (!tun_dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	tun_dst->u.tun_info.options_len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	tun_dst->u.tun_info.mode = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	return tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	struct metadata_dst *md_dst = skb_metadata_dst(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	int md_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	struct metadata_dst *new_md;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	if (!md_dst || md_dst->type != METADATA_IP_TUNNEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		return ERR_PTR(-EINVAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	md_size = md_dst->u.tun_info.options_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	new_md = metadata_dst_alloc(md_size, METADATA_IP_TUNNEL, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	if (!new_md)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		return ERR_PTR(-ENOMEM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	memcpy(&new_md->u.tun_info, &md_dst->u.tun_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	       sizeof(struct ip_tunnel_info) + md_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #ifdef CONFIG_DST_CACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	/* Unclone the dst cache if there is one */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	if (new_md->u.tun_info.dst_cache.cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		ret = dst_cache_init(&new_md->u.tun_info.dst_cache, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			metadata_dst_free(new_md);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			return ERR_PTR(ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	skb_dst_drop(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	skb_dst_set(skb, &new_md->dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	return new_md;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) static inline struct ip_tunnel_info *skb_tunnel_info_unclone(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	struct metadata_dst *dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	dst = tun_dst_unclone(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	if (IS_ERR(dst))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return &dst->u.tun_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 						    __be32 daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 						    __u8 tos, __u8 ttl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 						    __be16 tp_dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 						    __be16 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 						    __be64 tunnel_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 						    int md_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	struct metadata_dst *tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	tun_dst = tun_rx_dst(md_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	if (!tun_dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	ip_tunnel_key_init(&tun_dst->u.tun_info.key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			   saddr, daddr, tos, ttl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			   0, 0, tp_dst, tunnel_id, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	return tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 						 __be16 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 						 __be64 tunnel_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 						 int md_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	const struct iphdr *iph = ip_hdr(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	return __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				0, flags, tunnel_id, md_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *saddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 						      const struct in6_addr *daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 						      __u8 tos, __u8 ttl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 						      __be16 tp_dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 						      __be32 label,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 						      __be16 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 						      __be64 tunnel_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 						      int md_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	struct metadata_dst *tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct ip_tunnel_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	tun_dst = tun_rx_dst(md_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	if (!tun_dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	info = &tun_dst->u.tun_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	info->mode = IP_TUNNEL_INFO_IPV6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	info->key.tun_flags = flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	info->key.tun_id = tunnel_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	info->key.tp_src = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	info->key.tp_dst = tp_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	info->key.u.ipv6.src = *saddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	info->key.u.ipv6.dst = *daddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	info->key.tos = tos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	info->key.ttl = ttl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	info->key.label = label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	return tun_dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 						   __be16 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 						   __be64 tunnel_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 						   int md_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	const struct ipv6hdr *ip6h = ipv6_hdr(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return __ipv6_tun_set_dst(&ip6h->saddr, &ip6h->daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 				  ipv6_get_dsfield(ip6h), ip6h->hop_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 				  0, ip6_flowlabel(ip6h), flags, tunnel_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				  md_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #endif /* __NET_DST_METADATA_H */