hello, this is my new qdisc patch, when i recompile the kernel with this patch i dn''nt succeed please look at it and if there are any mistakes plesease send me a mail thanks in advance ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
hello,
this is my new qdisc patch, when i recompile the
kernel with this patch i dn''nt succeed please look
at it and if there are any mistakes plesease send me
a
mail
thanks in advance
_______________________________________________________
--- linux-2.4.7-10orig/net/sched/Config.in
+++ linux-2.4.4-10/net/sched/Config.in
# Traffic control configuration.
#
tristate '' CBQ packet scheduler'' CONFIG_NET_SCH_CBQ
+tristate '' EPD packet scheduler'' CONFIG_NET_SCH_EPD
tristate '' CSZ packet scheduler'' CONFIG_NET_SCH_CSZ
#tristate '' H-PFQ packet scheduler''
CONFIG_NET_SCH_HPFQ
#tristate '' H-FSC packet scheduler''
CONFIG_NET_SCH_HFCS
--- linux-2.4.7-10orig/net/sched/Makefile
+++ linux-2.4.7-10/net/sched/Makefile
obj-$(CONFIG_NET_SCH_CSZ) += sch_csz.o
obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
+obj-$(CONFIG_NET_SCH_EPD) += sch_epd.o
obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
obj-$(CONFIG_NET_SCH_RED) += sch_red.o
obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
--- linux-2.4.7-10orig/include/linux/pkt_sched.h
+++ linux-2.4.7-10/include/linux/pkt_sched.h
__u8 grio;
};
+/* EPD section*/
+struct tc_epd_qopt
+{
+ __u32 limit;
+ __u32 threshold;
+};
--- linux-2.4.7-10orig/net/sched/sch_api.c
+++ linux-2.4.7-10/net/sched/sch_api.c
#ifdef CONFIG_NET_SCH_CBQ
INIT_QDISC(cbq);
#endif
+#ifdef CONFIG_NET_SCH_EPD
+ INIT_QDISC(epd);
+#endif
#ifdef CONFIG_NET_SCH_CSZ
INIT_QDISC(csz);
#endif
--- linux-2.4.7-10orig/net/sched/sch_htb.c
+++ linux-2.4.7-10/net/sched/sch_htb.c
+/*
+ * net/sched/sch_epd.c Early packet discart
(adaptation for multimedia stream.)
+ *
+ * This program is free software; you can
redistribute it and/or
+ * modify it
+ * Authors: Alouini khalifa <k.alouini@voila.fr>
<powerdr1@yahoo.fr>
+ */
+#include <linux/config.h>
+#include <linux/module.h>
+#include <asm/uaccess.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/socket.h>
+#include <linux/sockios.h>
+#include <linux/in.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/if_ether.h>
+#include <linux/inet.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/notifier.h>
+#include <net/ip.h>
+#include <net/route.h>
+#include <linux/skbuff.h>
+#include <net/sock.h>
+#include <net/pkt_sched.h>
+#include <net/inet_ecn.h>
+
+
+/* Early packet discart (EPD) algorithm. Version 1.0
+ ======================================+ This discipline is taken from ATM
world,this version
is the simplest mode of EPD
+ In ATM, a packet is divided in many cells,if a new
packet arrive and we reach a
+ threshold then we have to drop all new data unit
(witch may be divided into
+ many cells) for the reason that one packet has no
signification if some of its
+ data(cells) are dropped so if we have to reject one
cell of a packet we have
+ to reject all sells that belongs to this packet (a
packet=data unit)
+ To adaptate this discipline for multimedia stream,
we market the IP packet
+ into the IP-OPION field (or TOS field) the number of
data unit at which it
+ belongs then we only have to extract this
information from the IP_OPTION
+ field (or from TOS fields)
+
+Short description.
+------------------
+
+ When a new packet arrives we look at the queue
length:
+
+
+ if (length <threshold) -> packet passed.
+ if (length >threshold) ->tow possibilitties
+ if (it is a new data unit) -> packet dropped
+ if( it is an old data unit) ->packet accepted
+ if (length =limit) ->packet dropped
+
+ Parameters, settable by user:
+ -----------------------------
+
+ limit - bytes
+ threshold -bytes
+*/
+#define NET_XMIT_DROP 0
+#define NET_XMIT_SUCCESS 1
+struct epd_sched_data
+{
+/* Parameters */
+ unsigned limit; /* HARD maximal queue length */
+ unsigned threshold; /* limit under witch, we drop a
new data unit*/
+
+/* Variables */
+ unsigned current_unit ; /* the last unit
passed into the queue */
+ unsigned dropped_unit; /*the unit that must be
dropped because one packet of this unit
+ was dropped (it is the number of the last
dropped unit) */
+};
+
+
+static int
+epd_enqueue(struct sk_buff *skb, struct Qdisc* sch)
+{
+ struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
+ int test =verify_data_unit(skb,sch); /*verify if
this packet belongs to data unit that is marked
dropped
+ then we have to drop this packet*/
+ if (test==0)
+ goto drop;
+ if (sch->stats.backlog <= q->threshold)
+ {
+ update_data_unit (skb,sch)/*if it is a new data
unit we have to update the current_unit value*/
+ goto enqueue;
+ }
+ else
+ {
+ u8 unit=skb->nh.iph->tos;
+ if (unit == q->current_unit)/*if it is a segment
of a data unit that is already enqueued
+ then we have to enqueue this packet*/
+ goto enqueue;
+ else
+ {
+ update_reject_unit(skb,sch);/*if it is a new unit
then apdate the dropped_unit value*/
+ goto drop;
+ }
+ }
+drop:
+ kfree_skb(skb);
+ sch->stats.drops++;
+ return NET_XMIT_DROP;
+
+enqueue:
+ __skb_queue_tail(&sch->q, skb);
+ sch->stats.backlog += skb->len;
+ sch->stats.bytes += skb->len;
+ sch->stats.packets++;
+ return NET_XMIT_SUCCESS;
+}
+
+static int
+epd_requeue(struct sk_buff *skb, struct Qdisc* sch)
+{
+ __skb_queue_head(&sch->q, skb);
+ sch->stats.backlog += skb->len;
+ return 0;
+}
+static struct sk_buff *
+epd_dequeue(struct Qdisc* sch)
+{
+ struct sk_buff *skb;
+
+ skb = __skb_dequeue(&sch->q);
+ if (skb)
+ sch->stats.backlog -= skb->len;
+ return skb;
+
+static int
+epd_drop(struct Qdisc* sch)
+{
+ struct sk_buff *skb;
+ skb = __skb_dequeue_tail(&sch->q);
+ if (skb) {
+ sch->stats.backlog -= skb->len;
+ sch->stats.drops++;
+ kfree_skb(skb);
+ return 1;
+ }
+ return 0;
+}
+static void
+epd_reset(struct Qdisc* sch)
+{
+ skb_queue_purge(&sch->q);
+ sch->stats.backlog = 0;
+}
+
+
+static int epd_change(struct Qdisc *sch, struct
rtattr *opt)
+{
+ return 0;
+}
+
+
+
+static void epd_destroy(struct Qdisc *sch)
+{
+ MOD_DEC_USE_COUNT;
+}
+
+static int
+epd_init(struct Qdisc *sch, struct rtattr *opt)
+{
+ struct epd_sched_data *q = (void*)sch->data;
+
+ if (opt == NULL) {
+ /* this is the first version ,no default
attributes*/
+ }
+ else
+ {
+ struct tc_epd_qopt *ctl = RTA_DATA(opt);
+ if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
+ return -EINVAL;
+ q->limit = ctl->limit;
+ q->threshold= clt->threshold;
+ q->current_unit=0;
+ q->dropped_unit=0;
+ }
+ return 0;
+}
+
+struct Qdisc_ops epd_qdisc_ops +{
+ NULL,
+ NULL,
+ "epd",
+ sizeof(struct epd_sched_data),
+
+ epd_enqueue,
+ epd_dequeue,
+ epd_requeue,
+ epd_drop,
+
+ epd_init,
+ epd_reset,
+ epd_destroy,
+ epd_change,
+
+
+#ifdef CONFIG_RTNETLINK
+ epd_dump,
+#endif
+};
+
+#ifdef CONFIG_RTNETLINK
+static int epd_dump(struct Qdisc *sch, struct sk_buff
*skb)
+{
+ struct epd_sched_data *q = (void*)sch->data;
+ unsigned char *b = skb->tail;
+ struct tc_epd_qopt opt;
+
+ opt.limit = q->limit;
+ RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+
+ return skb->len;
+
+rtattr_failure:
+ skb_trim(skb, b - skb->data);
+ return -1;
+}
+
+
+void
+update_reject_unit(sk_buffer *skb,struct Qdisc *sch)
+{
+unsigned unit= skb->nh.iph->tos;
+struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
+q->dropped_unit=unit;
+}
+void
+ update_data_unit (sk_buffer *skb,struct Qdisc *sch)
+{
+unsigned unit= skb->nh.iph->tos;
+struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
+if (q->current_unit != unit)
+ q->current_unit=unit;
+}
+
+static int
+ verify_data_unit(skb,sch)
+{
+unsigned unit=skb->nh.iph->tos;
+struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
+if (tos==q->dropped_unit)
+ return 0;
+else
+ return 1;
+}
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
alouini khalif
2002-Jun-08 12:22 UTC
New qdisc patch,(final code) please try it (what is the problem)
hello,
this is my new qdisc patch, when i recompile the
kernel with this patch i dn''nt succeed please look
at it and if there are any mistakes plesease send
me a mail
thanks in advance
----------------------------------------------------
--- linux-2.4.7-10orig/net/sched/Config.in
+++ linux-2.4.4-10/net/sched/Config.in
# Traffic control configuration.
#
tristate '' CBQ packet scheduler'' CONFIG_NET_SCH_CBQ
+tristate '' EPD packet scheduler'' CONFIG_NET_SCH_EPD
tristate '' CSZ packet scheduler'' CONFIG_NET_SCH_CSZ
--- linux-2.4.7-10orig/net/sched/Makefile
+++ linux-2.4.7-10/net/sched/Makefile
obj-$(CONFIG_NET_SCH_CSZ) += sch_csz.o
obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
+obj-$(CONFIG_NET_SCH_EPD) += sch_epd.o
obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
obj-$(CONFIG_NET_SCH_RED) += sch_red.o
obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
--- linux-2.4.7-10orig/include/linux/pkt_sched.h
+++ linux-2.4.7-10/include/linux/pkt_sched.h
__u8 grio;
};
+/* EPD section*/
+struct tc_epd_qopt
+{
+ __u32 limit;
+ __u32 threshold;
+};
--- linux-2.4.7-10orig/net/sched/sch_api.c
+++ linux-2.4.7-10/net/sched/sch_api.c
#ifdef CONFIG_NET_SCH_CBQ
INIT_QDISC(cbq);
#endif
+#ifdef CONFIG_NET_SCH_EPD
+ INIT_QDISC(epd);
+#endif
#ifdef CONFIG_NET_SCH_CSZ
INIT_QDISC(csz);
#endif
--- linux-2.4.7-10orig/net/sched/sch_htb.c
+++ linux-2.4.7-10/net/sched/sch_htb.c
+/*
+ * net/sched/sch_epd.c Early packet discart
+ *(adaptation for multimedia stream.)
+ *
+ *This program is free software; you can redistribute
+* it and/or modify it
+ * Authors: Alouini khalifa <k.alouini@voila.fr>
+ * <powerdr1@yahoo.fr>
+ */
+#include <linux/config.h>
+#include <linux/module.h>
+#include <asm/uaccess.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/socket.h>
+#include <linux/sockios.h>
+#include <linux/in.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/if_ether.h>
+#include <linux/inet.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/notifier.h>
+#include <net/ip.h>
+#include <net/route.h>
+#include <linux/skbuff.h>
+#include <net/sock.h>
+#include <net/pkt_sched.h>
+#include <net/inet_ecn.h>
+
+
+/*Early packet discart (EPD) algorithm. Version 1.0
+ ======================================+This discipline is taken from ATM
world,this version
+ is the simplest mode of EPD
+In ATM, a packet is divided in many cells,if a new
+ packet arrive and we reach a threshold then we have
+ to drop all new data unit (witch may be divided into
+many cells) for the reason that one packet has no
+ signification if some of its data(cells) are dropped
+ so if we have to reject one cell of a packet we have
+to reject all sells that belongs to this packet (a
+ packet=data unit)
+To adaptate this discipline for multimedia stream, we
+ market the IP packet into the IP-OPION field (or TOS
+ field) the number of data unit at which it belongs
+ then we only have to extract this information
+from the IP_OPTION field (or from TOS fields)
+
+Short description.
+------------------
+
+When a new packet arrives we look at the queue
+ length:
+
+
+if (length <threshold) -> packet passed.
+if (length >threshold) ->tow possibilitties
+1 if (it is a new data unit) -> packet dropped
+2 if( it is an old data unit) ->packet accepted
+if (length =limit) ->packet dropped
+
+ Parameters, settable by user:
+ -----------------------------
+
+ limit - bytes
+ threshold -bytes
+*/
+#define NET_XMIT_DROP 0
+#define NET_XMIT_SUCCESS 1
+struct epd_sched_data
+{
+/* Parameters */
+unsigned limit;/* HARD maximal queue length */
+unsigned threshold;/* limit under witch, we drop a
new
+ data unit*/
+
+/* Variables */
+unsigned current_unit ;
+ /* the last unit passed into the queue
*/
+unsigned dropped_unit;
+ /*the unit that must be dropped because one
+ packet of this unit was dropped (it is the number of
+ the last dropped unit) */
+};
+
+
+static int
+epd_enqueue(struct sk_buff *skb, struct Qdisc* sch)
+{
+struct epd_sched_data *q = (struct epd_sched_data/
+ *)sch->data;
+int test =verify_data_unit(skb,sch);
+/*verify if this packet belongs to data unit that is
+ marked dropped then we have to drop this packet*/
+ if (test==0)
+ goto drop;
+ if (sch->stats.backlog <= q->threshold)
+ {
+ update_data_unit (skb,sch)
+/*if it is a new data unit we have to update the
+ current_unit value*/
+ goto enqueue;
+ }
+ else
+ {
+ u8 unit=skb->nh.iph->tos;
+ if (unit ==/
+ q->current_unit)
+/*if it is a segment of a data unit that is already
+ enqueued then we have to enqueue this packet*/
+ goto enqueue;
+ else
+ {
+ update_reject_unit(skb,sch);
/*if it is a new unit then apdate the dropped_unit
+ value*/
+ goto drop;
+ }
+ }
+drop:
+ kfree_skb(skb);
+ sch->stats.drops++;
+ return NET_XMIT_DROP;
+
+enqueue:
+ __skb_queue_tail(&sch->q, skb);
+ sch->stats.backlog += skb->len;
+ sch->stats.bytes += skb->len;
+ sch->stats.packets++;
+ return NET_XMIT_SUCCESS;
+}
+
+static int
+epd_requeue(struct sk_buff *skb, struct Qdisc* sch)
+{
+ __skb_queue_head(&sch->q, skb);
+ sch->stats.backlog += skb->len;
+ return 0;
+}
+static struct sk_buff *
+epd_dequeue(struct Qdisc* sch)
+{
+ struct sk_buff *skb;
+
+ skb = __skb_dequeue(&sch->q);
+ if (skb)
+ sch->stats.backlog -= skb->len;
+ return skb;
+
+static int
+epd_drop(struct Qdisc* sch)
+{
+ struct sk_buff *skb;
+ skb = __skb_dequeue_tail(&sch->q);
+ if (skb) {
+ sch->stats.backlog -= skb->len;
+ sch->stats.drops++;
+ kfree_skb(skb);
+ return 1;
+ }
+ return 0;
+}
+static void
+epd_reset(struct Qdisc* sch)
+{
+ skb_queue_purge(&sch->q);
+ sch->stats.backlog = 0;
+}
+
+
+static int
+epd_change(struct Qdisc *sch, struct rtattr *opt)
+{
+ return 0;
+}
+
+
+
+static void epd_destroy(struct Qdisc *sch)
+{
+ MOD_DEC_USE_COUNT;
+}
+
+static int
+epd_init(struct Qdisc *sch, struct rtattr *opt)
+{
+ struct epd_sched_data *q = (void*)sch->data;
+
+ if (opt == NULL) {
+/* this is the first version ,no default attributes*/
+ }
+ else
+ {
+ struct tc_epd_qopt *ctl = RTA_DATA(opt);
+ if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
+ return -EINVAL;
+ q->limit = ctl->limit;
+ q->threshold= clt->threshold;
+ q->current_unit=0;
+ q->dropped_unit=0;
+ }
+ return 0;
+}
+
+struct Qdisc_ops epd_qdisc_ops +{
+ NULL,
+ NULL,
+ "epd",
+ sizeof(struct epd_sched_data),
+
+ epd_enqueue,
+ epd_dequeue,
+ epd_requeue,
+ epd_drop,
+
+ epd_init,
+ epd_reset,
+ epd_destroy,
+ epd_change,
+
+
+#ifdef CONFIG_RTNETLINK
+ epd_dump,
+#endif
+};
+
+#ifdef CONFIG_RTNETLINK
+static int
+ epd_dump(struct Qdisc *sch, struct sk_buff *skb)
+{
+ struct epd_sched_data *q = (void*)sch->data;
+ unsigned char *b = skb->tail;
+ struct tc_epd_qopt opt;
+
+ opt.limit = q->limit;
+ RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+
+ return skb->len;
+
+rtattr_failure:
+ skb_trim(skb, b - skb->data);
+ return -1;
+}
+#endif
+
+void
+update_reject_unit(sk_buffer *skb,struct Qdisc *sch)
+{
+unsigned unit= skb->nh.iph->tos;
+struct epd_sched_data *q =/
+ (struct epd_sched_data *)sch->data;
+q->dropped_unit=unit;
+}
+void
+ update_data_unit (sk_buffer *skb,struct Qdisc *sch)
+{
+unsigned unit= skb->nh.iph->tos;
+struct epd_sched_data *q =/
+ (struct epd_sched_data *)sch->data;
+if (q->current_unit != unit)
+ q->current_unit=unit;
+}
+
+static int
+ verify_data_unit(skb,sch)
+{
+unsigned unit=skb->nh.iph->tos;
+struct epd_sched_data *q =/
+(struct epd_sched_data *)sch->data;
+if (tos==q->dropped_unit)
+ return 0;
+else
+ return 1;
+}
+
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
Seemingly Similar Threads
- Intermittent NFS problems with NetApp server
- [PATCH] oggz: inefficient seeking
- [PATCH 0/5] xen pvfb: Para-virtual framebuffer, keyboard and pointer driver updates
- [PATCH 0/5] xen pvfb: Para-virtual framebuffer, keyboard and pointer driver updates
- [PATCH 0/5] xen pvfb: Para-virtual framebuffer, keyboard and pointer driver updates