act_gact.c (f43dc23d5ea91fca257be02138a255f02d98e806) act_gact.c (cc7ec456f82da7f89a5b376e613b3ac4311b3e9a)
1/*
2 * net/sched/gact.c Generic actions
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 36 unchanged lines hidden (view full) ---

45static int gact_determ(struct tcf_gact *gact)
46{
47 if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
48 return gact->tcf_action;
49 return gact->tcfg_paction;
50}
51
52typedef int (*g_rand)(struct tcf_gact *gact);
1/*
2 * net/sched/gact.c Generic actions
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 36 unchanged lines hidden (view full) ---

45static int gact_determ(struct tcf_gact *gact)
46{
47 if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
48 return gact->tcf_action;
49 return gact->tcfg_paction;
50}
51
52typedef int (*g_rand)(struct tcf_gact *gact);
53static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
53static g_rand gact_rand[MAX_RAND] = { NULL, gact_net_rand, gact_determ };
54#endif /* CONFIG_GACT_PROB */
55
56static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
57 [TCA_GACT_PARMS] = { .len = sizeof(struct tc_gact) },
58 [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
59};
60
61static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,

--- 22 unchanged lines hidden (view full) ---

84 return -EOPNOTSUPP;
85#endif
86
87 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info);
88 if (!pc) {
89 pc = tcf_hash_create(parm->index, est, a, sizeof(*gact),
90 bind, &gact_idx_gen, &gact_hash_info);
91 if (IS_ERR(pc))
54#endif /* CONFIG_GACT_PROB */
55
56static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
57 [TCA_GACT_PARMS] = { .len = sizeof(struct tc_gact) },
58 [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
59};
60
61static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,

--- 22 unchanged lines hidden (view full) ---

84 return -EOPNOTSUPP;
85#endif
86
87 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info);
88 if (!pc) {
89 pc = tcf_hash_create(parm->index, est, a, sizeof(*gact),
90 bind, &gact_idx_gen, &gact_hash_info);
91 if (IS_ERR(pc))
92 return PTR_ERR(pc);
92 return PTR_ERR(pc);
93 ret = ACT_P_CREATED;
94 } else {
95 if (!ovr) {
96 tcf_hash_release(pc, bind, &gact_hash_info);
97 return -EEXIST;
98 }
99 }
100

--- 99 unchanged lines hidden (view full) ---

200
201MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
202MODULE_DESCRIPTION("Generic Classifier actions");
203MODULE_LICENSE("GPL");
204
205static int __init gact_init_module(void)
206{
207#ifdef CONFIG_GACT_PROB
93 ret = ACT_P_CREATED;
94 } else {
95 if (!ovr) {
96 tcf_hash_release(pc, bind, &gact_hash_info);
97 return -EEXIST;
98 }
99 }
100

--- 99 unchanged lines hidden (view full) ---

200
201MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
202MODULE_DESCRIPTION("Generic Classifier actions");
203MODULE_LICENSE("GPL");
204
205static int __init gact_init_module(void)
206{
207#ifdef CONFIG_GACT_PROB
208 printk(KERN_INFO "GACT probability on\n");
208 pr_info("GACT probability on\n");
209#else
209#else
210 printk(KERN_INFO "GACT probability NOT on\n");
210 pr_info("GACT probability NOT on\n");
211#endif
212 return tcf_register_action(&act_gact_ops);
213}
214
215static void __exit gact_cleanup_module(void)
216{
217 tcf_unregister_action(&act_gact_ops);
218}
219
220module_init(gact_init_module);
221module_exit(gact_cleanup_module);
211#endif
212 return tcf_register_action(&act_gact_ops);
213}
214
215static void __exit gact_cleanup_module(void)
216{
217 tcf_unregister_action(&act_gact_ops);
218}
219
220module_init(gact_init_module);
221module_exit(gact_cleanup_module);