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);
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()
152 struct tcf_gact *gact = to_gact(a); in tcf_gact_act() local
153 int action = READ_ONCE(gact->tcf_action); in tcf_gact_act()
157 u32 ptype = READ_ONCE(gact->tcfg_ptype); in tcf_gact_act()
160 action = gact_rand[ptype](gact); in tcf_gact_act()
163 tcf_action_update_bstats(&gact->common, skb); in tcf_gact_act()
165 tcf_action_inc_drop_qstats(&gact->common); in tcf_gact_act()
167 tcf_lastuse_update(&gact->tcf_tm); in tcf_gact_act()
175 struct tcf_gact *gact = to_gact(a); in tcf_gact_stats_update() local
176 int action = READ_ONCE(gact->tcf_action); in tcf_gact_stats_update()
177 struct tcf_t *tm = &gact->tcf_tm; in tcf_gact_stats_update()
188 struct tcf_gact *gact = to_gact(a); in tcf_gact_dump() local
190 .index = gact->tcf_index, in tcf_gact_dump()
191 .refcnt = refcount_read(&gact->tcf_refcnt) - ref, in tcf_gact_dump()
192 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind, in tcf_gact_dump()
196 spin_lock_bh(&gact->tcf_lock); in tcf_gact_dump()
197 opt.action = gact->tcf_action; in tcf_gact_dump()
201 if (gact->tcfg_ptype) { in tcf_gact_dump()
203 .paction = gact->tcfg_paction, in tcf_gact_dump()
204 .pval = gact->tcfg_pval, in tcf_gact_dump()
205 .ptype = gact->tcfg_ptype, in tcf_gact_dump()
212 tcf_tm_dump(&t, &gact->tcf_tm); in tcf_gact_dump()
215 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()
220 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_dump()