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/config.h>
14 #include <linux/version.h>
15 #include <linux/netdevice.h>
16 #include <net/ieee80211.h>
17 #include "ieee80211_i.h"
20 static int pfifo_enqueue(struct sk_buff
*skb
, struct Qdisc
* qd
)
22 struct sk_buff_head
*q
= qdisc_priv(qd
);
24 if (skb_queue_len(q
) > qd
->dev
->tx_queue_len
) {
30 skb_queue_tail(q
, skb
);
32 qd
->bstats
.bytes
+= skb
->len
;
35 return NET_XMIT_SUCCESS
;
39 static int pfifo_requeue(struct sk_buff
*skb
, struct Qdisc
* qd
)
41 struct sk_buff_head
*q
= qdisc_priv(qd
);
43 skb_queue_head(q
, skb
);
45 qd
->bstats
.bytes
+= skb
->len
;
48 return NET_XMIT_SUCCESS
;
52 static struct sk_buff
*pfifo_dequeue(struct Qdisc
* qd
)
54 struct sk_buff_head
*q
= qdisc_priv(qd
);
56 return skb_dequeue(q
);
60 static int pfifo_init(struct Qdisc
* qd
, struct rtattr
*opt
)
62 struct sk_buff_head
*q
= qdisc_priv(qd
);
64 skb_queue_head_init(q
);
69 static void pfifo_reset(struct Qdisc
* qd
)
71 struct sk_buff_head
*q
= qdisc_priv(qd
);
78 static int pfifo_dump(struct Qdisc
*qd
, struct sk_buff
*skb
)
84 struct Qdisc_ops pfifo_qdisc_ops
=
88 .id
= "ieee80211_pfifo",
89 .priv_size
= sizeof(struct sk_buff_head
),
91 .enqueue
= pfifo_enqueue
,
92 .dequeue
= pfifo_dequeue
,
93 .requeue
= pfifo_requeue
,