diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-12-28 13:22:51 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-12-28 13:22:51 +0000 |
commit | dc0b369ea1bb98a9835cfac7ff3899797e65227e (patch) | |
tree | 4b93267e8debb39c3d21fb80e42b893732728c90 /openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c | |
parent | 924cb86668a1a92b7d4bf96058ba0efa6c24f932 (diff) |
add devicescape 802.11 stack
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2791 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c')
-rw-r--r-- | openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c b/openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c new file mode 100644 index 000000000..95bc0b577 --- /dev/null +++ b/openwrt/target/linux/package/ieee80211-dscape/src/fifo_qdisc.c @@ -0,0 +1,103 @@ +/* + * Copyright 2005, Devicescape Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * If building without CONFIG_NET_SCHED we need a simple + * fifo qdisc to install by default as the sub-qdisc. + * This is a simple replacement for sch_fifo. + */ + +#include <linux/config.h> +#include <linux/version.h> +#include <linux/netdevice.h> +#include <net/ieee80211.h> +#include "ieee80211_i.h" +#include "wme.h" + +static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* qd) +{ + struct sk_buff_head *q = qdisc_priv(qd); + + if (skb_queue_len(q) > qd->dev->tx_queue_len) { + qd->qstats.drops++; + kfree_skb(skb); + return NET_XMIT_DROP; + } + + skb_queue_tail(q, skb); + qd->q.qlen++; + qd->bstats.bytes += skb->len; + qd->bstats.packets++; + + return NET_XMIT_SUCCESS; +} + + +static int pfifo_requeue(struct sk_buff *skb, struct Qdisc* qd) +{ + struct sk_buff_head *q = qdisc_priv(qd); + + skb_queue_head(q, skb); + qd->q.qlen++; + qd->bstats.bytes += skb->len; + qd->bstats.packets++; + + return NET_XMIT_SUCCESS; +} + + +static struct sk_buff *pfifo_dequeue(struct Qdisc* qd) +{ + struct sk_buff_head *q = qdisc_priv(qd); + + return skb_dequeue(q); +} + + +static int pfifo_init(struct Qdisc* qd, struct rtattr *opt) +{ + struct sk_buff_head *q = qdisc_priv(qd); + + skb_queue_head_init(q); + return 0; +} + + +static void pfifo_reset(struct Qdisc* qd) +{ + struct sk_buff_head *q = qdisc_priv(qd); + + skb_queue_purge(q); + qd->q.qlen = 0; +} + + +static int pfifo_dump(struct Qdisc *qd, struct sk_buff *skb) +{ + return skb->len; +} + + +struct Qdisc_ops pfifo_qdisc_ops = +{ + .next = NULL, + .cl_ops = NULL, + .id = "ieee80211_pfifo", + .priv_size = sizeof(struct sk_buff_head), + + .enqueue = pfifo_enqueue, + .dequeue = pfifo_dequeue, + .requeue = pfifo_requeue, + .drop = NULL, + + .init = pfifo_init, + .reset = pfifo_reset, + .destroy = NULL, + .change = NULL, + + .dump = pfifo_dump, +}; + |