@@ -2082,19 +2082,12 @@ static const struct bpf_func_proto bpf_clone_redirect_proto = {
2082
2082
.arg3_type = ARG_ANYTHING ,
2083
2083
};
2084
2084
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 );
2094
2087
2095
2088
BPF_CALL_2 (bpf_redirect , u32 , ifindex , u64 , flags )
2096
2089
{
2097
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
2090
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
2098
2091
2099
2092
if (unlikely (flags & ~(BPF_F_INGRESS )))
2100
2093
return TC_ACT_SHOT ;
@@ -2107,7 +2100,7 @@ BPF_CALL_2(bpf_redirect, u32, ifindex, u64, flags)
2107
2100
2108
2101
int skb_do_redirect (struct sk_buff * skb )
2109
2102
{
2110
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
2103
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
2111
2104
struct net_device * dev ;
2112
2105
2113
2106
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,
3200
3193
3201
3194
void xdp_do_flush_map (void )
3202
3195
{
3203
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3196
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3204
3197
struct bpf_map * map = ri -> map_to_flush ;
3205
3198
3206
3199
ri -> map_to_flush = NULL ;
@@ -3245,7 +3238,7 @@ static inline bool xdp_map_invalid(const struct bpf_prog *xdp_prog,
3245
3238
static int xdp_do_redirect_map (struct net_device * dev , struct xdp_buff * xdp ,
3246
3239
struct bpf_prog * xdp_prog )
3247
3240
{
3248
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3241
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3249
3242
unsigned long map_owner = ri -> map_owner ;
3250
3243
struct bpf_map * map = ri -> map ;
3251
3244
u32 index = ri -> ifindex ;
@@ -3285,7 +3278,7 @@ static int xdp_do_redirect_map(struct net_device *dev, struct xdp_buff *xdp,
3285
3278
int xdp_do_redirect (struct net_device * dev , struct xdp_buff * xdp ,
3286
3279
struct bpf_prog * xdp_prog )
3287
3280
{
3288
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3281
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3289
3282
struct net_device * fwd ;
3290
3283
u32 index = ri -> ifindex ;
3291
3284
int err ;
@@ -3317,7 +3310,7 @@ static int xdp_do_generic_redirect_map(struct net_device *dev,
3317
3310
struct xdp_buff * xdp ,
3318
3311
struct bpf_prog * xdp_prog )
3319
3312
{
3320
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3313
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3321
3314
unsigned long map_owner = ri -> map_owner ;
3322
3315
struct bpf_map * map = ri -> map ;
3323
3316
u32 index = ri -> ifindex ;
@@ -3368,7 +3361,7 @@ static int xdp_do_generic_redirect_map(struct net_device *dev,
3368
3361
int xdp_do_generic_redirect (struct net_device * dev , struct sk_buff * skb ,
3369
3362
struct xdp_buff * xdp , struct bpf_prog * xdp_prog )
3370
3363
{
3371
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3364
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3372
3365
u32 index = ri -> ifindex ;
3373
3366
struct net_device * fwd ;
3374
3367
int err = 0 ;
@@ -3399,7 +3392,7 @@ EXPORT_SYMBOL_GPL(xdp_do_generic_redirect);
3399
3392
3400
3393
BPF_CALL_2 (bpf_xdp_redirect , u32 , ifindex , u64 , flags )
3401
3394
{
3402
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3395
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3403
3396
3404
3397
if (unlikely (flags ))
3405
3398
return XDP_ABORTED ;
@@ -3423,7 +3416,7 @@ static const struct bpf_func_proto bpf_xdp_redirect_proto = {
3423
3416
BPF_CALL_4 (bpf_xdp_redirect_map , struct bpf_map * , map , u32 , ifindex , u64 , flags ,
3424
3417
unsigned long , map_owner )
3425
3418
{
3426
- struct redirect_info * ri = this_cpu_ptr (& redirect_info );
3419
+ struct bpf_redirect_info * ri = this_cpu_ptr (& bpf_redirect_info );
3427
3420
3428
3421
if (unlikely (flags ))
3429
3422
return XDP_ABORTED ;
0 commit comments