Lines Matching refs:gact
29 static int gact_net_rand(struct tcf_gact *gact) in gact_net_rand() argument
32 if (prandom_u32() % gact->tcfg_pval) in gact_net_rand()
33 return gact->tcf_action; in gact_net_rand()
34 return gact->tcfg_paction; in gact_net_rand()
37 static int gact_determ(struct tcf_gact *gact) in gact_determ() argument
39 u32 pack = atomic_inc_return(&gact->packets); in gact_determ()
42 if (pack % gact->tcfg_pval) in gact_determ()
43 return gact->tcf_action; in gact_determ()
44 return gact->tcfg_paction; in gact_determ()
47 typedef int (*g_rand)(struct tcf_gact *gact);
62 struct tcf_gact *gact; in tcf_gact_init() local
92 ret = tcf_hash_create(parm->index, est, a, sizeof(*gact), in tcf_gact_init()
105 gact = to_gact(a); in tcf_gact_init()
108 gact->tcf_action = parm->action; in tcf_gact_init()
111 gact->tcfg_paction = p_parm->paction; in tcf_gact_init()
112 gact->tcfg_pval = max_t(u16, 1, p_parm->pval); in tcf_gact_init()
117 gact->tcfg_ptype = p_parm->ptype; in tcf_gact_init()
128 struct tcf_gact *gact = a->priv; in tcf_gact() local
129 int action = READ_ONCE(gact->tcf_action); in tcf_gact()
133 u32 ptype = READ_ONCE(gact->tcfg_ptype); in tcf_gact()
136 action = gact_rand[ptype](gact); in tcf_gact()
139 bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), skb); in tcf_gact()
141 qstats_drop_inc(this_cpu_ptr(gact->common.cpu_qstats)); in tcf_gact()
143 tcf_lastuse_update(&gact->tcf_tm); in tcf_gact()
151 struct tcf_gact *gact = a->priv; in tcf_gact_dump() local
153 .index = gact->tcf_index, in tcf_gact_dump()
154 .refcnt = gact->tcf_refcnt - ref, in tcf_gact_dump()
155 .bindcnt = gact->tcf_bindcnt - bind, in tcf_gact_dump()
156 .action = gact->tcf_action, in tcf_gact_dump()
163 if (gact->tcfg_ptype) { in tcf_gact_dump()
165 .paction = gact->tcfg_paction, in tcf_gact_dump()
166 .pval = gact->tcfg_pval, in tcf_gact_dump()
167 .ptype = gact->tcfg_ptype, in tcf_gact_dump()
174 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); in tcf_gact_dump()
175 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); in tcf_gact_dump()
176 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); in tcf_gact_dump()