Lines Matching defs:gact

26 static int gact_net_rand(struct tcf_gact *gact)
29 if (prandom_u32() % gact->tcfg_pval)
30 return gact->tcf_action;
31 return gact->tcfg_paction;
34 static int gact_determ(struct tcf_gact *gact)
36 u32 pack = atomic_inc_return(&gact->packets);
39 if (pack % gact->tcfg_pval)
40 return gact->tcf_action;
41 return gact->tcfg_paction;
44 typedef int (*g_rand)(struct tcf_gact *gact);
63 struct tcf_gact *gact;
123 gact = to_gact(*a);
125 spin_lock_bh(&gact->tcf_lock);
129 gact->tcfg_paction = p_parm->paction;
130 gact->tcfg_pval = max_t(u16, 1, p_parm->pval);
135 gact->tcfg_ptype = p_parm->ptype;
138 spin_unlock_bh(&gact->tcf_lock);
152 struct tcf_gact *gact = to_gact(a);
153 int action = READ_ONCE(gact->tcf_action);
157 u32 ptype = READ_ONCE(gact->tcfg_ptype);
160 action = gact_rand[ptype](gact);
163 tcf_action_update_bstats(&gact->common, skb);
165 tcf_action_inc_drop_qstats(&gact->common);
167 tcf_lastuse_update(&gact->tcf_tm);
175 struct tcf_gact *gact = to_gact(a);
176 int action = READ_ONCE(gact->tcf_action);
177 struct tcf_t *tm = &gact->tcf_tm;
188 struct tcf_gact *gact = to_gact(a);
190 .index = gact->tcf_index,
191 .refcnt = refcount_read(&gact->tcf_refcnt) - ref,
192 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind,
196 spin_lock_bh(&gact->tcf_lock);
197 opt.action = gact->tcf_action;
201 if (gact->tcfg_ptype) {
203 .paction = gact->tcfg_paction,
204 .pval = gact->tcfg_pval,
205 .ptype = gact->tcfg_ptype,
212 tcf_tm_dump(&t, &gact->tcf_tm);
215 spin_unlock_bh(&gact->tcf_lock);
220 spin_unlock_bh(&gact->tcf_lock);
256 .kind = "gact",