Lines Matching refs:gact

26 static int gact_net_rand(struct tcf_gact *gact)  in gact_net_rand()  argument
29 if (get_random_u32_below(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);
63 struct tcf_gact *gact; in tcf_gact_init() local
123 gact = to_gact(*a); in tcf_gact_init()
125 spin_lock_bh(&gact->tcf_lock); in tcf_gact_init()
129 gact->tcfg_paction = p_parm->paction; in tcf_gact_init()
130 gact->tcfg_pval = max_t(u16, 1, p_parm->pval); in tcf_gact_init()
135 gact->tcfg_ptype = p_parm->ptype; in tcf_gact_init()
138 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 tcf_action_update_bstats(&gact->common, skb); in tcf_gact_act()
166 tcf_action_inc_drop_qstats(&gact->common); 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()
189 struct tcf_gact *gact = to_gact(a); in tcf_gact_dump() local
191 .index = gact->tcf_index, in tcf_gact_dump()
192 .refcnt = refcount_read(&gact->tcf_refcnt) - ref, in tcf_gact_dump()
193 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind, in tcf_gact_dump()
197 spin_lock_bh(&gact->tcf_lock); in tcf_gact_dump()
198 opt.action = gact->tcf_action; in tcf_gact_dump()
202 if (gact->tcfg_ptype) { in tcf_gact_dump()
204 .paction = gact->tcfg_paction, in tcf_gact_dump()
205 .pval = gact->tcfg_pval, in tcf_gact_dump()
206 .ptype = gact->tcfg_ptype, in tcf_gact_dump()
213 tcf_tm_dump(&t, &gact->tcf_tm); in tcf_gact_dump()
216 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()
221 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()