CFE-ready mtd driver, needs fixing though, update kernel config
[openwrt.git] / package / d80211 / src / fifo_qdisc.c
1 /*
2 * Copyright 2005, Devicescape Software, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * If building without CONFIG_NET_SCHED we need a simple
9 * fifo qdisc to install by default as the sub-qdisc.
10 * This is a simple replacement for sch_fifo.
11 */
12
13 #include <linux/skbuff.h>
14 #include <net/pkt_sched.h>
15 #include <net/d80211.h>
16 #include "ieee80211_i.h"
17 #include "wme.h"
18
19 static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* qd)
20 {
21 struct sk_buff_head *q = qdisc_priv(qd);
22
23 if (skb_queue_len(q) > qd->dev->tx_queue_len) {
24 qd->qstats.drops++;
25 kfree_skb(skb);
26 return NET_XMIT_DROP;
27 }
28
29 skb_queue_tail(q, skb);
30 qd->q.qlen++;
31 qd->bstats.bytes += skb->len;
32 qd->bstats.packets++;
33
34 return NET_XMIT_SUCCESS;
35 }
36
37
38 static int pfifo_requeue(struct sk_buff *skb, struct Qdisc* qd)
39 {
40 struct sk_buff_head *q = qdisc_priv(qd);
41
42 skb_queue_head(q, skb);
43 qd->q.qlen++;
44 qd->bstats.bytes += skb->len;
45 qd->bstats.packets++;
46
47 return NET_XMIT_SUCCESS;
48 }
49
50
51 static struct sk_buff *pfifo_dequeue(struct Qdisc* qd)
52 {
53 struct sk_buff_head *q = qdisc_priv(qd);
54
55 return skb_dequeue(q);
56 }
57
58
59 static int pfifo_init(struct Qdisc* qd, struct rtattr *opt)
60 {
61 struct sk_buff_head *q = qdisc_priv(qd);
62
63 skb_queue_head_init(q);
64 return 0;
65 }
66
67
68 static void pfifo_reset(struct Qdisc* qd)
69 {
70 struct sk_buff_head *q = qdisc_priv(qd);
71
72 skb_queue_purge(q);
73 qd->q.qlen = 0;
74 }
75
76
77 static int pfifo_dump(struct Qdisc *qd, struct sk_buff *skb)
78 {
79 return skb->len;
80 }
81
82
83 struct Qdisc_ops pfifo_qdisc_ops =
84 {
85 .next = NULL,
86 .cl_ops = NULL,
87 .id = "ieee80211_pfifo",
88 .priv_size = sizeof(struct sk_buff_head),
89
90 .enqueue = pfifo_enqueue,
91 .dequeue = pfifo_dequeue,
92 .requeue = pfifo_requeue,
93 .drop = NULL,
94
95 .init = pfifo_init,
96 .reset = pfifo_reset,
97 .destroy = NULL,
98 .change = NULL,
99
100 .dump = pfifo_dump,
101 };
102
This page took 0.045785 seconds and 5 git commands to generate.