* [LARTC] New qdisc EPD code (final code)
@ 2002-06-06 13:03 alouini khalif
2002-06-06 13:04 ` alouini khalif
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: alouini khalif @ 2002-06-06 13:03 UTC (permalink / raw)
To: lartc
hello
ok,i wrote the EDP algorithm code as you can see in
the code bellow
please, look at it, and if there is any mistake,
would you like to indicate it to me
if is ok, how can i write my pacth, i'm using red
hat 7.2(kernel2.4.7-10)
is it necessairely to write this pacth and also the
pacth for tc . can i change the files indicated in
the htb pacth or not
thank you in advance
-------------------------------------------------
/*
* net/sched/sch_epd.c Early packet discart 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>& Mrabet cyrine
*/
#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 (RED) algorithm. Version 1.0
=================== this dsicipline 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 seuil then we have to
drop all new data unit (witch may be divided into many
cells) for the reason that the packet has no
signification if some of its data is 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Úta
unit)
To adaptate this discipline for multimedia stream, we
market the IP packet into the IP-OPION 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 <seuil) -> packet passed.
if (length >seuil) ->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
seuil -bytes
*/
struct epd_sched_data
{
/* Parameters */
unsigned limit; /* HARD maximal queue length */
unsigned seuil ; /* limit under it, we drop a new
data unit*/
/* Variables */
unsigned current_unit ; /* the last unit
that is 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);
if (test=0)
goto drop;
if (sch->stats.backlog <= q->seuil) {
MAJ_data_unit (skb,sch)
goto enqueue;
} else
{
unsigned unit=u8 tos = skb->nh.iph->tos;
if (unit = q->current_unit)
goto enqueue;
else
{
MAJ_reject_unit(skb,sch);
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)
{
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
skb_queue_purge(&sch->q);
sch->stats.backlog = 0;
}
static int red_change(struct Qdisc *sch, struct rtattr
*opt)
{
return 0;
}
static void epd_destroy(struct Qdisc *sch)
{
MOD_DEC_USE_COUNT;
}
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,
#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 MAJ_reject_unit(sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
q->dropped_unit=tos;
}
void MAJ_data_unit (sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
if (q->current_unit != tos)
q->current_unit=tos;
}
static int verify_data_unit(skb,sch)
{
int i=0;
unsigned unit=u8 tos = 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
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LARTC] New qdisc EPD code (final code)
2002-06-06 13:03 [LARTC] New qdisc EPD code (final code) alouini khalif
@ 2002-06-06 13:04 ` alouini khalif
2002-06-06 13:04 ` alouini khalif
2002-06-06 14:53 ` Luc Brouard
2 siblings, 0 replies; 4+ messages in thread
From: alouini khalif @ 2002-06-06 13:04 UTC (permalink / raw)
To: lartc
hello
ok,i wrote the EDP algorithm code as you can see in
the code bellow
please, look at it, and if there is any mistake,
would you like to indicate it to me
if is ok, how can i write my pacth, i'm using red
hat 7.2(kernel2.4.7-10)
is it necessairely to write this pacth and also the
pacth for tc . can i change the files indicated in
the htb pacth or not
thank you in advance
-------------------------------------------------
/*
* net/sched/sch_epd.c Early packet discart 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>& Mrabet cyrine
*/
#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 (RED) algorithm. Version 1.0
=================== this dsicipline 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 seuil then we have to
drop all new data unit (witch may be divided into many
cells) for the reason that the packet has no
signification if some of its data is 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Úta
unit)
To adaptate this discipline for multimedia stream, we
market the IP packet into the IP-OPION 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 <seuil) -> packet passed.
if (length >seuil) ->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
seuil -bytes
*/
struct epd_sched_data
{
/* Parameters */
unsigned limit; /* HARD maximal queue length */
unsigned seuil ; /* limit under it, we drop a new
data unit*/
/* Variables */
unsigned current_unit ; /* the last unit
that is 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);
if (test=0)
goto drop;
if (sch->stats.backlog <= q->seuil) {
MAJ_data_unit (skb,sch)
goto enqueue;
} else
{
unsigned unit=u8 tos = skb->nh.iph->tos;
if (unit = q->current_unit)
goto enqueue;
else
{
MAJ_reject_unit(skb,sch);
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)
{
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
skb_queue_purge(&sch->q);
sch->stats.backlog = 0;
}
static int red_change(struct Qdisc *sch, struct rtattr
*opt)
{
return 0;
}
static void epd_destroy(struct Qdisc *sch)
{
MOD_DEC_USE_COUNT;
}
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,
#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 MAJ_reject_unit(sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
q->dropped_unit=tos;
}
void MAJ_data_unit (sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
if (q->current_unit != tos)
q->current_unit=tos;
}
static int verify_data_unit(skb,sch)
{
int i=0;
unsigned unit=u8 tos = 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
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LARTC] New qdisc EPD code (final code)
2002-06-06 13:03 [LARTC] New qdisc EPD code (final code) alouini khalif
2002-06-06 13:04 ` alouini khalif
@ 2002-06-06 13:04 ` alouini khalif
2002-06-06 14:53 ` Luc Brouard
2 siblings, 0 replies; 4+ messages in thread
From: alouini khalif @ 2002-06-06 13:04 UTC (permalink / raw)
To: lartc
hello
ok,i wrote the EDP algorithm code as you can see in
the code bellow
please, look at it, and if there is any mistake,
would you like to indicate it to me
if is ok, how can i write my pacth, i'm using red
hat 7.2(kernel2.4.7-10)
is it necessairely to write this pacth and also the
pacth for tc . can i change the files indicated in
the htb pacth or not
thank you in advance
-------------------------------------------------
/*
* net/sched/sch_epd.c Early packet discart 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>& Mrabet cyrine
*/
#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 (RED) algorithm. Version 1.0
=================== this dsicipline 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 seuil then we have to
drop all new data unit (witch may be divided into many
cells) for the reason that the packet has no
signification if some of its data is 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Úta
unit)
To adaptate this discipline for multimedia stream, we
market the IP packet into the IP-OPION 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 <seuil) -> packet passed.
if (length >seuil) ->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
seuil -bytes
*/
struct epd_sched_data
{
/* Parameters */
unsigned limit; /* HARD maximal queue length */
unsigned seuil ; /* limit under it, we drop a new
data unit*/
/* Variables */
unsigned current_unit ; /* the last unit
that is 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);
if (test=0)
goto drop;
if (sch->stats.backlog <= q->seuil) {
MAJ_data_unit (skb,sch)
goto enqueue;
} else
{
unsigned unit=u8 tos = skb->nh.iph->tos;
if (unit = q->current_unit)
goto enqueue;
else
{
MAJ_reject_unit(skb,sch);
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)
{
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
skb_queue_purge(&sch->q);
sch->stats.backlog = 0;
}
static int red_change(struct Qdisc *sch, struct rtattr
*opt)
{
return 0;
}
static void epd_destroy(struct Qdisc *sch)
{
MOD_DEC_USE_COUNT;
}
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,
#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 MAJ_reject_unit(sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
q->dropped_unit=tos;
}
void MAJ_data_unit (sk_buffer *skb,struct Qdisc *sch)
{
unsigned unit=u8 tos = skb->nh.iph->tos;
struct epd_sched_data *q = (struct epd_sched_data
*)sch->data;
if (q->current_unit != tos)
q->current_unit=tos;
}
static int verify_data_unit(skb,sch)
{
int i=0;
unsigned unit=u8 tos = 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
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LARTC] New qdisc EPD code (final code)
2002-06-06 13:03 [LARTC] New qdisc EPD code (final code) alouini khalif
2002-06-06 13:04 ` alouini khalif
2002-06-06 13:04 ` alouini khalif
@ 2002-06-06 14:53 ` Luc Brouard
2 siblings, 0 replies; 4+ messages in thread
From: Luc Brouard @ 2002-06-06 14:53 UTC (permalink / raw)
To: lartc
On Thu, Jun 06, 2002 at 03:03:58PM +0200, alouini khalif wrote:
> hello
> ok,i wrote the EDP algorithm code as you can see in
> the code bellow
> please, look at it, and if there is any mistake,
> would you like to indicate it to me
>
> packet arrive and we reach a seuil then we have to
instead of "seuil" use threshold ...
> all sells that belongs to this packet (a packetÚta
Cells
Change seuil in the source also ...
Luc
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-06-06 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-06 13:03 [LARTC] New qdisc EPD code (final code) alouini khalif
2002-06-06 13:04 ` alouini khalif
2002-06-06 13:04 ` alouini khalif
2002-06-06 14:53 ` Luc Brouard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.