#include <asm/uaccess.h>
#include <asm/system.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#ifdef CONFIG_GACT_PROB
typedef int (*g_rand)(struct tcf_gact *p);
-static int
+int
gact_net_rand(struct tcf_gact *p) {
if (net_random()%p->pval)
return p->action;
return p->paction;
}
-static int
+int
gact_determ(struct tcf_gact *p) {
- if (p->bstats.packets%p->pval)
+ if (p->stats.packets%p->pval)
return p->action;
return p->paction;
}
g_rand gact_rand[MAX_RAND]= { NULL,gact_net_rand, gact_determ};
#endif
-static int
+int
tcf_gact_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,int ovr,int bind)
{
struct rtattr *tb[TCA_GACT_MAX];
return ret;
}
-static int
+int
tcf_gact_cleanup(struct tc_action *a, int bind)
{
struct tcf_gact *p;
return 0;
}
-static int
+int
tcf_gact(struct sk_buff **pskb, struct tc_action *a)
{
struct tcf_gact *p;
#else
action = p->action;
#endif
- p->bstats.bytes += skb->len;
- p->bstats.packets++;
+ p->stats.bytes += skb->len;
+ p->stats.packets++;
if (TC_ACT_SHOT == action)
- p->qstats.drops++;
+ p->stats.drops++;
p->tm.lastuse = jiffies;
spin_unlock(&p->lock);
return action;
}
-static int
+int
tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
{
unsigned char *b = skb->tail;
RTA_PUT(skb, TCA_GACT_PROB, sizeof (p_opt), &p_opt);
}
#endif
- t.install = jiffies_to_clock_t(jiffies - p->tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse);
- t.expires = jiffies_to_clock_t(p->tm.expires);
+ t.install = jiffies - p->tm.install;
+ t.lastuse = jiffies - p->tm.lastuse;
+ t.expires = p->tm.expires;
RTA_PUT(skb, TCA_GACT_TM, sizeof (t), &t);
return skb->len;
return -1;
}
-static struct tc_action_ops act_gact_ops = {
+int
+tcf_gact_stats(struct sk_buff *skb, struct tc_action *a)
+{
+ struct tcf_gact *p;
+ p = PRIV(a,gact);
+ if (NULL != p)
+ return qdisc_copy_stats(skb, &p->stats,p->stats_lock);
+
+ return 1;
+}
+
+struct tc_action_ops act_gact_ops = {
.next = NULL,
.kind = "gact",
.type = TCA_ACT_GACT,
.capab = TCA_CAP_NONE,
.owner = THIS_MODULE,
.act = tcf_gact,
+ .get_stats = tcf_gact_stats,
.dump = tcf_gact_dump,
.cleanup = tcf_gact_cleanup,
.lookup = tcf_hash_search,