2 * Copyright 2005, Devicescape Software, Inc.
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.
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.
13 #include <linux/skbuff.h>
14 #include <net/pkt_sched.h>
15 #include <net/d80211.h>
16 #include "ieee80211_i.h"
19 static int pfifo_enqueue(struct sk_buff
*skb
, struct Qdisc
* qd
)
21 struct sk_buff_head
*q
= qdisc_priv(qd
);
23 if (skb_queue_len(q
) > qd
->dev
->tx_queue_len
) {
29 skb_queue_tail(q
, skb
);
31 qd
->bstats
.bytes
+= skb
->len
;
34 return NET_XMIT_SUCCESS
;
38 static int pfifo_requeue(struct sk_buff
*skb
, struct Qdisc
* qd
)
40 struct sk_buff_head
*q
= qdisc_priv(qd
);
42 skb_queue_head(q
, skb
);
44 qd
->bstats
.bytes
+= skb
->len
;
47 return NET_XMIT_SUCCESS
;
51 static struct sk_buff
*pfifo_dequeue(struct Qdisc
* qd
)
53 struct sk_buff_head
*q
= qdisc_priv(qd
);
55 return skb_dequeue(q
);
59 static int pfifo_init(struct Qdisc
* qd
, struct rtattr
*opt
)
61 struct sk_buff_head
*q
= qdisc_priv(qd
);
63 skb_queue_head_init(q
);
68 static void pfifo_reset(struct Qdisc
* qd
)
70 struct sk_buff_head
*q
= qdisc_priv(qd
);
77 static int pfifo_dump(struct Qdisc
*qd
, struct sk_buff
*skb
)
83 struct Qdisc_ops pfifo_qdisc_ops
=
87 .id
= "ieee80211_pfifo",
88 .priv_size
= sizeof(struct sk_buff_head
),
90 .enqueue
= pfifo_enqueue
,
91 .dequeue
= pfifo_dequeue
,
92 .requeue
= pfifo_requeue
,