#include <asm/uaccess.h>
#include <asm/system.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <net/sock.h>
-#include <net/pkt_sched.h>
+#include <net/sch_generic.h>
+#include <net/act_api.h>
#if 1 /* control */
#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
}
/* lookup by name */
-struct tc_action_ops *tc_lookup_action_n(char *kind)
+static struct tc_action_ops *tc_lookup_action_n(char *kind)
{
struct tc_action_ops *a = NULL;
}
/* lookup by rtattr */
-struct tc_action_ops *tc_lookup_action(struct rtattr *kind)
+static struct tc_action_ops *tc_lookup_action(struct rtattr *kind)
{
struct tc_action_ops *a = NULL;
return a;
}
+#if 0
/* lookup by id */
-struct tc_action_ops *tc_lookup_action_id(u32 type)
+static struct tc_action_ops *tc_lookup_action_id(u32 type)
{
struct tc_action_ops *a = NULL;
return a;
}
+#endif
-int tcf_action_exec(struct sk_buff *skb,struct tc_action *act)
+int tcf_action_exec(struct sk_buff *skb,struct tc_action *act, struct tcf_result *res)
{
struct tc_action *a;
if (skb->tc_verd & TC_NCLS) {
skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
D2PRINTK("(%p)tcf_action_exec: cleared TC_NCLS in %s out %s\n",skb,skb->input_dev?skb->input_dev->name:"xxx",skb->dev->name);
- return TC_ACT_OK;
+ ret = TC_ACT_OK;
+ goto exec_done;
}
while ((a = act) != NULL) {
repeat:
}
exec_done:
+ if (skb->tc_classid > 0) {
+ res->classid = skb->tc_classid;
+ res->class = 0;
+ skb->tc_classid = 0;
+ }
return ret;
}
int tcf_action_copy_stats (struct sk_buff *skb,struct tc_action *a)
{
+ int err;
+ struct gnet_dump d;
+ struct tcf_act_hdr *h = a->priv;
+
#ifdef CONFIG_KMOD
/* place holder */
#endif
- if (NULL == a->ops || NULL == a->ops->get_stats)
- return 1;
+ if (NULL == h)
+ goto errout;
+
+ if (a->type == TCA_OLD_COMPAT)
+ err = gnet_stats_start_copy_compat(skb, TCA_ACT_STATS,
+ TCA_STATS, TCA_XSTATS, h->stats_lock, &d);
+ else
+ err = gnet_stats_start_copy(skb, TCA_ACT_STATS,
+ h->stats_lock, &d);
+
+ if (err < 0)
+ goto errout;
+
+ if (NULL != a->ops && NULL != a->ops->get_stats)
+ if (a->ops->get_stats(skb, a) < 0)
+ goto errout;
+
+ if (gnet_stats_copy_basic(&d, &h->bstats) < 0 ||
+#ifdef CONFIG_NET_ESTIMATOR
+ gnet_stats_copy_rate_est(&d, &h->rate_est) < 0 ||
+#endif
+ gnet_stats_copy_queue(&d, &h->qstats) < 0)
+ goto errout;
+
+ if (gnet_stats_finish_copy(&d) < 0)
+ goto errout;
- return a->ops->get_stats(skb,a);
+ return 0;
+
+errout:
+ return -1;
}
return err;
}
-int tcf_action_get_1(struct rtattr *rta, struct tc_action *a, struct nlmsghdr *n, u32 pid)
+static int tcf_action_get_1(struct rtattr *rta, struct tc_action *a, struct nlmsghdr *n, u32 pid)
{
struct tc_action_ops *a_o;
char act_name[4 + IFNAMSIZ + 1];
return err;
}
-void cleanup_a (struct tc_action *act)
+static void cleanup_a (struct tc_action *act)
{
struct tc_action *a;
}
}
-struct tc_action_ops *get_ao(struct rtattr *kind, struct tc_action *a)
+static struct tc_action_ops *get_ao(struct rtattr *kind, struct tc_action *a)
{
char act_name[4 + IFNAMSIZ + 1];
struct tc_action_ops *a_o = NULL;
return a_o;
}
-struct tc_action *create_a(int i)
+static struct tc_action *create_a(int i)
{
struct tc_action *act = NULL;
return act;
}
-int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
+static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
{
struct sk_buff *skb;
unsigned char *b;
return err;
}
-int tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event )
+static int tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event )
{
int s = 0;
}
-int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, unsigned flags)
+static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, unsigned flags)
{
struct tcamsg *t;
struct nlmsghdr *nlh;
}
-int tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr )
+static int tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr )
{
int ret = 0;
struct tc_action *act = NULL;
return ret;
}
-char *
+static char *
find_dump_kind(struct nlmsghdr *n)
{
struct rtattr *tb1, *tb2[TCA_ACT_MAX+1];