@@ -2082,19 +2082,12 @@ static const struct bpf_func_proto bpf_clone_redirect_proto = {
20822082 .arg3_type = ARG_ANYTHING ,
20832083};
20842084
2085- struct redirect_info {
2086- u32 ifindex ;
2087- u32 flags ;
2088- struct bpf_map * map ;
2089- struct bpf_map * map_to_flush ;
2090- unsigned long map_owner ;
2091- };
2092-
2093- static DEFINE_PER_CPU (struct redirect_info , redirect_info );
2085+ DEFINE_PER_CPU (struct bpf_redirect_info , bpf_redirect_info );
2086+ EXPORT_PER_CPU_SYMBOL_GPL (bpf_redirect_info );
20942087
20952088BPF_CALL_2 (bpf_redirect , u32 , ifindex , u64 , flags )
20962089{
2097- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
2090+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
20982091
20992092 if (unlikely (flags & ~(BPF_F_INGRESS )))
21002093 return TC_ACT_SHOT ;
@@ -2107,7 +2100,7 @@ BPF_CALL_2(bpf_redirect, u32, ifindex, u64, flags)
21072100
21082101int skb_do_redirect (struct sk_buff * skb )
21092102{
2110- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
2103+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
21112104 struct net_device * dev ;
21122105
21132106 dev = dev_get_by_index_rcu (dev_net (skb -> dev ), ri -> ifindex );
@@ -3200,7 +3193,7 @@ static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,
32003193
32013194void xdp_do_flush_map (void )
32023195{
3203- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3196+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
32043197 struct bpf_map * map = ri -> map_to_flush ;
32053198
32063199 ri -> map_to_flush = NULL ;
@@ -3245,7 +3238,7 @@ static inline bool xdp_map_invalid(const struct bpf_prog *xdp_prog,
32453238static int xdp_do_redirect_map (struct net_device * dev , struct xdp_buff * xdp ,
32463239 struct bpf_prog * xdp_prog )
32473240{
3248- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3241+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
32493242 unsigned long map_owner = ri -> map_owner ;
32503243 struct bpf_map * map = ri -> map ;
32513244 u32 index = ri -> ifindex ;
@@ -3285,7 +3278,7 @@ static int xdp_do_redirect_map(struct net_device *dev, struct xdp_buff *xdp,
32853278int xdp_do_redirect (struct net_device * dev , struct xdp_buff * xdp ,
32863279 struct bpf_prog * xdp_prog )
32873280{
3288- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3281+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
32893282 struct net_device * fwd ;
32903283 u32 index = ri -> ifindex ;
32913284 int err ;
@@ -3317,7 +3310,7 @@ static int xdp_do_generic_redirect_map(struct net_device *dev,
33173310 struct xdp_buff * xdp ,
33183311 struct bpf_prog * xdp_prog )
33193312{
3320- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3313+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
33213314 unsigned long map_owner = ri -> map_owner ;
33223315 struct bpf_map * map = ri -> map ;
33233316 u32 index = ri -> ifindex ;
@@ -3368,7 +3361,7 @@ static int xdp_do_generic_redirect_map(struct net_device *dev,
33683361int xdp_do_generic_redirect (struct net_device * dev , struct sk_buff * skb ,
33693362 struct xdp_buff * xdp , struct bpf_prog * xdp_prog )
33703363{
3371- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3364+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
33723365 u32 index = ri -> ifindex ;
33733366 struct net_device * fwd ;
33743367 int err = 0 ;
@@ -3399,7 +3392,7 @@ EXPORT_SYMBOL_GPL(xdp_do_generic_redirect);
33993392
34003393BPF_CALL_2 (bpf_xdp_redirect , u32 , ifindex , u64 , flags )
34013394{
3402- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3395+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
34033396
34043397 if (unlikely (flags ))
34053398 return XDP_ABORTED ;
@@ -3423,7 +3416,7 @@ static const struct bpf_func_proto bpf_xdp_redirect_proto = {
34233416BPF_CALL_4 (bpf_xdp_redirect_map , struct bpf_map * , map , u32 , ifindex , u64 , flags ,
34243417 unsigned long , map_owner )
34253418{
3426- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3419+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
34273420
34283421 if (unlikely (flags ))
34293422 return XDP_ABORTED ;
0 commit comments