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_LWTUNNEL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __NET_LWTUNNEL_H 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/lwtunnel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <net/route.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define LWTUNNEL_HASH_BITS   7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define LWTUNNEL_HASH_SIZE   (1 << LWTUNNEL_HASH_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) /* lw tunnel state flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define LWTUNNEL_STATE_OUTPUT_REDIRECT	BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define LWTUNNEL_STATE_INPUT_REDIRECT	BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define LWTUNNEL_STATE_XMIT_REDIRECT	BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	LWTUNNEL_XMIT_DONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	LWTUNNEL_XMIT_CONTINUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) struct lwtunnel_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	__u16		type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	__u16		flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	__u16		headroom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	atomic_t	refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	int		(*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	int		(*orig_input)(struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct		rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	__u8            data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) struct lwtunnel_encap_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	int (*build_state)(struct net *net, struct nlattr *encap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 			   unsigned int family, const void *cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 			   struct lwtunnel_state **ts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			   struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	void (*destroy_state)(struct lwtunnel_state *lws);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	int (*input)(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	int (*fill_encap)(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			  struct lwtunnel_state *lwtstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	int (*get_encap_size)(struct lwtunnel_state *lwtstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	int (*cmp_encap)(struct lwtunnel_state *a, struct lwtunnel_state *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	int (*xmit)(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #ifdef CONFIG_LWTUNNEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) void lwtstate_free(struct lwtunnel_state *lws);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static inline struct lwtunnel_state *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) lwtstate_get(struct lwtunnel_state *lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		atomic_inc(&lws->refcnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	return lws;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static inline void lwtstate_put(struct lwtunnel_state *lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	if (!lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	if (atomic_dec_and_test(&lws->refcnt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		lwtstate_free(lws);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) static inline bool lwtunnel_output_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	if (lwtstate && (lwtstate->flags & LWTUNNEL_STATE_OUTPUT_REDIRECT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static inline bool lwtunnel_input_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	if (lwtstate && (lwtstate->flags & LWTUNNEL_STATE_INPUT_REDIRECT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	return false;
^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) static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	if (lwtstate && (lwtstate->flags & LWTUNNEL_STATE_XMIT_REDIRECT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 					     unsigned int mtu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if ((lwtunnel_xmit_redirect(lwtstate) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	     lwtunnel_output_redirect(lwtstate)) && lwtstate->headroom < mtu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		return lwtstate->headroom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) int lwtunnel_encap_add_ops(const struct lwtunnel_encap_ops *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			   unsigned int num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			   unsigned int num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int lwtunnel_valid_encap_type(u16 encap_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			      struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				   struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int lwtunnel_build_state(struct net *net, u16 encap_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			 struct nlattr *encap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			 unsigned int family, const void *cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			 struct lwtunnel_state **lws,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			 struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int lwtunnel_fill_encap(struct sk_buff *skb, struct lwtunnel_state *lwtstate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			int encap_attr, int encap_type_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int lwtunnel_input(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int lwtunnel_xmit(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			  bool ingress);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static inline void lwtunnel_set_redirect(struct dst_entry *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	if (lwtunnel_output_redirect(dst->lwtstate)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		dst->lwtstate->orig_output = dst->output;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		dst->output = lwtunnel_output;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	if (lwtunnel_input_redirect(dst->lwtstate)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		dst->lwtstate->orig_input = dst->input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		dst->input = lwtunnel_input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static inline void lwtstate_free(struct lwtunnel_state *lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static inline struct lwtunnel_state *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) lwtstate_get(struct lwtunnel_state *lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return lws;
^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 void lwtstate_put(struct lwtunnel_state *lws)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static inline bool lwtunnel_output_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static inline bool lwtunnel_input_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static inline void lwtunnel_set_redirect(struct dst_entry *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 					     unsigned int mtu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static inline int lwtunnel_encap_add_ops(const struct lwtunnel_encap_ops *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 					 unsigned int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static inline int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 					 unsigned int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline int lwtunnel_valid_encap_type(u16 encap_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 					    struct netlink_ext_ack *extack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	NL_SET_ERR_MSG(extack, "CONFIG_LWTUNNEL is not enabled in this kernel");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static inline int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 						 struct netlink_ext_ack *extack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	/* return 0 since we are not walking attr looking for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	 * RTA_ENCAP_TYPE attribute on nexthops.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static inline int lwtunnel_build_state(struct net *net, u16 encap_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 				       struct nlattr *encap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 				       unsigned int family, const void *cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 				       struct lwtunnel_state **lws,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 				       struct netlink_ext_ack *extack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static inline int lwtunnel_fill_encap(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 				      struct lwtunnel_state *lwtstate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 				      int encap_attr, int encap_type_attr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static inline int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) static inline struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static inline int lwtunnel_cmp_encap(struct lwtunnel_state *a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 				     struct lwtunnel_state *b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) static inline int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static inline int lwtunnel_input(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) static inline int lwtunnel_xmit(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #endif /* CONFIG_LWTUNNEL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #define MODULE_ALIAS_RTNL_LWT(encap_type) MODULE_ALIAS("rtnl-lwt-" __stringify(encap_type))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #endif /* __NET_LWTUNNEL_H */