xref: /OK3568_Linux_fs/kernel/include/net/seg6_local.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  SR-IPv6 implementation
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *  Authors:
6*4882a593Smuzhiyun  *  David Lebrun <david.lebrun@uclouvain.be>
7*4882a593Smuzhiyun  *  eBPF support: Mathieu Xhonneux <m.xhonneux@gmail.com>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifndef _NET_SEG6_LOCAL_H
11*4882a593Smuzhiyun #define _NET_SEG6_LOCAL_H
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #include <linux/percpu.h>
14*4882a593Smuzhiyun #include <linux/net.h>
15*4882a593Smuzhiyun #include <linux/ipv6.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
18*4882a593Smuzhiyun 			       u32 tbl_id);
19*4882a593Smuzhiyun extern bool seg6_bpf_has_valid_srh(struct sk_buff *skb);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun struct seg6_bpf_srh_state {
22*4882a593Smuzhiyun 	struct ipv6_sr_hdr *srh;
23*4882a593Smuzhiyun 	u16 hdrlen;
24*4882a593Smuzhiyun 	bool valid;
25*4882a593Smuzhiyun };
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun DECLARE_PER_CPU(struct seg6_bpf_srh_state, seg6_bpf_srh_states);
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #endif
30