Lines Matching refs:gact

26 static int gact_net_rand(struct tcf_gact *gact)  in gact_net_rand()  argument
29 if (prandom_u32() % gact->tcfg_pval) in gact_net_rand()
30 return gact->tcf_action; in gact_net_rand()
31 return gact->tcfg_paction; in gact_net_rand()
34 static int gact_determ(struct tcf_gact *gact) in gact_determ() argument
36 u32 pack = atomic_inc_return(&gact->packets); in gact_determ()
39 if (pack % gact->tcfg_pval) in gact_determ()
40 return gact->tcf_action; in gact_determ()
41 return gact->tcfg_paction; in gact_determ()
44 typedef int (*g_rand)(struct tcf_gact *gact);
62 struct tcf_gact *gact; in tcf_gact_init() local
122 gact = to_gact(*a); in tcf_gact_init()
124 spin_lock_bh(&gact->tcf_lock); in tcf_gact_init()
128 gact->tcfg_paction = p_parm->paction; in tcf_gact_init()
129 gact->tcfg_pval = max_t(u16, 1, p_parm->pval); in tcf_gact_init()
134 gact->tcfg_ptype = p_parm->ptype; in tcf_gact_init()
137 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_init()
153 struct tcf_gact *gact = to_gact(a); in tcf_gact_act() local
154 int action = READ_ONCE(gact->tcf_action); in tcf_gact_act()
158 u32 ptype = READ_ONCE(gact->tcfg_ptype); in tcf_gact_act()
161 action = gact_rand[ptype](gact); in tcf_gact_act()
164 bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), skb); in tcf_gact_act()
166 qstats_drop_inc(this_cpu_ptr(gact->common.cpu_qstats)); in tcf_gact_act()
168 tcf_lastuse_update(&gact->tcf_tm); in tcf_gact_act()
176 struct tcf_gact *gact = to_gact(a); in tcf_gact_stats_update() local
177 int action = READ_ONCE(gact->tcf_action); in tcf_gact_stats_update()
178 struct tcf_t *tm = &gact->tcf_tm; in tcf_gact_stats_update()
180 _bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), bytes, in tcf_gact_stats_update()
183 this_cpu_ptr(gact->common.cpu_qstats)->drops += packets; in tcf_gact_stats_update()
186 _bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats_hw), in tcf_gact_stats_update()
196 struct tcf_gact *gact = to_gact(a); in tcf_gact_dump() local
198 .index = gact->tcf_index, in tcf_gact_dump()
199 .refcnt = refcount_read(&gact->tcf_refcnt) - ref, in tcf_gact_dump()
200 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind, in tcf_gact_dump()
204 spin_lock_bh(&gact->tcf_lock); in tcf_gact_dump()
205 opt.action = gact->tcf_action; in tcf_gact_dump()
209 if (gact->tcfg_ptype) { in tcf_gact_dump()
211 .paction = gact->tcfg_paction, in tcf_gact_dump()
212 .pval = gact->tcfg_pval, in tcf_gact_dump()
213 .ptype = gact->tcfg_ptype, in tcf_gact_dump()
220 tcf_tm_dump(&t, &gact->tcf_tm); in tcf_gact_dump()
223 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()
228 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()