@@ -30,7 +30,29 @@ static LIST_HEAD(mirred_list);
30
30
static DEFINE_SPINLOCK (mirred_list_lock );
31
31
32
32
#define MIRRED_NEST_LIMIT 4
33
- static DEFINE_PER_CPU (unsigned int , mirred_nest_level ) ;
33
+
34
+ #ifndef CONFIG_PREEMPT_RT
35
+ static u8 tcf_mirred_nest_level_inc_return (void )
36
+ {
37
+ return __this_cpu_inc_return (softnet_data .xmit .sched_mirred_nest );
38
+ }
39
+
40
+ static void tcf_mirred_nest_level_dec (void )
41
+ {
42
+ __this_cpu_dec (softnet_data .xmit .sched_mirred_nest );
43
+ }
44
+
45
+ #else
46
+ static u8 tcf_mirred_nest_level_inc_return (void )
47
+ {
48
+ return current -> net_xmit .sched_mirred_nest ++ ;
49
+ }
50
+
51
+ static void tcf_mirred_nest_level_dec (void )
52
+ {
53
+ current -> net_xmit .sched_mirred_nest -- ;
54
+ }
55
+ #endif
34
56
35
57
static bool tcf_mirred_is_act_redirect (int action )
36
58
{
@@ -423,7 +445,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
423
445
int m_eaction ;
424
446
u32 blockid ;
425
447
426
- nest_level = __this_cpu_inc_return ( mirred_nest_level );
448
+ nest_level = tcf_mirred_nest_level_inc_return ( );
427
449
if (unlikely (nest_level > MIRRED_NEST_LIMIT )) {
428
450
net_warn_ratelimited ("Packet exceeded mirred recursion limit on dev %s\n" ,
429
451
netdev_name (skb -> dev ));
@@ -454,7 +476,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
454
476
retval );
455
477
456
478
dec_nest_level :
457
- __this_cpu_dec ( mirred_nest_level );
479
+ tcf_mirred_nest_level_dec ( );
458
480
459
481
return retval ;
460
482
}
0 commit comments