20 #include <linux/module.h>
22 #include <linux/kernel.h>
24 #include <linux/rtnetlink.h>
31 #define SKBEDIT_TAB_MASK 15
33 static u32 skbedit_idx_gen;
37 .htab = tcf_skbedit_ht,
39 .lock = &skbedit_lock,
47 spin_lock(&d->tcf_lock);
49 bstats_update(&d->tcf_bstats, skb);
59 spin_unlock(&d->tcf_lock);
71 struct tc_action *a,
int ovr,
int bind)
114 &skbedit_idx_gen, &skbedit_hash_info);
128 spin_lock_bh(&d->tcf_lock);
138 d->tcf_action = parm->action;
140 spin_unlock_bh(&d->tcf_lock);
142 if (ret == ACT_P_CREATED)
147 static int tcf_skbedit_cleanup(
struct tc_action *a,
int bind)
156 static int tcf_skbedit_dump(
struct sk_buff *skb,
struct tc_action *a,
159 unsigned char *
b = skb_tail_pointer(skb);
162 .index = d->tcf_index,
163 .refcnt = d->tcf_refcnt - ref,
164 .bindcnt = d->tcf_bindcnt - bind,
165 .action = d->tcf_action,
170 goto nla_put_failure;
171 if ((d->
flags & SKBEDIT_F_PRIORITY) &&
174 goto nla_put_failure;
175 if ((d->
flags & SKBEDIT_F_QUEUE_MAPPING) &&
178 goto nla_put_failure;
179 if ((d->
flags & SKBEDIT_F_MARK) &&
182 goto nla_put_failure;
187 goto nla_put_failure;
195 static struct tc_action_ops act_skbedit_ops = {
197 .hinfo = &skbedit_hash_info,
199 .capab = TCA_CAP_NONE,
202 .dump = tcf_skbedit_dump,
203 .cleanup = tcf_skbedit_cleanup,
204 .init = tcf_skbedit_init,
212 static int __init skbedit_init_module(
void)
217 static void __exit skbedit_cleanup_module(
void)