SVN-Revision: 15775
This commit is contained in:
Hauke Mehrtens 2009-05-11 20:20:41 +00:00
parent e0158d5d8c
commit 1b481e0708
2 changed files with 22 additions and 24 deletions

View File

@ -90,7 +90,7 @@
obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o
--- /dev/null --- /dev/null
+++ b/net/sched/sch_esfq.c +++ b/net/sched/sch_esfq.c
@@ -0,0 +1,702 @@ @@ -0,0 +1,700 @@
+/* +/*
+ * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline. + * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline.
+ * + *
@ -137,6 +137,7 @@
+#include <linux/notifier.h> +#include <linux/notifier.h>
+#include <linux/init.h> +#include <linux/init.h>
+#include <net/ip.h> +#include <net/ip.h>
+#include <net/netlink.h>
+#include <linux/ipv6.h> +#include <linux/ipv6.h>
+#include <net/route.h> +#include <net/route.h>
+#include <linux/skbuff.h> +#include <linux/skbuff.h>
@ -464,20 +465,17 @@
+ return NET_XMIT_CN; + return NET_XMIT_CN;
+} +}
+ +
+ +static struct sk_buff *esfq_peek(struct Qdisc* sch)
+static int esfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
+{ +{
+ struct esfq_sched_data *q = qdisc_priv(sch); + struct esfq_sched_data *q = qdisc_priv(sch);
+ esfq_q_enqueue(skb, q, ESFQ_HEAD); + esfq_index a;
+ sch->qstats.backlog += skb->len;
+ if (++sch->q.qlen < q->limit - 1) {
+ sch->qstats.requeues++;
+ return 0;
+ }
+ +
+ sch->qstats.drops++; + /* No active slots */
+ esfq_drop(sch); + if (q->tail == q->depth)
+ return NET_XMIT_CN; + return NULL;
+
+ a = q->next[q->tail];
+ return skb_peek(&q->qs[a]);
+} +}
+ +
+static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q) +static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q)
@ -602,13 +600,13 @@
+ } + }
+} +}
+ +
+static int esfq_q_init(struct esfq_sched_data *q, struct rtattr *opt) +static int esfq_q_init(struct esfq_sched_data *q, struct nlattr *opt)
+{ +{
+ struct tc_esfq_qopt *ctl = RTA_DATA(opt); + struct tc_esfq_qopt *ctl = nla_data(opt);
+ esfq_index p = ~0U/2; + esfq_index p = ~0U/2;
+ int i; + int i;
+ +
+ if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl))) + if (opt && opt->nla_len < nla_attr_size(sizeof(*ctl)))
+ return -EINVAL; + return -EINVAL;
+ +
+ q->perturbation = 0; + q->perturbation = 0;
@ -620,7 +618,7 @@
+ q->tail = q->limit = q->depth = 128; + q->tail = q->limit = q->depth = 128;
+ +
+ } else { + } else {
+ struct tc_esfq_qopt *ctl = RTA_DATA(opt); + struct tc_esfq_qopt *ctl = nla_data(opt);
+ if (ctl->quantum) + if (ctl->quantum)
+ q->quantum = ctl->quantum; + q->quantum = ctl->quantum;
+ q->perturb_period = ctl->perturb_period*HZ; + q->perturb_period = ctl->perturb_period*HZ;
@ -673,7 +671,7 @@
+ return -ENOBUFS; + return -ENOBUFS;
+} +}
+ +
+static int esfq_init(struct Qdisc *sch, struct rtattr *opt) +static int esfq_init(struct Qdisc *sch, struct nlattr *opt)
+{ +{
+ struct esfq_sched_data *q = qdisc_priv(sch); + struct esfq_sched_data *q = qdisc_priv(sch);
+ int err; + int err;
@ -693,7 +691,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int esfq_change(struct Qdisc *sch, struct rtattr *opt) +static int esfq_change(struct Qdisc *sch, struct nlattr *opt)
+{ +{
+ struct esfq_sched_data *q = qdisc_priv(sch); + struct esfq_sched_data *q = qdisc_priv(sch);
+ struct esfq_sched_data new; + struct esfq_sched_data new;
@ -744,7 +742,7 @@
+static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb) +static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb)
+{ +{
+ struct esfq_sched_data *q = qdisc_priv(sch); + struct esfq_sched_data *q = qdisc_priv(sch);
+ unsigned char *b = skb->tail; + unsigned char *b = skb_tail_pointer(skb);
+ struct tc_esfq_qopt opt; + struct tc_esfq_qopt opt;
+ +
+ opt.quantum = q->quantum; + opt.quantum = q->quantum;
@ -755,12 +753,12 @@
+ opt.flows = q->depth; + opt.flows = q->depth;
+ opt.hash_kind = q->hash_kind; + opt.hash_kind = q->hash_kind;
+ +
+ RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); + NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+ +
+ return skb->len; + return skb->len;
+ +
+rtattr_failure: +nla_put_failure:
+ skb_trim(skb, b - skb->data); + nlmsg_trim(skb, b);
+ return -1; + return -1;
+} +}
+ +
@ -772,7 +770,7 @@
+ .priv_size = sizeof(struct esfq_sched_data), + .priv_size = sizeof(struct esfq_sched_data),
+ .enqueue = esfq_enqueue, + .enqueue = esfq_enqueue,
+ .dequeue = esfq_dequeue, + .dequeue = esfq_dequeue,
+ .requeue = esfq_requeue, + .peek = esfq_peek,
+ .drop = esfq_drop, + .drop = esfq_drop,
+ .init = esfq_init, + .init = esfq_init,
+ .reset = esfq_reset, + .reset = esfq_reset,

View File

@ -125,7 +125,7 @@
+ +
+int hostap_restore_power(struct net_device *dev) +int hostap_restore_power(struct net_device *dev)
+{ +{
+ struct hostap_interface *iface = dev->priv; + struct hostap_interface *iface = netdev_priv(dev);
+ local_info_t *local = iface->local; + local_info_t *local = iface->local;
+ +
+ u16 val; + u16 val;