forked from Minki/linux
[NET] SCHED: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7612713fb6
commit
10297b9931
@ -65,7 +65,7 @@ int tcf_hash_release(struct tcf_common *p, int bind,
|
|||||||
p->tcfc_bindcnt--;
|
p->tcfc_bindcnt--;
|
||||||
|
|
||||||
p->tcfc_refcnt--;
|
p->tcfc_refcnt--;
|
||||||
if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) {
|
if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) {
|
||||||
tcf_hash_destroy(p, hinfo);
|
tcf_hash_destroy(p, hinfo);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ static struct tc_action_ops *tc_lookup_action_id(u32 type)
|
|||||||
#endif
|
#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 tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tc_action *a;
|
struct tc_action *a;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -473,7 +473,7 @@ errout:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
|
struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
|
||||||
char *name, int ovr, int bind, int *err)
|
char *name, int ovr, int bind, int *err)
|
||||||
{
|
{
|
||||||
struct tc_action *a;
|
struct tc_action *a;
|
||||||
struct tc_action_ops *a_o;
|
struct tc_action_ops *a_o;
|
||||||
@ -553,7 +553,7 @@ err_out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est,
|
struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est,
|
||||||
char *name, int ovr, int bind, int *err)
|
char *name, int ovr, int bind, int *err)
|
||||||
{
|
{
|
||||||
struct rtattr *tb[TCA_ACT_MAX_PRIO+1];
|
struct rtattr *tb[TCA_ACT_MAX_PRIO+1];
|
||||||
struct tc_action *head = NULL, *act, *act_prev = NULL;
|
struct tc_action *head = NULL, *act, *act_prev = NULL;
|
||||||
@ -590,7 +590,7 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
struct gnet_dump d;
|
struct gnet_dump d;
|
||||||
struct tcf_act_hdr *h = a->priv;
|
struct tcf_act_hdr *h = a->priv;
|
||||||
|
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ errout:
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
|
tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
|
||||||
u16 flags, int event, int bind, int ref)
|
u16 flags, int event, int bind, int ref)
|
||||||
{
|
{
|
||||||
struct tcamsg *t;
|
struct tcamsg *t;
|
||||||
struct nlmsghdr *nlh;
|
struct nlmsghdr *nlh;
|
||||||
@ -645,7 +645,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
|
|||||||
t->tca_family = AF_UNSPEC;
|
t->tca_family = AF_UNSPEC;
|
||||||
t->tca__pad1 = 0;
|
t->tca__pad1 = 0;
|
||||||
t->tca__pad2 = 0;
|
t->tca__pad2 = 0;
|
||||||
|
|
||||||
x = (struct rtattr*) skb->tail;
|
x = (struct rtattr*) skb->tail;
|
||||||
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
|
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
|
|||||||
goto rtattr_failure;
|
goto rtattr_failure;
|
||||||
|
|
||||||
x->rta_len = skb->tail - (u8*)x;
|
x->rta_len = skb->tail - (u8*)x;
|
||||||
|
|
||||||
nlh->nlmsg_len = skb->tail - b;
|
nlh->nlmsg_len = skb->tail - b;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
@ -852,7 +852,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tca_get_fill(skb, head, pid, n->nlmsg_seq, 0, event,
|
if (tca_get_fill(skb, head, pid, n->nlmsg_seq, 0, event,
|
||||||
0, 1) <= 0) {
|
0, 1) <= 0) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err;
|
goto err;
|
||||||
@ -861,7 +861,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
|
|||||||
/* now do the delete */
|
/* now do the delete */
|
||||||
tcf_action_destroy(head, 0);
|
tcf_action_destroy(head, 0);
|
||||||
ret = rtnetlink_send(skb, pid, RTNLGRP_TC,
|
ret = rtnetlink_send(skb, pid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags&NLM_F_ECHO);
|
n->nlmsg_flags&NLM_F_ECHO);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
return 0;
|
return 0;
|
||||||
return ret;
|
return ret;
|
||||||
@ -872,7 +872,7 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
|
static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
|
||||||
u16 flags)
|
u16 flags)
|
||||||
{
|
{
|
||||||
struct tcamsg *t;
|
struct tcamsg *t;
|
||||||
struct nlmsghdr *nlh;
|
struct nlmsghdr *nlh;
|
||||||
@ -900,10 +900,10 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
|
|||||||
goto rtattr_failure;
|
goto rtattr_failure;
|
||||||
|
|
||||||
x->rta_len = skb->tail - (u8*)x;
|
x->rta_len = skb->tail - (u8*)x;
|
||||||
|
|
||||||
nlh->nlmsg_len = skb->tail - b;
|
nlh->nlmsg_len = skb->tail - b;
|
||||||
NETLINK_CB(skb).dst_group = RTNLGRP_TC;
|
NETLINK_CB(skb).dst_group = RTNLGRP_TC;
|
||||||
|
|
||||||
err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
|
err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
|
||||||
if (err > 0)
|
if (err > 0)
|
||||||
err = 0;
|
err = 0;
|
||||||
@ -915,7 +915,7 @@ nlmsg_failure:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr)
|
tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr)
|
||||||
{
|
{
|
||||||
@ -999,13 +999,13 @@ find_dump_kind(struct nlmsghdr *n)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (rtattr_parse(tb, TCA_ACT_MAX_PRIO, RTA_DATA(tb1),
|
if (rtattr_parse(tb, TCA_ACT_MAX_PRIO, RTA_DATA(tb1),
|
||||||
NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0)
|
NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (tb[0] == NULL)
|
if (tb[0] == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (rtattr_parse(tb2, TCA_ACT_MAX, RTA_DATA(tb[0]),
|
if (rtattr_parse(tb2, TCA_ACT_MAX, RTA_DATA(tb[0]),
|
||||||
RTA_PAYLOAD(tb[0])) < 0)
|
RTA_PAYLOAD(tb[0])) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
kind = tb2[TCA_ACT_KIND-1];
|
kind = tb2[TCA_ACT_KIND-1];
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nlh = NLMSG_PUT(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
|
nlh = NLMSG_PUT(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
|
||||||
cb->nlh->nlmsg_type, sizeof(*t));
|
cb->nlh->nlmsg_type, sizeof(*t));
|
||||||
t = NLMSG_DATA(nlh);
|
t = NLMSG_DATA(nlh);
|
||||||
t->tca_family = AF_UNSPEC;
|
t->tca_family = AF_UNSPEC;
|
||||||
t->tca__pad1 = 0;
|
t->tca__pad1 = 0;
|
||||||
|
@ -65,7 +65,7 @@ static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
|
|||||||
#endif /* CONFIG_GACT_PROB */
|
#endif /* CONFIG_GACT_PROB */
|
||||||
|
|
||||||
static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
|
static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
|
||||||
struct tc_action *a, int ovr, int bind)
|
struct tc_action *a, int ovr, int bind)
|
||||||
{
|
{
|
||||||
struct rtattr *tb[TCA_GACT_MAX];
|
struct rtattr *tb[TCA_GACT_MAX];
|
||||||
struct tc_gact *parm;
|
struct tc_gact *parm;
|
||||||
|
@ -70,7 +70,7 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int
|
|||||||
}
|
}
|
||||||
if (t->u.kernel.target->checkentry
|
if (t->u.kernel.target->checkentry
|
||||||
&& !t->u.kernel.target->checkentry(table, NULL,
|
&& !t->u.kernel.target->checkentry(table, NULL,
|
||||||
t->u.kernel.target, t->data,
|
t->u.kernel.target, t->data,
|
||||||
hook)) {
|
hook)) {
|
||||||
module_put(t->u.kernel.target->me);
|
module_put(t->u.kernel.target->me);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -83,7 +83,7 @@ static void ipt_destroy_target(struct ipt_entry_target *t)
|
|||||||
{
|
{
|
||||||
if (t->u.kernel.target->destroy)
|
if (t->u.kernel.target->destroy)
|
||||||
t->u.kernel.target->destroy(t->u.kernel.target, t->data);
|
t->u.kernel.target->destroy(t->u.kernel.target, t->data);
|
||||||
module_put(t->u.kernel.target->me);
|
module_put(t->u.kernel.target->me);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcf_ipt_release(struct tcf_ipt *ipt, int bind)
|
static int tcf_ipt_release(struct tcf_ipt *ipt, int bind)
|
||||||
|
@ -153,8 +153,8 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
|
|||||||
if (tkey->offmask) {
|
if (tkey->offmask) {
|
||||||
if (skb->len > tkey->at) {
|
if (skb->len > tkey->at) {
|
||||||
char *j = pptr + tkey->at;
|
char *j = pptr + tkey->at;
|
||||||
offset += ((*j & tkey->offmask) >>
|
offset += ((*j & tkey->offmask) >>
|
||||||
tkey->shift);
|
tkey->shift);
|
||||||
} else {
|
} else {
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
|
|||||||
*ptr = ((*ptr & tkey->mask) ^ tkey->val);
|
*ptr = ((*ptr & tkey->mask) ^ tkey->val);
|
||||||
munged++;
|
munged++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (munged)
|
if (munged)
|
||||||
skb->tc_verd = SET_TC_MUNGED(skb->tc_verd);
|
skb->tc_verd = SET_TC_MUNGED(skb->tc_verd);
|
||||||
goto done;
|
goto done;
|
||||||
@ -200,8 +200,8 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
|
|||||||
struct tcf_pedit *p = a->priv;
|
struct tcf_pedit *p = a->priv;
|
||||||
struct tc_pedit *opt;
|
struct tc_pedit *opt;
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
s = sizeof(*opt) + p->tcfp_nkeys * sizeof(struct tc_pedit_key);
|
s = sizeof(*opt) + p->tcfp_nkeys * sizeof(struct tc_pedit_key);
|
||||||
|
|
||||||
/* netlink spinlocks held above us - must use ATOMIC */
|
/* netlink spinlocks held above us - must use ATOMIC */
|
||||||
|
@ -62,7 +62,7 @@ struct tc_police_compat
|
|||||||
|
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb,
|
static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb,
|
||||||
int type, struct tc_action *a)
|
int type, struct tc_action *a)
|
||||||
{
|
{
|
||||||
struct tcf_common *p;
|
struct tcf_common *p;
|
||||||
int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
|
int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
|
||||||
@ -112,7 +112,7 @@ void tcf_police_destroy(struct tcf_police *p)
|
|||||||
{
|
{
|
||||||
unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK);
|
unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK);
|
||||||
struct tcf_common **p1p;
|
struct tcf_common **p1p;
|
||||||
|
|
||||||
for (p1p = &tcf_police_ht[h]; *p1p; p1p = &(*p1p)->tcfc_next) {
|
for (p1p = &tcf_police_ht[h]; *p1p; p1p = &(*p1p)->tcfc_next) {
|
||||||
if (*p1p == &p->common) {
|
if (*p1p == &p->common) {
|
||||||
write_lock_bh(&police_lock);
|
write_lock_bh(&police_lock);
|
||||||
@ -135,7 +135,7 @@ void tcf_police_destroy(struct tcf_police *p)
|
|||||||
|
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
|
static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
|
||||||
struct tc_action *a, int ovr, int bind)
|
struct tc_action *a, int ovr, int bind)
|
||||||
{
|
{
|
||||||
unsigned h;
|
unsigned h;
|
||||||
int ret = 0, err;
|
int ret = 0, err;
|
||||||
@ -269,7 +269,7 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
|
static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
|
||||||
struct tcf_result *res)
|
struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tcf_police *police = a->priv;
|
struct tcf_police *police = a->priv;
|
||||||
psched_time_t now;
|
psched_time_t now;
|
||||||
@ -606,12 +606,12 @@ rtattr_failure:
|
|||||||
int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police)
|
int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police)
|
||||||
{
|
{
|
||||||
struct gnet_dump d;
|
struct gnet_dump d;
|
||||||
|
|
||||||
if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
|
if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
|
||||||
TCA_XSTATS, police->tcf_stats_lock,
|
TCA_XSTATS, police->tcf_stats_lock,
|
||||||
&d) < 0)
|
&d) < 0)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 ||
|
if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 ||
|
||||||
#ifdef CONFIG_NET_ESTIMATOR
|
#ifdef CONFIG_NET_ESTIMATOR
|
||||||
gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 ||
|
gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 ||
|
||||||
|
@ -43,9 +43,9 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result
|
|||||||
d->tcf_bstats.bytes += skb->len;
|
d->tcf_bstats.bytes += skb->len;
|
||||||
d->tcf_bstats.packets++;
|
d->tcf_bstats.packets++;
|
||||||
|
|
||||||
/* print policy string followed by _ then packet count
|
/* print policy string followed by _ then packet count
|
||||||
* Example if this was the 3rd packet and the string was "hello"
|
* Example if this was the 3rd packet and the string was "hello"
|
||||||
* then it would look like "hello_3" (without quotes)
|
* then it would look like "hello_3" (without quotes)
|
||||||
**/
|
**/
|
||||||
printk("simple: %s_%d\n",
|
printk("simple: %s_%d\n",
|
||||||
(char *)d->tcfd_defdata, d->tcf_bstats.packets);
|
(char *)d->tcfd_defdata, d->tcf_bstats.packets);
|
||||||
|
@ -286,7 +286,7 @@ replay:
|
|||||||
goto errout;
|
goto errout;
|
||||||
} else {
|
} else {
|
||||||
switch (n->nlmsg_type) {
|
switch (n->nlmsg_type) {
|
||||||
case RTM_NEWTFILTER:
|
case RTM_NEWTFILTER:
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
if (n->nlmsg_flags&NLM_F_EXCL)
|
if (n->nlmsg_flags&NLM_F_EXCL)
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -481,11 +481,11 @@ tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts)
|
|||||||
|
|
||||||
int
|
int
|
||||||
tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb,
|
tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb,
|
||||||
struct rtattr *rate_tlv, struct tcf_exts *exts,
|
struct rtattr *rate_tlv, struct tcf_exts *exts,
|
||||||
struct tcf_ext_map *map)
|
struct tcf_ext_map *map)
|
||||||
{
|
{
|
||||||
memset(exts, 0, sizeof(*exts));
|
memset(exts, 0, sizeof(*exts));
|
||||||
|
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -511,7 +511,7 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb,
|
|||||||
#elif defined CONFIG_NET_CLS_POLICE
|
#elif defined CONFIG_NET_CLS_POLICE
|
||||||
if (map->police && tb[map->police-1]) {
|
if (map->police && tb[map->police-1]) {
|
||||||
struct tcf_police *p;
|
struct tcf_police *p;
|
||||||
|
|
||||||
p = tcf_police_locate(tb[map->police-1], rate_tlv);
|
p = tcf_police_locate(tb[map->police-1], rate_tlv);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -530,7 +530,7 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb,
|
|||||||
|
|
||||||
void
|
void
|
||||||
tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
|
tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
|
||||||
struct tcf_exts *src)
|
struct tcf_exts *src)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
if (src->action) {
|
if (src->action) {
|
||||||
@ -597,7 +597,7 @@ rtattr_failure: __attribute__ ((unused))
|
|||||||
|
|
||||||
int
|
int
|
||||||
tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
|
tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
|
||||||
struct tcf_ext_map *map)
|
struct tcf_ext_map *map)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
if (exts->action)
|
if (exts->action)
|
||||||
|
@ -98,7 +98,7 @@ static void basic_destroy(struct tcf_proto *tp)
|
|||||||
{
|
{
|
||||||
struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
|
struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
|
||||||
struct basic_filter *f, *n;
|
struct basic_filter *f, *n;
|
||||||
|
|
||||||
list_for_each_entry_safe(f, n, &head->flist, link) {
|
list_for_each_entry_safe(f, n, &head->flist, link) {
|
||||||
list_del(&f->link);
|
list_del(&f->link);
|
||||||
basic_delete_filter(tp, f);
|
basic_delete_filter(tp, f);
|
||||||
@ -157,7 +157,7 @@ errout:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
|
static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
|
||||||
struct rtattr **tca, unsigned long *arg)
|
struct rtattr **tca, unsigned long *arg)
|
||||||
{
|
{
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
struct basic_head *head = (struct basic_head *) tp->root;
|
struct basic_head *head = (struct basic_head *) tp->root;
|
||||||
@ -292,7 +292,7 @@ static int __init init_basic(void)
|
|||||||
return register_tcf_proto_ops(&cls_basic_ops);
|
return register_tcf_proto_ops(&cls_basic_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_basic(void)
|
static void __exit exit_basic(void)
|
||||||
{
|
{
|
||||||
unregister_tcf_proto_ops(&cls_basic_ops);
|
unregister_tcf_proto_ops(&cls_basic_ops);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ static __inline__ int fw_hash(u32 handle)
|
|||||||
else if (HTSIZE == 256) {
|
else if (HTSIZE == 256) {
|
||||||
u8 *t = (u8 *) &handle;
|
u8 *t = (u8 *) &handle;
|
||||||
return t[0] ^ t[1] ^ t[2] ^ t[3];
|
return t[0] ^ t[1] ^ t[2] ^ t[3];
|
||||||
} else
|
} else
|
||||||
return handle & (HTSIZE - 1);
|
return handle & (HTSIZE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ static int __init init_fw(void)
|
|||||||
return register_tcf_proto_ops(&cls_fw_ops);
|
return register_tcf_proto_ops(&cls_fw_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_fw(void)
|
static void __exit exit_fw(void)
|
||||||
{
|
{
|
||||||
unregister_tcf_proto_ops(&cls_fw_ops);
|
unregister_tcf_proto_ops(&cls_fw_ops);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ static struct tcf_ext_map rsvp_ext_map = {
|
|||||||
else if (r > 0) \
|
else if (r > 0) \
|
||||||
return r; \
|
return r; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
|
static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
|
||||||
struct tcf_result *res)
|
struct tcf_result *res)
|
||||||
{
|
{
|
||||||
@ -347,7 +347,7 @@ static int tunnel_bts(struct rsvp_head *data)
|
|||||||
{
|
{
|
||||||
int n = data->tgenerator>>5;
|
int n = data->tgenerator>>5;
|
||||||
u32 b = 1<<(data->tgenerator&0x1F);
|
u32 b = 1<<(data->tgenerator&0x1F);
|
||||||
|
|
||||||
if (data->tmap[n]&b)
|
if (data->tmap[n]&b)
|
||||||
return 0;
|
return 0;
|
||||||
data->tmap[n] |= b;
|
data->tmap[n] |= b;
|
||||||
@ -547,7 +547,7 @@ insert:
|
|||||||
s->next = *sp;
|
s->next = *sp;
|
||||||
wmb();
|
wmb();
|
||||||
*sp = s;
|
*sp = s;
|
||||||
|
|
||||||
goto insert;
|
goto insert;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
@ -654,7 +654,7 @@ static int __init init_rsvp(void)
|
|||||||
return register_tcf_proto_ops(&RSVP_OPS);
|
return register_tcf_proto_ops(&RSVP_OPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_rsvp(void)
|
static void __exit exit_rsvp(void)
|
||||||
{
|
{
|
||||||
unregister_tcf_proto_ops(&RSVP_OPS);
|
unregister_tcf_proto_ops(&RSVP_OPS);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
|
|||||||
err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map);
|
err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
memcpy(&cp, p, sizeof(cp));
|
memcpy(&cp, p, sizeof(cp));
|
||||||
memset(&new_filter_result, 0, sizeof(new_filter_result));
|
memset(&new_filter_result, 0, sizeof(new_filter_result));
|
||||||
|
|
||||||
@ -316,12 +316,12 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
|
|||||||
f = kzalloc(sizeof(*f), GFP_KERNEL);
|
f = kzalloc(sizeof(*f), GFP_KERNEL);
|
||||||
if (!f)
|
if (!f)
|
||||||
goto errout_alloc;
|
goto errout_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[TCA_TCINDEX_CLASSID-1]) {
|
if (tb[TCA_TCINDEX_CLASSID-1]) {
|
||||||
cr.res.classid = *(u32 *) RTA_DATA(tb[TCA_TCINDEX_CLASSID-1]);
|
cr.res.classid = *(u32 *) RTA_DATA(tb[TCA_TCINDEX_CLASSID-1]);
|
||||||
tcf_bind_filter(tp, &cr.res, base);
|
tcf_bind_filter(tp, &cr.res, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
tcf_exts_change(tp, &cr.exts, &e);
|
tcf_exts_change(tp, &cr.exts, &e);
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
|
|||||||
for (fp = p->h+(handle % p->hash); *fp; fp = &(*fp)->next)
|
for (fp = p->h+(handle % p->hash); *fp; fp = &(*fp)->next)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
*fp = f;
|
*fp = f;
|
||||||
}
|
}
|
||||||
tcf_tree_unlock(tp);
|
tcf_tree_unlock(tp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -491,7 +491,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
|
if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
|
||||||
goto rtattr_failure;
|
goto rtattr_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
rtattr_failure:
|
rtattr_failure:
|
||||||
@ -519,7 +519,7 @@ static int __init init_tcindex(void)
|
|||||||
return register_tcf_proto_ops(&cls_tcindex_ops);
|
return register_tcf_proto_ops(&cls_tcindex_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_tcindex(void)
|
static void __exit exit_tcindex(void)
|
||||||
{
|
{
|
||||||
unregister_tcf_proto_ops(&cls_tcindex_ops);
|
unregister_tcf_proto_ops(&cls_tcindex_ops);
|
||||||
}
|
}
|
||||||
|
@ -760,7 +760,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev);
|
RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_CLS_U32_PERF
|
#ifdef CONFIG_CLS_U32_PERF
|
||||||
RTA_PUT(skb, TCA_U32_PCNT,
|
RTA_PUT(skb, TCA_U32_PCNT,
|
||||||
sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64),
|
sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64),
|
||||||
n->pf);
|
n->pf);
|
||||||
#endif
|
#endif
|
||||||
@ -810,7 +810,7 @@ static int __init init_u32(void)
|
|||||||
return register_tcf_proto_ops(&cls_u32_ops);
|
return register_tcf_proto_ops(&cls_u32_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_u32(void)
|
static void __exit exit_u32(void)
|
||||||
{
|
{
|
||||||
unregister_tcf_proto_ops(&cls_u32_ops);
|
unregister_tcf_proto_ops(&cls_u32_ops);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ static int __init init_em_cmp(void)
|
|||||||
return tcf_em_register(&em_cmp_ops);
|
return tcf_em_register(&em_cmp_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_em_cmp(void)
|
static void __exit exit_em_cmp(void)
|
||||||
{
|
{
|
||||||
tcf_em_unregister(&em_cmp_ops);
|
tcf_em_unregister(&em_cmp_ops);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Authors: Thomas Graf <tgraf@suug.ch>
|
* Authors: Thomas Graf <tgraf@suug.ch>
|
||||||
*
|
*
|
||||||
* ==========================================================================
|
* ==========================================================================
|
||||||
*
|
*
|
||||||
* The metadata ematch compares two meta objects where each object
|
* The metadata ematch compares two meta objects where each object
|
||||||
* represents either a meta value stored in the kernel or a static
|
* represents either a meta value stored in the kernel or a static
|
||||||
* value provided by userspace. The objects are not provided by
|
* value provided by userspace. The objects are not provided by
|
||||||
@ -290,7 +290,7 @@ META_COLLECTOR(var_sk_bound_if)
|
|||||||
dst->len = 3;
|
dst->len = 3;
|
||||||
} else {
|
} else {
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
|
|
||||||
dev = dev_get_by_index(skb->sk->sk_bound_dev_if);
|
dev = dev_get_by_index(skb->sk->sk_bound_dev_if);
|
||||||
*err = var_dev(dev, dst);
|
*err = var_dev(dev, dst);
|
||||||
if (dev)
|
if (dev)
|
||||||
@ -671,7 +671,7 @@ static inline struct meta_type_ops * meta_type_ops(struct meta_value *v)
|
|||||||
* Core
|
* Core
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info,
|
static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info,
|
||||||
struct meta_value *v, struct meta_obj *dst)
|
struct meta_value *v, struct meta_obj *dst)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -753,7 +753,7 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len,
|
|||||||
struct rtattr *tb[TCA_EM_META_MAX];
|
struct rtattr *tb[TCA_EM_META_MAX];
|
||||||
struct tcf_meta_hdr *hdr;
|
struct tcf_meta_hdr *hdr;
|
||||||
struct meta_match *meta = NULL;
|
struct meta_match *meta = NULL;
|
||||||
|
|
||||||
if (rtattr_parse(tb, TCA_EM_META_MAX, data, len) < 0)
|
if (rtattr_parse(tb, TCA_EM_META_MAX, data, len) < 0)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
@ -822,7 +822,7 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
|
|||||||
|
|
||||||
rtattr_failure:
|
rtattr_failure:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_ematch_ops em_meta_ops = {
|
static struct tcf_ematch_ops em_meta_ops = {
|
||||||
.kind = TCF_EM_META,
|
.kind = TCF_EM_META,
|
||||||
@ -839,7 +839,7 @@ static int __init init_em_meta(void)
|
|||||||
return tcf_em_register(&em_meta_ops);
|
return tcf_em_register(&em_meta_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_em_meta(void)
|
static void __exit exit_em_meta(void)
|
||||||
{
|
{
|
||||||
tcf_em_unregister(&em_meta_ops);
|
tcf_em_unregister(&em_meta_ops);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ struct nbyte_data
|
|||||||
struct tcf_em_nbyte hdr;
|
struct tcf_em_nbyte hdr;
|
||||||
char pattern[0];
|
char pattern[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
|
static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
|
||||||
struct tcf_ematch *em)
|
struct tcf_ematch *em)
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ static int __init init_em_nbyte(void)
|
|||||||
return tcf_em_register(&em_nbyte_ops);
|
return tcf_em_register(&em_nbyte_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_em_nbyte(void)
|
static void __exit exit_em_nbyte(void)
|
||||||
{
|
{
|
||||||
tcf_em_unregister(&em_nbyte_ops);
|
tcf_em_unregister(&em_nbyte_ops);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
|
|||||||
|
|
||||||
rtattr_failure:
|
rtattr_failure:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_ematch_ops em_text_ops = {
|
static struct tcf_ematch_ops em_text_ops = {
|
||||||
.kind = TCF_EM_TEXT,
|
.kind = TCF_EM_TEXT,
|
||||||
@ -142,7 +142,7 @@ static int __init init_em_text(void)
|
|||||||
return tcf_em_register(&em_text_ops);
|
return tcf_em_register(&em_text_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_em_text(void)
|
static void __exit exit_em_text(void)
|
||||||
{
|
{
|
||||||
tcf_em_unregister(&em_text_ops);
|
tcf_em_unregister(&em_text_ops);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em,
|
|||||||
{
|
{
|
||||||
struct tc_u32_key *key = (struct tc_u32_key *) em->data;
|
struct tc_u32_key *key = (struct tc_u32_key *) em->data;
|
||||||
unsigned char *ptr = skb->nh.raw;
|
unsigned char *ptr = skb->nh.raw;
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
if (info->ptr)
|
if (info->ptr)
|
||||||
ptr = info->ptr;
|
ptr = info->ptr;
|
||||||
@ -34,7 +34,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em,
|
|||||||
|
|
||||||
if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
|
if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return !(((*(u32*) ptr) ^ key->val) & key->mask);
|
return !(((*(u32*) ptr) ^ key->val) & key->mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ static int __init init_em_u32(void)
|
|||||||
return tcf_em_register(&em_u32_ops);
|
return tcf_em_register(&em_u32_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit exit_em_u32(void)
|
static void __exit exit_em_u32(void)
|
||||||
{
|
{
|
||||||
tcf_em_unregister(&em_u32_ops);
|
tcf_em_unregister(&em_u32_ops);
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,12 @@
|
|||||||
* --------<-POP---------
|
* --------<-POP---------
|
||||||
*
|
*
|
||||||
* where B is a virtual ematch referencing to sequence starting with B1.
|
* where B is a virtual ematch referencing to sequence starting with B1.
|
||||||
*
|
*
|
||||||
* ==========================================================================
|
* ==========================================================================
|
||||||
*
|
*
|
||||||
* How to write an ematch in 60 seconds
|
* How to write an ematch in 60 seconds
|
||||||
* ------------------------------------
|
* ------------------------------------
|
||||||
*
|
*
|
||||||
* 1) Provide a matcher function:
|
* 1) Provide a matcher function:
|
||||||
* static int my_match(struct sk_buff *skb, struct tcf_ematch *m,
|
* static int my_match(struct sk_buff *skb, struct tcf_ematch *m,
|
||||||
* struct tcf_pkt_info *info)
|
* struct tcf_pkt_info *info)
|
||||||
@ -115,7 +115,7 @@ static inline struct tcf_ematch_ops * tcf_em_lookup(u16 kind)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* tcf_em_register - register an extended match
|
* tcf_em_register - register an extended match
|
||||||
*
|
*
|
||||||
* @ops: ematch operations lookup table
|
* @ops: ematch operations lookup table
|
||||||
*
|
*
|
||||||
* This function must be called by ematches to announce their presence.
|
* This function must be called by ematches to announce their presence.
|
||||||
@ -211,7 +211,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
|
|||||||
if (ref <= idx)
|
if (ref <= idx)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
|
|
||||||
em->data = ref;
|
em->data = ref;
|
||||||
} else {
|
} else {
|
||||||
/* Note: This lookup will increase the module refcnt
|
/* Note: This lookup will increase the module refcnt
|
||||||
@ -327,7 +327,7 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta,
|
|||||||
/* We do not use rtattr_parse_nested here because the maximum
|
/* We do not use rtattr_parse_nested here because the maximum
|
||||||
* number of attributes is unknown. This saves us the allocation
|
* number of attributes is unknown. This saves us the allocation
|
||||||
* for a tb buffer which would serve no purpose at all.
|
* for a tb buffer which would serve no purpose at all.
|
||||||
*
|
*
|
||||||
* The array of rt attributes is parsed in the order as they are
|
* The array of rt attributes is parsed in the order as they are
|
||||||
* provided, their type must be incremental from 1 to n. Even
|
* provided, their type must be incremental from 1 to n. Even
|
||||||
* if it does not serve any real purpose, a failure of sticking
|
* if it does not serve any real purpose, a failure of sticking
|
||||||
@ -399,7 +399,7 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
|
|||||||
module_put(em->ops->owner);
|
module_put(em->ops->owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tree->hdr.nmatches = 0;
|
tree->hdr.nmatches = 0;
|
||||||
kfree(tree->matches);
|
kfree(tree->matches);
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
|
|||||||
struct Qdisc *q = *old;
|
struct Qdisc *q = *old;
|
||||||
|
|
||||||
|
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
if (q && q->flags&TCQ_F_INGRESS) {
|
if (q && q->flags&TCQ_F_INGRESS) {
|
||||||
*old = dev_graft_qdisc(dev, q);
|
*old = dev_graft_qdisc(dev, q);
|
||||||
} else {
|
} else {
|
||||||
@ -596,7 +596,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
|||||||
q = qdisc_leaf(p, clid);
|
q = qdisc_leaf(p, clid);
|
||||||
} else { /* ingress */
|
} else { /* ingress */
|
||||||
q = dev->qdisc_ingress;
|
q = dev->qdisc_ingress;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
q = dev->qdisc_sleeping;
|
q = dev->qdisc_sleeping;
|
||||||
}
|
}
|
||||||
@ -743,7 +743,7 @@ create_n_graft:
|
|||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (clid == TC_H_INGRESS)
|
if (clid == TC_H_INGRESS)
|
||||||
q = qdisc_create(dev, tcm->tcm_parent, tca, &err);
|
q = qdisc_create(dev, tcm->tcm_parent, tca, &err);
|
||||||
else
|
else
|
||||||
q = qdisc_create(dev, tcm->tcm_handle, tca, &err);
|
q = qdisc_create(dev, tcm->tcm_handle, tca, &err);
|
||||||
if (q == NULL) {
|
if (q == NULL) {
|
||||||
if (err == -EAGAIN)
|
if (err == -EAGAIN)
|
||||||
@ -808,10 +808,10 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
|
|||||||
#endif
|
#endif
|
||||||
gnet_stats_copy_queue(&d, &q->qstats) < 0)
|
gnet_stats_copy_queue(&d, &q->qstats) < 0)
|
||||||
goto rtattr_failure;
|
goto rtattr_failure;
|
||||||
|
|
||||||
if (gnet_stats_finish_copy(&d) < 0)
|
if (gnet_stats_finish_copy(&d) < 0)
|
||||||
goto rtattr_failure;
|
goto rtattr_failure;
|
||||||
|
|
||||||
nlh->nlmsg_len = skb->tail - b;
|
nlh->nlmsg_len = skb->tail - b;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* OK. Locate qdisc */
|
/* OK. Locate qdisc */
|
||||||
if ((q = qdisc_lookup(dev, qid)) == NULL)
|
if ((q = qdisc_lookup(dev, qid)) == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
/* An check that it supports classes */
|
/* An check that it supports classes */
|
||||||
@ -978,7 +978,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
|||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
switch (n->nlmsg_type) {
|
switch (n->nlmsg_type) {
|
||||||
case RTM_NEWTCLASS:
|
case RTM_NEWTCLASS:
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
if (n->nlmsg_flags&NLM_F_EXCL)
|
if (n->nlmsg_flags&NLM_F_EXCL)
|
||||||
goto out;
|
goto out;
|
||||||
@ -1162,7 +1162,7 @@ reclassify:
|
|||||||
skb->tc_verd = SET_TC_VERD(skb->tc_verd,verd);
|
skb->tc_verd = SET_TC_VERD(skb->tc_verd,verd);
|
||||||
goto reclassify;
|
goto reclassify;
|
||||||
} else {
|
} else {
|
||||||
if (skb->tc_verd)
|
if (skb->tc_verd)
|
||||||
skb->tc_verd = SET_TC_VERD(skb->tc_verd,0);
|
skb->tc_verd = SET_TC_VERD(skb->tc_verd,0);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1200,7 +1200,7 @@ static struct file_operations psched_fops = {
|
|||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_SCH_CLK_CPU
|
#ifdef CONFIG_NET_SCH_CLK_CPU
|
||||||
|
@ -107,7 +107,7 @@ static __inline__ struct atm_flow_data *lookup_flow(struct Qdisc *sch,
|
|||||||
struct atm_qdisc_data *p = PRIV(sch);
|
struct atm_qdisc_data *p = PRIV(sch);
|
||||||
struct atm_flow_data *flow;
|
struct atm_flow_data *flow;
|
||||||
|
|
||||||
for (flow = p->flows; flow; flow = flow->next)
|
for (flow = p->flows; flow; flow = flow->next)
|
||||||
if (flow->classid == classid) break;
|
if (flow->classid == classid) break;
|
||||||
return flow;
|
return flow;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ static int atm_tc_graft(struct Qdisc *sch,unsigned long arg,
|
|||||||
if (!new) new = &noop_qdisc;
|
if (!new) new = &noop_qdisc;
|
||||||
*old = xchg(&flow->q,new);
|
*old = xchg(&flow->q,new);
|
||||||
if (*old) qdisc_reset(*old);
|
if (*old) qdisc_reset(*old);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ static unsigned long atm_tc_get(struct Qdisc *sch,u32 classid)
|
|||||||
|
|
||||||
DPRINTK("atm_tc_get(sch %p,[qdisc %p],classid %x)\n",sch,p,classid);
|
DPRINTK("atm_tc_get(sch %p,[qdisc %p],classid %x)\n",sch,p,classid);
|
||||||
flow = lookup_flow(sch,classid);
|
flow = lookup_flow(sch,classid);
|
||||||
if (flow) flow->ref++;
|
if (flow) flow->ref++;
|
||||||
DPRINTK("atm_tc_get: flow %p\n",flow);
|
DPRINTK("atm_tc_get: flow %p\n",flow);
|
||||||
return (unsigned long) flow;
|
return (unsigned long) flow;
|
||||||
}
|
}
|
||||||
@ -280,9 +280,9 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
|||||||
opt->rta_type,RTA_PAYLOAD(opt),hdr_len);
|
opt->rta_type,RTA_PAYLOAD(opt),hdr_len);
|
||||||
if (!(sock = sockfd_lookup(fd,&error))) return error; /* f_count++ */
|
if (!(sock = sockfd_lookup(fd,&error))) return error; /* f_count++ */
|
||||||
DPRINTK("atm_tc_change: f_count %d\n",file_count(sock->file));
|
DPRINTK("atm_tc_change: f_count %d\n",file_count(sock->file));
|
||||||
if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) {
|
if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) {
|
||||||
error = -EPROTOTYPE;
|
error = -EPROTOTYPE;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
/* @@@ should check if the socket is really operational or we'll crash
|
/* @@@ should check if the socket is really operational or we'll crash
|
||||||
on vcc->send */
|
on vcc->send */
|
||||||
@ -320,9 +320,9 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
|||||||
flow->q = &noop_qdisc;
|
flow->q = &noop_qdisc;
|
||||||
DPRINTK("atm_tc_change: qdisc %p\n",flow->q);
|
DPRINTK("atm_tc_change: qdisc %p\n",flow->q);
|
||||||
flow->sock = sock;
|
flow->sock = sock;
|
||||||
flow->vcc = ATM_SD(sock); /* speedup */
|
flow->vcc = ATM_SD(sock); /* speedup */
|
||||||
flow->vcc->user_back = flow;
|
flow->vcc->user_back = flow;
|
||||||
DPRINTK("atm_tc_change: vcc %p\n",flow->vcc);
|
DPRINTK("atm_tc_change: vcc %p\n",flow->vcc);
|
||||||
flow->old_pop = flow->vcc->pop;
|
flow->old_pop = flow->vcc->pop;
|
||||||
flow->parent = p;
|
flow->parent = p;
|
||||||
flow->vcc->pop = sch_atm_pop;
|
flow->vcc->pop = sch_atm_pop;
|
||||||
@ -391,7 +391,7 @@ static struct tcf_proto **atm_tc_find_tcf(struct Qdisc *sch,unsigned long cl)
|
|||||||
struct atm_flow_data *flow = (struct atm_flow_data *) cl;
|
struct atm_flow_data *flow = (struct atm_flow_data *) cl;
|
||||||
|
|
||||||
DPRINTK("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n",sch,p,flow);
|
DPRINTK("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n",sch,p,flow);
|
||||||
return flow ? &flow->filter_list : &p->link.filter_list;
|
return flow ? &flow->filter_list : &p->link.filter_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -546,8 +546,8 @@ static int atm_tc_requeue(struct sk_buff *skb,struct Qdisc *sch)
|
|||||||
D2PRINTK("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n",skb,sch,p);
|
D2PRINTK("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n",skb,sch,p);
|
||||||
ret = p->link.q->ops->requeue(skb,p->link.q);
|
ret = p->link.q->ops->requeue(skb,p->link.q);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
sch->q.qlen++;
|
sch->q.qlen++;
|
||||||
sch->qstats.requeues++;
|
sch->qstats.requeues++;
|
||||||
} else {
|
} else {
|
||||||
sch->qstats.drops++;
|
sch->qstats.drops++;
|
||||||
p->link.qstats.drops++;
|
p->link.qstats.drops++;
|
||||||
@ -726,7 +726,7 @@ static int __init atm_init(void)
|
|||||||
return register_qdisc(&atm_qdisc_ops);
|
return register_qdisc(&atm_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit atm_exit(void)
|
static void __exit atm_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&atm_qdisc_ops);
|
unregister_qdisc(&atm_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,12 @@
|
|||||||
=======================================
|
=======================================
|
||||||
|
|
||||||
Sources: [1] Sally Floyd and Van Jacobson, "Link-sharing and Resource
|
Sources: [1] Sally Floyd and Van Jacobson, "Link-sharing and Resource
|
||||||
Management Models for Packet Networks",
|
Management Models for Packet Networks",
|
||||||
IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995
|
IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995
|
||||||
|
|
||||||
[2] Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995
|
[2] Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995
|
||||||
|
|
||||||
[3] Sally Floyd, "Notes on Class-Based Queueing: Setting
|
[3] Sally Floyd, "Notes on Class-Based Queueing: Setting
|
||||||
Parameters", 1996
|
Parameters", 1996
|
||||||
|
|
||||||
[4] Sally Floyd and Michael Speer, "Experimental Results
|
[4] Sally Floyd and Michael Speer, "Experimental Results
|
||||||
@ -59,12 +59,12 @@
|
|||||||
the implementation is different. Particularly:
|
the implementation is different. Particularly:
|
||||||
|
|
||||||
--- The WRR algorithm is different. Our version looks more
|
--- The WRR algorithm is different. Our version looks more
|
||||||
reasonable (I hope) and works when quanta are allowed to be
|
reasonable (I hope) and works when quanta are allowed to be
|
||||||
less than MTU, which is always the case when real time classes
|
less than MTU, which is always the case when real time classes
|
||||||
have small rates. Note, that the statement of [3] is
|
have small rates. Note, that the statement of [3] is
|
||||||
incomplete, delay may actually be estimated even if class
|
incomplete, delay may actually be estimated even if class
|
||||||
per-round allotment is less than MTU. Namely, if per-round
|
per-round allotment is less than MTU. Namely, if per-round
|
||||||
allotment is W*r_i, and r_1+...+r_k = r < 1
|
allotment is W*r_i, and r_1+...+r_k = r < 1
|
||||||
|
|
||||||
delay_i <= ([MTU/(W*r_i)]*W*r + W*r + k*MTU)/B
|
delay_i <= ([MTU/(W*r_i)]*W*r + W*r + k*MTU)/B
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
|||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case TC_ACT_QUEUED:
|
case TC_ACT_QUEUED:
|
||||||
case TC_ACT_STOLEN:
|
case TC_ACT_STOLEN:
|
||||||
*qerr = NET_XMIT_SUCCESS;
|
*qerr = NET_XMIT_SUCCESS;
|
||||||
case TC_ACT_SHOT:
|
case TC_ACT_SHOT:
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -479,7 +479,7 @@ static void cbq_ovl_classic(struct cbq_class *cl)
|
|||||||
if (!cl->delayed) {
|
if (!cl->delayed) {
|
||||||
delay += cl->offtime;
|
delay += cl->offtime;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Class goes to sleep, so that it will have no
|
Class goes to sleep, so that it will have no
|
||||||
chance to work avgidle. Let's forgive it 8)
|
chance to work avgidle. Let's forgive it 8)
|
||||||
|
|
||||||
@ -717,7 +717,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
It is mission critical procedure.
|
It is mission critical procedure.
|
||||||
|
|
||||||
We "regenerate" toplevel cutoff, if transmitting class
|
We "regenerate" toplevel cutoff, if transmitting class
|
||||||
@ -739,7 +739,7 @@ cbq_update_toplevel(struct cbq_sched_data *q, struct cbq_class *cl,
|
|||||||
}
|
}
|
||||||
} while ((borrowed=borrowed->borrow) != NULL);
|
} while ((borrowed=borrowed->borrow) != NULL);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* It is not necessary now. Uncommenting it
|
/* It is not necessary now. Uncommenting it
|
||||||
will save CPU cycles, but decrease fairness.
|
will save CPU cycles, but decrease fairness.
|
||||||
*/
|
*/
|
||||||
@ -768,7 +768,7 @@ cbq_update(struct cbq_sched_data *q)
|
|||||||
(now - last) is total time between packet right edges.
|
(now - last) is total time between packet right edges.
|
||||||
(last_pktlen/rate) is "virtual" busy time, so that
|
(last_pktlen/rate) is "virtual" busy time, so that
|
||||||
|
|
||||||
idle = (now - last) - last_pktlen/rate
|
idle = (now - last) - last_pktlen/rate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
idle = PSCHED_TDIFF(q->now, cl->last);
|
idle = PSCHED_TDIFF(q->now, cl->last);
|
||||||
@ -907,7 +907,7 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio)
|
|||||||
skb = cl->q->dequeue(cl->q);
|
skb = cl->q->dequeue(cl->q);
|
||||||
|
|
||||||
/* Class did not give us any skb :-(
|
/* Class did not give us any skb :-(
|
||||||
It could occur even if cl->q->q.qlen != 0
|
It could occur even if cl->q->q.qlen != 0
|
||||||
f.e. if cl->q == "tbf"
|
f.e. if cl->q == "tbf"
|
||||||
*/
|
*/
|
||||||
if (skb == NULL)
|
if (skb == NULL)
|
||||||
@ -2131,7 +2131,7 @@ static int __init cbq_module_init(void)
|
|||||||
{
|
{
|
||||||
return register_qdisc(&cbq_qdisc_ops);
|
return register_qdisc(&cbq_qdisc_ops);
|
||||||
}
|
}
|
||||||
static void __exit cbq_module_exit(void)
|
static void __exit cbq_module_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&cbq_qdisc_ops);
|
unregister_qdisc(&cbq_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ static inline int dsmark_valid_indices(u16 indices)
|
|||||||
return 0;
|
return 0;
|
||||||
indices >>= 1;
|
indices >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
|
|||||||
qdisc_reset(*old);
|
qdisc_reset(*old);
|
||||||
sch_tree_unlock(sch);
|
sch_tree_unlock(sch);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg)
|
static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg)
|
||||||
@ -151,7 +151,7 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
|
|||||||
|
|
||||||
if (tb[TCA_DSMARK_VALUE-1])
|
if (tb[TCA_DSMARK_VALUE-1])
|
||||||
p->value[*arg-1] = RTA_GET_U8(tb[TCA_DSMARK_VALUE-1]);
|
p->value[*arg-1] = RTA_GET_U8(tb[TCA_DSMARK_VALUE-1]);
|
||||||
|
|
||||||
if (tb[TCA_DSMARK_MASK-1])
|
if (tb[TCA_DSMARK_MASK-1])
|
||||||
p->mask[*arg-1] = mask;
|
p->mask[*arg-1] = mask;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ static int dsmark_delete(struct Qdisc *sch, unsigned long arg)
|
|||||||
|
|
||||||
if (!dsmark_valid_index(p, arg))
|
if (!dsmark_valid_index(p, arg))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
p->mask[arg-1] = 0xff;
|
p->mask[arg-1] = 0xff;
|
||||||
p->value[arg-1] = 0;
|
p->value[arg-1] = 0;
|
||||||
|
|
||||||
@ -193,9 +193,9 @@ static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ignore:
|
ignore:
|
||||||
walker->count++;
|
walker->count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl)
|
static struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl)
|
||||||
@ -338,7 +338,7 @@ static unsigned int dsmark_drop(struct Qdisc *sch)
|
|||||||
{
|
{
|
||||||
struct dsmark_qdisc_data *p = PRIV(sch);
|
struct dsmark_qdisc_data *p = PRIV(sch);
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
DPRINTK("dsmark_reset(sch %p,[qdisc %p])\n", sch, p);
|
DPRINTK("dsmark_reset(sch %p,[qdisc %p])\n", sch, p);
|
||||||
|
|
||||||
if (p->q->ops->drop == NULL)
|
if (p->q->ops->drop == NULL)
|
||||||
@ -506,7 +506,7 @@ static int __init dsmark_module_init(void)
|
|||||||
return register_qdisc(&dsmark_qdisc_ops);
|
return register_qdisc(&dsmark_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit dsmark_module_exit(void)
|
static void __exit dsmark_module_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&dsmark_qdisc_ops);
|
unregister_qdisc(&dsmark_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
/* Main transmission queue. */
|
/* Main transmission queue. */
|
||||||
|
|
||||||
/* Main qdisc structure lock.
|
/* Main qdisc structure lock.
|
||||||
|
|
||||||
However, modifications
|
However, modifications
|
||||||
to data, participating in scheduling must be additionally
|
to data, participating in scheduling must be additionally
|
||||||
@ -66,7 +66,7 @@ void qdisc_unlock_tree(struct net_device *dev)
|
|||||||
write_unlock(&qdisc_tree_lock);
|
write_unlock(&qdisc_tree_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dev->queue_lock serializes queue accesses for this device
|
dev->queue_lock serializes queue accesses for this device
|
||||||
AND dev->qdisc pointer itself.
|
AND dev->qdisc pointer itself.
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void qdisc_unlock_tree(struct net_device *dev)
|
|||||||
we do not check dev->tbusy flag here.
|
we do not check dev->tbusy flag here.
|
||||||
|
|
||||||
Returns: 0 - queue is empty.
|
Returns: 0 - queue is empty.
|
||||||
>0 - queue is not empty, but throttled.
|
>0 - queue is not empty, but throttled.
|
||||||
<0 - queue is not empty. Device is throttled, if dev->tbusy != 0.
|
<0 - queue is not empty. Device is throttled, if dev->tbusy != 0.
|
||||||
|
|
||||||
NOTE: Called under dev->queue_lock with locally disabled BH.
|
NOTE: Called under dev->queue_lock with locally disabled BH.
|
||||||
@ -112,7 +112,7 @@ static inline int qdisc_restart(struct net_device *dev)
|
|||||||
if (!netif_tx_trylock(dev)) {
|
if (!netif_tx_trylock(dev)) {
|
||||||
collision:
|
collision:
|
||||||
/* So, someone grabbed the driver. */
|
/* So, someone grabbed the driver. */
|
||||||
|
|
||||||
/* It may be transient configuration error,
|
/* It may be transient configuration error,
|
||||||
when hard_start_xmit() recurses. We detect
|
when hard_start_xmit() recurses. We detect
|
||||||
it by checking xmit owner and drop the
|
it by checking xmit owner and drop the
|
||||||
@ -128,7 +128,7 @@ static inline int qdisc_restart(struct net_device *dev)
|
|||||||
goto requeue;
|
goto requeue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
/* And release queue */
|
/* And release queue */
|
||||||
spin_unlock(&dev->queue_lock);
|
spin_unlock(&dev->queue_lock);
|
||||||
@ -137,7 +137,7 @@ static inline int qdisc_restart(struct net_device *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = dev_hard_start_xmit(skb, dev);
|
ret = dev_hard_start_xmit(skb, dev);
|
||||||
if (ret == NETDEV_TX_OK) {
|
if (ret == NETDEV_TX_OK) {
|
||||||
if (!nolock) {
|
if (!nolock) {
|
||||||
netif_tx_unlock(dev);
|
netif_tx_unlock(dev);
|
||||||
}
|
}
|
||||||
@ -146,15 +146,15 @@ static inline int qdisc_restart(struct net_device *dev)
|
|||||||
}
|
}
|
||||||
if (ret == NETDEV_TX_LOCKED && nolock) {
|
if (ret == NETDEV_TX_LOCKED && nolock) {
|
||||||
spin_lock(&dev->queue_lock);
|
spin_lock(&dev->queue_lock);
|
||||||
goto collision;
|
goto collision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NETDEV_TX_BUSY - we need to requeue */
|
/* NETDEV_TX_BUSY - we need to requeue */
|
||||||
/* Release the driver */
|
/* Release the driver */
|
||||||
if (!nolock) {
|
if (!nolock) {
|
||||||
netif_tx_unlock(dev);
|
netif_tx_unlock(dev);
|
||||||
}
|
}
|
||||||
spin_lock(&dev->queue_lock);
|
spin_lock(&dev->queue_lock);
|
||||||
q = dev->qdisc;
|
q = dev->qdisc;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ struct Qdisc noop_qdisc = {
|
|||||||
.enqueue = noop_enqueue,
|
.enqueue = noop_enqueue,
|
||||||
.dequeue = noop_dequeue,
|
.dequeue = noop_dequeue,
|
||||||
.flags = TCQ_F_BUILTIN,
|
.flags = TCQ_F_BUILTIN,
|
||||||
.ops = &noop_qdisc_ops,
|
.ops = &noop_qdisc_ops,
|
||||||
.list = LIST_HEAD_INIT(noop_qdisc.list),
|
.list = LIST_HEAD_INIT(noop_qdisc.list),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops,
|
|||||||
unsigned int parentid)
|
unsigned int parentid)
|
||||||
{
|
{
|
||||||
struct Qdisc *sch;
|
struct Qdisc *sch;
|
||||||
|
|
||||||
sch = qdisc_alloc(dev, ops);
|
sch = qdisc_alloc(dev, ops);
|
||||||
if (IS_ERR(sch))
|
if (IS_ERR(sch))
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -478,7 +478,7 @@ void qdisc_reset(struct Qdisc *qdisc)
|
|||||||
ops->reset(qdisc);
|
ops->reset(qdisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is the rcu callback function to clean up a qdisc when there
|
/* this is the rcu callback function to clean up a qdisc when there
|
||||||
* are no further references to it */
|
* are no further references to it */
|
||||||
|
|
||||||
static void __qdisc_destroy(struct rcu_head *head)
|
static void __qdisc_destroy(struct rcu_head *head)
|
||||||
@ -600,10 +600,10 @@ void dev_shutdown(struct net_device *dev)
|
|||||||
dev->qdisc_sleeping = &noop_qdisc;
|
dev->qdisc_sleeping = &noop_qdisc;
|
||||||
qdisc_destroy(qdisc);
|
qdisc_destroy(qdisc);
|
||||||
#if defined(CONFIG_NET_SCH_INGRESS) || defined(CONFIG_NET_SCH_INGRESS_MODULE)
|
#if defined(CONFIG_NET_SCH_INGRESS) || defined(CONFIG_NET_SCH_INGRESS_MODULE)
|
||||||
if ((qdisc = dev->qdisc_ingress) != NULL) {
|
if ((qdisc = dev->qdisc_ingress) != NULL) {
|
||||||
dev->qdisc_ingress = NULL;
|
dev->qdisc_ingress = NULL;
|
||||||
qdisc_destroy(qdisc);
|
qdisc_destroy(qdisc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
BUG_TRAP(!timer_pending(&dev->watchdog_timer));
|
BUG_TRAP(!timer_pending(&dev->watchdog_timer));
|
||||||
qdisc_unlock_tree(dev);
|
qdisc_unlock_tree(dev);
|
||||||
|
@ -335,7 +335,7 @@ static void gred_reset(struct Qdisc* sch)
|
|||||||
|
|
||||||
qdisc_reset_queue(sch);
|
qdisc_reset_queue(sch);
|
||||||
|
|
||||||
for (i = 0; i < t->DPs; i++) {
|
for (i = 0; i < t->DPs; i++) {
|
||||||
struct gred_sched_data *q = t->tab[i];
|
struct gred_sched_data *q = t->tab[i];
|
||||||
|
|
||||||
if (!q)
|
if (!q)
|
||||||
@ -393,7 +393,7 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct rtattr *dps)
|
|||||||
"shadowed VQ 0x%x\n", i);
|
"shadowed VQ 0x%x\n", i);
|
||||||
gred_destroy_vq(table->tab[i]);
|
gred_destroy_vq(table->tab[i]);
|
||||||
table->tab[i] = NULL;
|
table->tab[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -284,7 +284,7 @@ static inline struct hfsc_class *
|
|||||||
eltree_get_minel(struct hfsc_sched *q)
|
eltree_get_minel(struct hfsc_sched *q)
|
||||||
{
|
{
|
||||||
struct rb_node *n;
|
struct rb_node *n;
|
||||||
|
|
||||||
n = rb_first(&q->eligible);
|
n = rb_first(&q->eligible);
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -773,7 +773,7 @@ init_vf(struct hfsc_class *cl, unsigned int len)
|
|||||||
/* update the virtual curve */
|
/* update the virtual curve */
|
||||||
vt = cl->cl_vt + cl->cl_vtoff;
|
vt = cl->cl_vt + cl->cl_vtoff;
|
||||||
rtsc_min(&cl->cl_virtual, &cl->cl_fsc, vt,
|
rtsc_min(&cl->cl_virtual, &cl->cl_fsc, vt,
|
||||||
cl->cl_total);
|
cl->cl_total);
|
||||||
if (cl->cl_virtual.x == vt) {
|
if (cl->cl_virtual.x == vt) {
|
||||||
cl->cl_virtual.x -= cl->cl_vtoff;
|
cl->cl_virtual.x -= cl->cl_vtoff;
|
||||||
cl->cl_vtoff = 0;
|
cl->cl_vtoff = 0;
|
||||||
@ -796,10 +796,10 @@ init_vf(struct hfsc_class *cl, unsigned int len)
|
|||||||
|
|
||||||
/* update the ulimit curve */
|
/* update the ulimit curve */
|
||||||
rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time,
|
rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time,
|
||||||
cl->cl_total);
|
cl->cl_total);
|
||||||
/* compute myf */
|
/* compute myf */
|
||||||
cl->cl_myf = rtsc_y2x(&cl->cl_ulimit,
|
cl->cl_myf = rtsc_y2x(&cl->cl_ulimit,
|
||||||
cl->cl_total);
|
cl->cl_total);
|
||||||
cl->cl_myfadj = 0;
|
cl->cl_myfadj = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -853,7 +853,7 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
|
|||||||
* update vt and f
|
* update vt and f
|
||||||
*/
|
*/
|
||||||
cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total)
|
cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total)
|
||||||
- cl->cl_vtoff + cl->cl_vtadj;
|
- cl->cl_vtoff + cl->cl_vtadj;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if vt of the class is smaller than cvtmin,
|
* if vt of the class is smaller than cvtmin,
|
||||||
@ -870,7 +870,7 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
|
|||||||
|
|
||||||
if (cl->cl_flags & HFSC_USC) {
|
if (cl->cl_flags & HFSC_USC) {
|
||||||
cl->cl_myf = cl->cl_myfadj + rtsc_y2x(&cl->cl_ulimit,
|
cl->cl_myf = cl->cl_myfadj + rtsc_y2x(&cl->cl_ulimit,
|
||||||
cl->cl_total);
|
cl->cl_total);
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* This code causes classes to stay way under their
|
* This code causes classes to stay way under their
|
||||||
@ -1001,7 +1001,7 @@ hfsc_find_class(u32 classid, struct Qdisc *sch)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
hfsc_change_rsc(struct hfsc_class *cl, struct tc_service_curve *rsc,
|
hfsc_change_rsc(struct hfsc_class *cl, struct tc_service_curve *rsc,
|
||||||
u64 cur_time)
|
u64 cur_time)
|
||||||
{
|
{
|
||||||
sc2isc(rsc, &cl->cl_rsc);
|
sc2isc(rsc, &cl->cl_rsc);
|
||||||
rtsc_init(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
|
rtsc_init(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
|
||||||
@ -1023,7 +1023,7 @@ hfsc_change_fsc(struct hfsc_class *cl, struct tc_service_curve *fsc)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc,
|
hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc,
|
||||||
u64 cur_time)
|
u64 cur_time)
|
||||||
{
|
{
|
||||||
sc2isc(usc, &cl->cl_usc);
|
sc2isc(usc, &cl->cl_usc);
|
||||||
rtsc_init(&cl->cl_ulimit, &cl->cl_usc, cur_time, cl->cl_total);
|
rtsc_init(&cl->cl_ulimit, &cl->cl_usc, cur_time, cl->cl_total);
|
||||||
@ -1032,7 +1032,7 @@ hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct rtattr **tca, unsigned long *arg)
|
struct rtattr **tca, unsigned long *arg)
|
||||||
{
|
{
|
||||||
struct hfsc_sched *q = qdisc_priv(sch);
|
struct hfsc_sched *q = qdisc_priv(sch);
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)*arg;
|
struct hfsc_class *cl = (struct hfsc_class *)*arg;
|
||||||
@ -1228,9 +1228,9 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
|||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case TC_ACT_QUEUED:
|
case TC_ACT_QUEUED:
|
||||||
case TC_ACT_STOLEN:
|
case TC_ACT_STOLEN:
|
||||||
*qerr = NET_XMIT_SUCCESS;
|
*qerr = NET_XMIT_SUCCESS;
|
||||||
case TC_ACT_SHOT:
|
case TC_ACT_SHOT:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_NET_CLS_POLICE)
|
#elif defined(CONFIG_NET_CLS_POLICE)
|
||||||
@ -1259,7 +1259,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old)
|
||||||
{
|
{
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
||||||
|
|
||||||
@ -1397,7 +1397,7 @@ hfsc_dump_curves(struct sk_buff *skb, struct hfsc_class *cl)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
|
hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
|
||||||
struct tcmsg *tcm)
|
struct tcmsg *tcm)
|
||||||
{
|
{
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
||||||
unsigned char *b = skb->tail;
|
unsigned char *b = skb->tail;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Credits (in time order) for older HTB versions:
|
* Credits (in time order) for older HTB versions:
|
||||||
* Stef Coene <stef.coene@docum.org>
|
* Stef Coene <stef.coene@docum.org>
|
||||||
* HTB support at LARTC mailing list
|
* HTB support at LARTC mailing list
|
||||||
* Ondrej Kraus, <krauso@barr.cz>
|
* Ondrej Kraus, <krauso@barr.cz>
|
||||||
* found missing INIT_QDISC(htb)
|
* found missing INIT_QDISC(htb)
|
||||||
* Vladimir Smelhaus, Aamer Akhter, Bert Hubert
|
* Vladimir Smelhaus, Aamer Akhter, Bert Hubert
|
||||||
* helped a lot to locate nasty class stall bug
|
* helped a lot to locate nasty class stall bug
|
||||||
@ -59,11 +59,11 @@
|
|||||||
Author: devik@cdi.cz
|
Author: devik@cdi.cz
|
||||||
========================================================================
|
========================================================================
|
||||||
HTB is like TBF with multiple classes. It is also similar to CBQ because
|
HTB is like TBF with multiple classes. It is also similar to CBQ because
|
||||||
it allows to assign priority to each class in hierarchy.
|
it allows to assign priority to each class in hierarchy.
|
||||||
In fact it is another implementation of Floyd's formal sharing.
|
In fact it is another implementation of Floyd's formal sharing.
|
||||||
|
|
||||||
Levels:
|
Levels:
|
||||||
Each class is assigned level. Leaf has ALWAYS level 0 and root
|
Each class is assigned level. Leaf has ALWAYS level 0 and root
|
||||||
classes have level TC_HTB_MAXDEPTH-1. Interior nodes has level
|
classes have level TC_HTB_MAXDEPTH-1. Interior nodes has level
|
||||||
one less than their parent.
|
one less than their parent.
|
||||||
*/
|
*/
|
||||||
@ -245,7 +245,7 @@ static inline struct htb_class *htb_find(u32 handle, struct Qdisc *sch)
|
|||||||
* We allow direct class selection by classid in priority. The we examine
|
* We allow direct class selection by classid in priority. The we examine
|
||||||
* filters in qdisc and in inner nodes (if higher filter points to the inner
|
* filters in qdisc and in inner nodes (if higher filter points to the inner
|
||||||
* node). If we end up with classid MAJOR:0 we enqueue the skb into special
|
* node). If we end up with classid MAJOR:0 we enqueue the skb into special
|
||||||
* internal fifo (direct). These packets then go directly thru. If we still
|
* internal fifo (direct). These packets then go directly thru. If we still
|
||||||
* have no valid leaf we try to use MAJOR:default leaf. It still unsuccessfull
|
* have no valid leaf we try to use MAJOR:default leaf. It still unsuccessfull
|
||||||
* then finish and return direct queue.
|
* then finish and return direct queue.
|
||||||
*/
|
*/
|
||||||
@ -433,7 +433,7 @@ static inline void htb_remove_class_from_row(struct htb_sched *q,
|
|||||||
* htb_activate_prios - creates active classe's feed chain
|
* htb_activate_prios - creates active classe's feed chain
|
||||||
*
|
*
|
||||||
* The class is connected to ancestors and/or appropriate rows
|
* The class is connected to ancestors and/or appropriate rows
|
||||||
* for priorities it is participating on. cl->cmode must be new
|
* for priorities it is participating on. cl->cmode must be new
|
||||||
* (activated) mode. It does nothing if cl->prio_activity == 0.
|
* (activated) mode. It does nothing if cl->prio_activity == 0.
|
||||||
*/
|
*/
|
||||||
static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
|
static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
|
||||||
@ -466,7 +466,7 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
|
|||||||
/**
|
/**
|
||||||
* htb_deactivate_prios - remove class from feed chain
|
* htb_deactivate_prios - remove class from feed chain
|
||||||
*
|
*
|
||||||
* cl->cmode must represent old mode (before deactivation). It does
|
* cl->cmode must represent old mode (before deactivation). It does
|
||||||
* nothing if cl->prio_activity == 0. Class is removed from all feed
|
* nothing if cl->prio_activity == 0. Class is removed from all feed
|
||||||
* chains and rows.
|
* chains and rows.
|
||||||
*/
|
*/
|
||||||
@ -524,9 +524,9 @@ static inline long htb_hiwater(const struct htb_class *cl)
|
|||||||
*
|
*
|
||||||
* It computes cl's mode at time cl->t_c+diff and returns it. If mode
|
* It computes cl's mode at time cl->t_c+diff and returns it. If mode
|
||||||
* is not HTB_CAN_SEND then cl->pq_key is updated to time difference
|
* is not HTB_CAN_SEND then cl->pq_key is updated to time difference
|
||||||
* from now to time when cl will change its state.
|
* from now to time when cl will change its state.
|
||||||
* Also it is worth to note that class mode doesn't change simply
|
* Also it is worth to note that class mode doesn't change simply
|
||||||
* at cl->{c,}tokens == 0 but there can rather be hysteresis of
|
* at cl->{c,}tokens == 0 but there can rather be hysteresis of
|
||||||
* 0 .. -cl->{c,}buffer range. It is meant to limit number of
|
* 0 .. -cl->{c,}buffer range. It is meant to limit number of
|
||||||
* mode transitions per time unit. The speed gain is about 1/6.
|
* mode transitions per time unit. The speed gain is about 1/6.
|
||||||
*/
|
*/
|
||||||
@ -575,7 +575,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htb_activate - inserts leaf cl into appropriate active feeds
|
* htb_activate - inserts leaf cl into appropriate active feeds
|
||||||
*
|
*
|
||||||
* Routine learns (new) priority of leaf and activates feed chain
|
* Routine learns (new) priority of leaf and activates feed chain
|
||||||
* for the prio. It can be called on already active leaf safely.
|
* for the prio. It can be called on already active leaf safely.
|
||||||
@ -594,7 +594,7 @@ static inline void htb_activate(struct htb_sched *q, struct htb_class *cl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htb_deactivate - remove leaf cl from active feeds
|
* htb_deactivate - remove leaf cl from active feeds
|
||||||
*
|
*
|
||||||
* Make sure that leaf is active. In the other words it can't be called
|
* Make sure that leaf is active. In the other words it can't be called
|
||||||
* with non-active leaf. It also removes class from the drop list.
|
* with non-active leaf. It also removes class from the drop list.
|
||||||
@ -854,7 +854,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio,
|
|||||||
|
|
||||||
for (i = 0; i < 65535; i++) {
|
for (i = 0; i < 65535; i++) {
|
||||||
if (!*sp->pptr && *sp->pid) {
|
if (!*sp->pptr && *sp->pid) {
|
||||||
/* ptr was invalidated but id is valid - try to recover
|
/* ptr was invalidated but id is valid - try to recover
|
||||||
the original or next ptr */
|
the original or next ptr */
|
||||||
*sp->pptr =
|
*sp->pptr =
|
||||||
htb_id_find_next_upper(prio, sp->root, *sp->pid);
|
htb_id_find_next_upper(prio, sp->root, *sp->pid);
|
||||||
@ -906,7 +906,7 @@ next:
|
|||||||
|
|
||||||
/* class can be empty - it is unlikely but can be true if leaf
|
/* class can be empty - it is unlikely but can be true if leaf
|
||||||
qdisc drops packets in enqueue routine or if someone used
|
qdisc drops packets in enqueue routine or if someone used
|
||||||
graft operation on the leaf since last dequeue;
|
graft operation on the leaf since last dequeue;
|
||||||
simply deactivate and skip such class */
|
simply deactivate and skip such class */
|
||||||
if (unlikely(cl->un.leaf.q->q.qlen == 0)) {
|
if (unlikely(cl->un.leaf.q->q.qlen == 0)) {
|
||||||
struct htb_class *next;
|
struct htb_class *next;
|
||||||
@ -1229,7 +1229,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
|||||||
if (cl && !cl->level) {
|
if (cl && !cl->level) {
|
||||||
if (new == NULL &&
|
if (new == NULL &&
|
||||||
(new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
|
(new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
|
||||||
cl->classid))
|
cl->classid))
|
||||||
== NULL)
|
== NULL)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
sch_tree_lock(sch);
|
sch_tree_lock(sch);
|
||||||
@ -1347,7 +1347,7 @@ static void htb_destroy(struct Qdisc *sch)
|
|||||||
del_timer_sync(&q->rttim);
|
del_timer_sync(&q->rttim);
|
||||||
#endif
|
#endif
|
||||||
/* This line used to be after htb_destroy_class call below
|
/* This line used to be after htb_destroy_class call below
|
||||||
and surprisingly it worked in 2.4. But it must precede it
|
and surprisingly it worked in 2.4. But it must precede it
|
||||||
because filter need its target class alive to be able to call
|
because filter need its target class alive to be able to call
|
||||||
unbind_filter on it (without Oops). */
|
unbind_filter on it (without Oops). */
|
||||||
htb_destroy_filters(&q->filter_list);
|
htb_destroy_filters(&q->filter_list);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* net/sched/sch_ingress.c - Ingress qdisc
|
/* net/sched/sch_ingress.c - Ingress qdisc
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version
|
* as published by the Free Software Foundation; either version
|
||||||
@ -47,7 +47,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef CONFIG_NET_CLS_ACT
|
#ifndef CONFIG_NET_CLS_ACT
|
||||||
#ifdef CONFIG_NETFILTER
|
#ifdef CONFIG_NETFILTER
|
||||||
static int nf_registered;
|
static int nf_registered;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ static int ingress_graft(struct Qdisc *sch,unsigned long arg,
|
|||||||
DPRINTK("ingress_graft(sch %p,[qdisc %p],new %p,old %p)\n",
|
DPRINTK("ingress_graft(sch %p,[qdisc %p],new %p,old %p)\n",
|
||||||
sch, p, new, old);
|
sch, p, new, old);
|
||||||
DPRINTK("\n ingress_graft: You cannot add qdiscs to classes");
|
DPRINTK("\n ingress_graft: You cannot add qdiscs to classes");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
|
|||||||
case TC_ACT_QUEUED:
|
case TC_ACT_QUEUED:
|
||||||
result = TC_ACT_STOLEN;
|
result = TC_ACT_STOLEN;
|
||||||
break;
|
break;
|
||||||
case TC_ACT_RECLASSIFY:
|
case TC_ACT_RECLASSIFY:
|
||||||
case TC_ACT_OK:
|
case TC_ACT_OK:
|
||||||
case TC_ACT_UNSPEC:
|
case TC_ACT_UNSPEC:
|
||||||
default:
|
default:
|
||||||
@ -172,7 +172,7 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
|
|||||||
};
|
};
|
||||||
/* backward compat */
|
/* backward compat */
|
||||||
#else
|
#else
|
||||||
#ifdef CONFIG_NET_CLS_POLICE
|
#ifdef CONFIG_NET_CLS_POLICE
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case TC_POLICE_SHOT:
|
case TC_POLICE_SHOT:
|
||||||
result = NF_DROP;
|
result = NF_DROP;
|
||||||
@ -232,14 +232,14 @@ static unsigned int ingress_drop(struct Qdisc *sch)
|
|||||||
#ifdef CONFIG_NETFILTER
|
#ifdef CONFIG_NETFILTER
|
||||||
static unsigned int
|
static unsigned int
|
||||||
ing_hook(unsigned int hook, struct sk_buff **pskb,
|
ing_hook(unsigned int hook, struct sk_buff **pskb,
|
||||||
const struct net_device *indev,
|
const struct net_device *indev,
|
||||||
const struct net_device *outdev,
|
const struct net_device *outdev,
|
||||||
int (*okfn)(struct sk_buff *))
|
int (*okfn)(struct sk_buff *))
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Qdisc *q;
|
struct Qdisc *q;
|
||||||
struct sk_buff *skb = *pskb;
|
struct sk_buff *skb = *pskb;
|
||||||
struct net_device *dev = skb->dev;
|
struct net_device *dev = skb->dev;
|
||||||
int fwres=NF_ACCEPT;
|
int fwres=NF_ACCEPT;
|
||||||
|
|
||||||
DPRINTK("ing_hook: skb %s dev=%s len=%u\n",
|
DPRINTK("ing_hook: skb %s dev=%s len=%u\n",
|
||||||
@ -247,7 +247,7 @@ ing_hook(unsigned int hook, struct sk_buff **pskb,
|
|||||||
skb->dev ? (*pskb)->dev->name : "(no dev)",
|
skb->dev ? (*pskb)->dev->name : "(no dev)",
|
||||||
skb->len);
|
skb->len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
revisit later: Use a private since lock dev->queue_lock is also
|
revisit later: Use a private since lock dev->queue_lock is also
|
||||||
used on the egress (might slow things for an iota)
|
used on the egress (might slow things for an iota)
|
||||||
*/
|
*/
|
||||||
@ -257,8 +257,8 @@ used on the egress (might slow things for an iota)
|
|||||||
if ((q = dev->qdisc_ingress) != NULL)
|
if ((q = dev->qdisc_ingress) != NULL)
|
||||||
fwres = q->enqueue(skb, q);
|
fwres = q->enqueue(skb, q);
|
||||||
spin_unlock(&dev->queue_lock);
|
spin_unlock(&dev->queue_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fwres;
|
return fwres;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ static int ingress_init(struct Qdisc *sch,struct rtattr *opt)
|
|||||||
printk("Ingress scheduler: Classifier actions prefered over netfilter\n");
|
printk("Ingress scheduler: Classifier actions prefered over netfilter\n");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_NET_CLS_ACT
|
#ifndef CONFIG_NET_CLS_ACT
|
||||||
#ifdef CONFIG_NETFILTER
|
#ifdef CONFIG_NETFILTER
|
||||||
if (!nf_registered) {
|
if (!nf_registered) {
|
||||||
@ -417,7 +417,7 @@ static int __init ingress_module_init(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static void __exit ingress_module_exit(void)
|
static void __exit ingress_module_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&ingress_qdisc_ops);
|
unregister_qdisc(&ingress_qdisc_ops);
|
||||||
#ifndef CONFIG_NET_CLS_ACT
|
#ifndef CONFIG_NET_CLS_ACT
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 2 of the License.
|
* 2 of the License.
|
||||||
*
|
*
|
||||||
* Many of the algorithms and ideas for this came from
|
* Many of the algorithms and ideas for this came from
|
||||||
* NIST Net which is not copyrighted.
|
* NIST Net which is not copyrighted.
|
||||||
*
|
*
|
||||||
* Authors: Stephen Hemminger <shemminger@osdl.org>
|
* Authors: Stephen Hemminger <shemminger@osdl.org>
|
||||||
* Catalin(ux aka Dino) BOIE <catab at umbrella dot ro>
|
* Catalin(ux aka Dino) BOIE <catab at umbrella dot ro>
|
||||||
@ -114,7 +114,7 @@ static unsigned long get_crandom(struct crndstate *state)
|
|||||||
* std deviation sigma. Uses table lookup to approximate the desired
|
* std deviation sigma. Uses table lookup to approximate the desired
|
||||||
* distribution, and a uniformly-distributed pseudo-random source.
|
* distribution, and a uniformly-distributed pseudo-random source.
|
||||||
*/
|
*/
|
||||||
static long tabledist(unsigned long mu, long sigma,
|
static long tabledist(unsigned long mu, long sigma,
|
||||||
struct crndstate *state, const struct disttable *dist)
|
struct crndstate *state, const struct disttable *dist)
|
||||||
{
|
{
|
||||||
long t, x;
|
long t, x;
|
||||||
@ -126,7 +126,7 @@ static long tabledist(unsigned long mu, long sigma,
|
|||||||
rnd = get_crandom(state);
|
rnd = get_crandom(state);
|
||||||
|
|
||||||
/* default uniform distribution */
|
/* default uniform distribution */
|
||||||
if (dist == NULL)
|
if (dist == NULL)
|
||||||
return (rnd % (2*sigma)) - sigma + mu;
|
return (rnd % (2*sigma)) - sigma + mu;
|
||||||
|
|
||||||
t = dist->table[rnd % dist->size];
|
t = dist->table[rnd % dist->size];
|
||||||
@ -218,7 +218,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
|||||||
++q->counter;
|
++q->counter;
|
||||||
ret = q->qdisc->enqueue(skb, q->qdisc);
|
ret = q->qdisc->enqueue(skb, q->qdisc);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Do re-ordering by putting one out of N packets at the front
|
* Do re-ordering by putting one out of N packets at the front
|
||||||
* of the queue.
|
* of the queue.
|
||||||
*/
|
*/
|
||||||
@ -323,7 +323,7 @@ static void netem_reset(struct Qdisc *sch)
|
|||||||
/* Pass size change message down to embedded FIFO */
|
/* Pass size change message down to embedded FIFO */
|
||||||
static int set_fifo_limit(struct Qdisc *q, int limit)
|
static int set_fifo_limit(struct Qdisc *q, int limit)
|
||||||
{
|
{
|
||||||
struct rtattr *rta;
|
struct rtattr *rta;
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
/* Hack to avoid sending change message to non-FIFO */
|
/* Hack to avoid sending change message to non-FIFO */
|
||||||
@ -333,9 +333,9 @@ static int set_fifo_limit(struct Qdisc *q, int limit)
|
|||||||
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
|
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
|
||||||
if (rta) {
|
if (rta) {
|
||||||
rta->rta_type = RTM_NEWQDISC;
|
rta->rta_type = RTM_NEWQDISC;
|
||||||
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
||||||
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
|
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
|
||||||
|
|
||||||
ret = q->ops->change(q, rta);
|
ret = q->ops->change(q, rta);
|
||||||
kfree(rta);
|
kfree(rta);
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ static int get_dist_table(struct Qdisc *sch, const struct rtattr *attr)
|
|||||||
d->size = n;
|
d->size = n;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
d->table[i] = data[i];
|
d->table[i] = data[i];
|
||||||
|
|
||||||
spin_lock_bh(&sch->dev->queue_lock);
|
spin_lock_bh(&sch->dev->queue_lock);
|
||||||
d = xchg(&q->delay_dist, d);
|
d = xchg(&q->delay_dist, d);
|
||||||
spin_unlock_bh(&sch->dev->queue_lock);
|
spin_unlock_bh(&sch->dev->queue_lock);
|
||||||
@ -419,7 +419,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
|
|||||||
struct netem_sched_data *q = qdisc_priv(sch);
|
struct netem_sched_data *q = qdisc_priv(sch);
|
||||||
struct tc_netem_qopt *qopt;
|
struct tc_netem_qopt *qopt;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
|
if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
|
|||||||
pr_debug("netem: can't set fifo limit\n");
|
pr_debug("netem: can't set fifo limit\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
q->latency = qopt->latency;
|
q->latency = qopt->latency;
|
||||||
q->jitter = qopt->jitter;
|
q->jitter = qopt->jitter;
|
||||||
q->limit = qopt->limit;
|
q->limit = qopt->limit;
|
||||||
@ -445,10 +445,10 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
|
|||||||
|
|
||||||
/* Handle nested options after initial queue options.
|
/* Handle nested options after initial queue options.
|
||||||
* Should have put all options in nested format but too late now.
|
* Should have put all options in nested format but too late now.
|
||||||
*/
|
*/
|
||||||
if (RTA_PAYLOAD(opt) > sizeof(*qopt)) {
|
if (RTA_PAYLOAD(opt) > sizeof(*qopt)) {
|
||||||
struct rtattr *tb[TCA_NETEM_MAX];
|
struct rtattr *tb[TCA_NETEM_MAX];
|
||||||
if (rtattr_parse(tb, TCA_NETEM_MAX,
|
if (rtattr_parse(tb, TCA_NETEM_MAX,
|
||||||
RTA_DATA(opt) + sizeof(*qopt),
|
RTA_DATA(opt) + sizeof(*qopt),
|
||||||
RTA_PAYLOAD(opt) - sizeof(*qopt)))
|
RTA_PAYLOAD(opt) - sizeof(*qopt)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -681,7 +681,7 @@ static void netem_put(struct Qdisc *sch, unsigned long arg)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct rtattr **tca, unsigned long *arg)
|
struct rtattr **tca, unsigned long *arg)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 2 of the License, or (at your option) any later version.
|
* 2 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||||
* Fixes: 19990609: J Hadi Salim <hadi@nortelnetworks.com>:
|
* Fixes: 19990609: J Hadi Salim <hadi@nortelnetworks.com>:
|
||||||
* Init -- EINVAL when opt undefined
|
* Init -- EINVAL when opt undefined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
|||||||
return NET_XMIT_SUCCESS;
|
return NET_XMIT_SUCCESS;
|
||||||
}
|
}
|
||||||
sch->qstats.drops++;
|
sch->qstats.drops++;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ static int __init prio_module_init(void)
|
|||||||
return register_qdisc(&prio_qdisc_ops);
|
return register_qdisc(&prio_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit prio_module_exit(void)
|
static void __exit prio_module_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&prio_qdisc_ops);
|
unregister_qdisc(&prio_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit)
|
|||||||
TC_H_MAKE(sch->handle, 1));
|
TC_H_MAKE(sch->handle, 1));
|
||||||
if (q) {
|
if (q) {
|
||||||
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)),
|
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (rta) {
|
if (rta) {
|
||||||
rta->rta_type = RTM_NEWQDISC;
|
rta->rta_type = RTM_NEWQDISC;
|
||||||
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
Queuing using Deficit Round Robin", Proc. SIGCOMM 95.
|
Queuing using Deficit Round Robin", Proc. SIGCOMM 95.
|
||||||
|
|
||||||
|
|
||||||
This is not the thing that is usually called (W)FQ nowadays.
|
This is not the thing that is usually called (W)FQ nowadays.
|
||||||
It does not use any timestamp mechanism, but instead
|
It does not use any timestamp mechanism, but instead
|
||||||
processes queues in round-robin order.
|
processes queues in round-robin order.
|
||||||
|
|
||||||
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
DRAWBACKS:
|
DRAWBACKS:
|
||||||
|
|
||||||
- "Stochastic" -> It is not 100% fair.
|
- "Stochastic" -> It is not 100% fair.
|
||||||
When hash collisions occur, several flows are considered as one.
|
When hash collisions occur, several flows are considered as one.
|
||||||
|
|
||||||
- "Round-robin" -> It introduces larger delays than virtual clock
|
- "Round-robin" -> It introduces larger delays than virtual clock
|
||||||
@ -501,7 +501,7 @@ static int __init sfq_module_init(void)
|
|||||||
{
|
{
|
||||||
return register_qdisc(&sfq_qdisc_ops);
|
return register_qdisc(&sfq_qdisc_ops);
|
||||||
}
|
}
|
||||||
static void __exit sfq_module_exit(void)
|
static void __exit sfq_module_exit(void)
|
||||||
{
|
{
|
||||||
unregister_qdisc(&sfq_qdisc_ops);
|
unregister_qdisc(&sfq_qdisc_ops);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ static void tbf_reset(struct Qdisc* sch)
|
|||||||
static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit)
|
static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit)
|
||||||
{
|
{
|
||||||
struct Qdisc *q;
|
struct Qdisc *q;
|
||||||
struct rtattr *rta;
|
struct rtattr *rta;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops,
|
q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops,
|
||||||
@ -285,7 +285,7 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit)
|
|||||||
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
|
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
|
||||||
if (rta) {
|
if (rta) {
|
||||||
rta->rta_type = RTM_NEWQDISC;
|
rta->rta_type = RTM_NEWQDISC;
|
||||||
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
|
||||||
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
|
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
|
||||||
|
|
||||||
ret = q->ops->change(q, rta);
|
ret = q->ops->change(q, rta);
|
||||||
@ -475,7 +475,7 @@ static void tbf_put(struct Qdisc *sch, unsigned long arg)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct rtattr **tca, unsigned long *arg)
|
struct rtattr **tca, unsigned long *arg)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
@ -178,7 +178,7 @@ teql_destroy(struct Qdisc* sch)
|
|||||||
teql_neigh_release(xchg(&dat->ncache, NULL));
|
teql_neigh_release(xchg(&dat->ncache, NULL));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((prev = q) != master->slaves);
|
} while ((prev = q) != master->slaves);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ restart:
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
struct net_device *slave = q->dev;
|
struct net_device *slave = q->dev;
|
||||||
|
|
||||||
if (slave->qdisc_sleeping != q)
|
if (slave->qdisc_sleeping != q)
|
||||||
continue;
|
continue;
|
||||||
if (netif_queue_stopped(slave) || ! netif_running(slave)) {
|
if (netif_queue_stopped(slave) || ! netif_running(slave)) {
|
||||||
@ -425,7 +425,7 @@ static __init void teql_master_setup(struct net_device *dev)
|
|||||||
|
|
||||||
master->dev = dev;
|
master->dev = dev;
|
||||||
ops->priv_size = sizeof(struct teql_sched_data);
|
ops->priv_size = sizeof(struct teql_sched_data);
|
||||||
|
|
||||||
ops->enqueue = teql_enqueue;
|
ops->enqueue = teql_enqueue;
|
||||||
ops->dequeue = teql_dequeue;
|
ops->dequeue = teql_dequeue;
|
||||||
ops->requeue = teql_requeue;
|
ops->requeue = teql_requeue;
|
||||||
@ -489,7 +489,7 @@ static int __init teql_init(void)
|
|||||||
return i ? 0 : err;
|
return i ? 0 : err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit teql_exit(void)
|
static void __exit teql_exit(void)
|
||||||
{
|
{
|
||||||
struct teql_master *master, *nxt;
|
struct teql_master *master, *nxt;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user