Lines Matching refs:gact
29 static int gact_net_rand(struct tcf_gact *gact) in gact_net_rand() argument
31 if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval) in gact_net_rand()
32 return gact->tcf_action; in gact_net_rand()
33 return gact->tcfg_paction; in gact_net_rand()
36 static int gact_determ(struct tcf_gact *gact) in gact_determ() argument
38 if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval) in gact_determ()
39 return gact->tcf_action; in gact_determ()
40 return gact->tcfg_paction; in gact_determ()
43 typedef int (*g_rand)(struct tcf_gact *gact);
58 struct tcf_gact *gact; in tcf_gact_init() local
88 ret = tcf_hash_create(parm->index, est, a, sizeof(*gact), bind); in tcf_gact_init()
100 gact = to_gact(a); in tcf_gact_init()
102 spin_lock_bh(&gact->tcf_lock); in tcf_gact_init()
103 gact->tcf_action = parm->action; in tcf_gact_init()
106 gact->tcfg_paction = p_parm->paction; in tcf_gact_init()
107 gact->tcfg_pval = p_parm->pval; in tcf_gact_init()
108 gact->tcfg_ptype = p_parm->ptype; in tcf_gact_init()
111 spin_unlock_bh(&gact->tcf_lock); in tcf_gact_init()
120 struct tcf_gact *gact = a->priv; in tcf_gact() local
123 spin_lock(&gact->tcf_lock); in tcf_gact()
125 if (gact->tcfg_ptype) in tcf_gact()
126 action = gact_rand[gact->tcfg_ptype](gact); in tcf_gact()
128 action = gact->tcf_action; in tcf_gact()
130 action = gact->tcf_action; in tcf_gact()
132 gact->tcf_bstats.bytes += qdisc_pkt_len(skb); in tcf_gact()
133 gact->tcf_bstats.packets++; in tcf_gact()
135 gact->tcf_qstats.drops++; in tcf_gact()
136 gact->tcf_tm.lastuse = jiffies; in tcf_gact()
137 spin_unlock(&gact->tcf_lock); in tcf_gact()
145 struct tcf_gact *gact = a->priv; in tcf_gact_dump() local
147 .index = gact->tcf_index, in tcf_gact_dump()
148 .refcnt = gact->tcf_refcnt - ref, in tcf_gact_dump()
149 .bindcnt = gact->tcf_bindcnt - bind, in tcf_gact_dump()
150 .action = gact->tcf_action, in tcf_gact_dump()
157 if (gact->tcfg_ptype) { in tcf_gact_dump()
159 .paction = gact->tcfg_paction, in tcf_gact_dump()
160 .pval = gact->tcfg_pval, in tcf_gact_dump()
161 .ptype = gact->tcfg_ptype, in tcf_gact_dump()
168 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); in tcf_gact_dump()
169 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); in tcf_gact_dump()
170 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); in tcf_gact_dump()