Lines Matching refs:d
40 struct tcf_defact *d = a->priv; in tcf_simp() local
42 spin_lock(&d->tcf_lock); in tcf_simp()
43 d->tcf_tm.lastuse = jiffies; in tcf_simp()
44 d->tcf_bstats.bytes += qdisc_pkt_len(skb); in tcf_simp()
45 d->tcf_bstats.packets++; in tcf_simp()
52 (char *)d->tcfd_defdata, d->tcf_bstats.packets); in tcf_simp()
53 spin_unlock(&d->tcf_lock); in tcf_simp()
54 return d->tcf_action; in tcf_simp()
57 static int tcf_simp_release(struct tcf_defact *d, int bind) in tcf_simp_release() argument
60 if (d) { in tcf_simp_release()
62 d->tcf_bindcnt--; in tcf_simp_release()
63 d->tcf_refcnt--; in tcf_simp_release()
64 if (d->tcf_bindcnt <= 0 && d->tcf_refcnt <= 0) { in tcf_simp_release()
65 kfree(d->tcfd_defdata); in tcf_simp_release()
66 tcf_hash_destroy(&d->common, &simp_hash_info); in tcf_simp_release()
73 static int alloc_defdata(struct tcf_defact *d, char *defdata) in alloc_defdata() argument
75 d->tcfd_defdata = kstrndup(defdata, SIMP_MAX_DATA, GFP_KERNEL); in alloc_defdata()
76 if (unlikely(!d->tcfd_defdata)) in alloc_defdata()
82 static void reset_policy(struct tcf_defact *d, char *defdata, in reset_policy() argument
85 spin_lock_bh(&d->tcf_lock); in reset_policy()
86 d->tcf_action = p->action; in reset_policy()
87 memset(d->tcfd_defdata, 0, SIMP_MAX_DATA); in reset_policy()
88 strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA); in reset_policy()
89 spin_unlock_bh(&d->tcf_lock); in reset_policy()
102 struct tcf_defact *d; in tcf_simp_init() local
125 pc = tcf_hash_create(parm->index, est, a, sizeof(*d), bind, in tcf_simp_init()
130 d = to_defact(pc); in tcf_simp_init()
131 ret = alloc_defdata(d, defdata); in tcf_simp_init()
136 d->tcf_action = parm->action; in tcf_simp_init()
139 d = to_defact(pc); in tcf_simp_init()
141 tcf_simp_release(d, bind); in tcf_simp_init()
144 reset_policy(d, defdata, parm); in tcf_simp_init()
154 struct tcf_defact *d = a->priv; in tcf_simp_cleanup() local
156 if (d) in tcf_simp_cleanup()
157 return tcf_simp_release(d, bind); in tcf_simp_cleanup()
165 struct tcf_defact *d = a->priv; in tcf_simp_dump() local
169 opt.index = d->tcf_index; in tcf_simp_dump()
170 opt.refcnt = d->tcf_refcnt - ref; in tcf_simp_dump()
171 opt.bindcnt = d->tcf_bindcnt - bind; in tcf_simp_dump()
172 opt.action = d->tcf_action; in tcf_simp_dump()
174 NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); in tcf_simp_dump()
175 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); in tcf_simp_dump()
176 t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); in tcf_simp_dump()
177 t.expires = jiffies_to_clock_t(d->tcf_tm.expires); in tcf_simp_dump()