Bug#299826: Fix for kernel 2.6.25 and 2.6.26

2008-08-21 Thread Rasmus Bøg Hansen
Jonas Smedegaard [EMAIL PROTECTED] hit the keyboard.
Afterwards the following was on the screen:

 On Wed, Aug 20, 2008 at 04:02:14PM +0200, Rune Kock wrote:
I've fixed up WRR for kernel 2.6.25 and 2.6.26.  Attached is a wrr.c
to replace the usual one.

At the moment, this has only been tested a little bit.

I'm sending this fix to upstream as well.

 Supercool!

 I am preparing an updated package now.

I've reviewed it and released an upstream version. The new release
contains only Runes changes and a version bump.

Regards
/Rasmus

-- 
Rasmus Bøg Hansen




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#299826: Fix for kernel 2.6.25 and 2.6.26

2008-08-21 Thread Jonas Smedegaard
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, Aug 21, 2008 at 09:14:50AM +0200, Rasmus Bøg Hansen wrote:
Jonas Smedegaard [EMAIL PROTECTED] hit the keyboard.
Afterwards the following was on the screen:

 On Wed, Aug 20, 2008 at 04:02:14PM +0200, Rune Kock wrote:
I've fixed up WRR for kernel 2.6.25 and 2.6.26.  Attached is a wrr.c
to replace the usual one.

At the moment, this has only been tested a little bit.

I'm sending this fix to upstream as well.

 Supercool!

 I am preparing an updated package now.

I've reviewed it and released an upstream version. The new release
contains only Runes changes and a version bump.

That was quick!

I'll add it to a later release.


Are you aware that the second-newest patch has 2.6.25 in the name while 
the text indicates that it does not work with that version?


  - Jonas

- -- 
* Jonas Smedegaard - idealist og Internet-arkitekt
* Tlf.: +45 40843136  Website: http://dr.jones.dk/

  [x] quote me freely  [ ] ask before reusing  [ ] keep private
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkitG3oACgkQn7DbMsAkQLhBFACgnbneQ4YF5ZlNGdiBAxSfX/iZ
NLoAoIzBBdqr38bl/gHeDpawm4S8a0RN
=Bo9H
-END PGP SIGNATURE-



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#299826: Fix for kernel 2.6.25 and 2.6.26

2008-08-21 Thread Rasmus Bøg Hansen
Jonas Smedegaard [EMAIL PROTECTED] hit the keyboard.
Afterwards the following was on the screen:

I've reviewed it and released an upstream version. The new release
contains only Runes changes and a version bump.

 That was quick!

 I'll add it to a later release.


 Are you aware that the second-newest patch has 2.6.25 in the name while 
 the text indicates that it does not work with that version?

I noticed it but was too lazy to fix it yesterday - thanks, I've fixed
the patch name now :-)

Regards
/Rasmus

-- 
Rasmus Bøg Hansen
Amagerkollegiets IT-udvalg
[EMAIL PROTECTED]




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#299826: Fix for kernel 2.6.25 and 2.6.26

2008-08-20 Thread Rune Kock
I've fixed up WRR for kernel 2.6.25 and 2.6.26.  Attached is a wrr.c
to replace the usual one.

At the moment, this has only been tested a little bit.

I'm sending this fix to upstream as well.
/*-
Weighted Round Robin scheduler.
  
Written by Christian Worm Mortensen, [EMAIL PROTECTED]

Introduction

This module implements a weighted round robin queue with build-in classifier.
The classifier currently map each MAC or IP address (configurable either MAC
or IP and either source or destination) to different classes. Each such class 
is called a band. Whan using MAC addresses only bridged packets can be 
classified other packets go to a default MAC address.

Each band has a weight value, where 0weight=1. The bandwidth each band
get is proportional to the weight as can be deduced from the next section.

The queue
=
Each band has a penalty value. Bands having something to sent are kept in
a heap according to this value. The band with the lowest penalty value
is in the root of the heap. The penalty value is a 128 bit number. Initially 
no bands are in the heap.

Two global 64 bit values counter_low_penal and couter_high_penal are initialized
to 0 and to 2^63 respectively.

Enqueing:
  The packet is inserted in the queue for the band it belongs to. If the band 
  is not in the heap it is inserted into it. In this case, the upper 64 bits 
  of its penalty value is set to the same as for the root-band of the heap. 
  If the heap is empty 0 is used. The lower 64 bit is set to couter_low_penal
  and couter_low_penal is incremented by 1.
  
Dequing:
  If the heap is empty we have nothing to send. 
  
  If the root band has a non-empty queue a packet is dequeued from that.
  The upper 64 bit of the penalty value of the band is incremented by the 
  packet size divided with the weight of the band. The lower 64 bit is set to 
  couter_high_penal and couter_high_penal is incremented by 1.

  If the root element for some reason has an  empty queue it is removed from 
  the heap and we try to dequeue again.

The effect of the heap and the upper 64 bit of the penalty values is to 
implement a weighted round robin queue. The effect of counter_low_penal,
counter_high_penal and the lower 64 bit of the penalty value is primarily to
stabilize the queue and to give better quality of service to machines only 
sending a packet now and then. For example machines which have a single 
interactive connection such as telnet or simple text chatting.

Setting weight
==
The weight value can be changed dynamically by the queue itself. The weight 
value and how it is changed is described by the two members weight1 and 
weight2 which has type tc_wrr_class_weight and which are in each class. And 
by the two integer value members of the qdisc called penalfact1 and penalfact2.
The structure is defined as:

  struct tc_wrr_class_weight {
// All are represented as parts of (2^64-1).
__u64 val;  // Current value(0 is not valid)
__u64 decr; // Value pr bytes   (2^64-1 is not valid)
__u64 incr; // Value pr seconds (2^64-1 is not valid)
__u64 min;  // Minimal value(0 is not valid)
__u64 max;  // Minimal value(0 is not valid)

// The time where the above information was correct:
time_t tim;
  };

The weight value used by the dequeue operations is calculated as 
weight1.val*weight2.val. weight1 and weight2 and handled independently and in the 
same way as will be described now.

Every second, the val parameter is incremented by incr.

Every time a packet is transmitted the value is increment by decr times
the packet size. Depending on the value of the weight_mode parameter it
is also mulitplied with other numbers. This makes it possible to give 
penalty to machines transferring much data.

-*/

#include linux/autoconf.h
#include linux/module.h
#include asm/uaccess.h
#include asm/system.h
#include linux/bitops.h
#include linux/types.h
#include linux/kernel.h
#include linux/vmalloc.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 linux/if_arp.h
#include linux/version.h
#include linux/wrr.h

#define WRR_VER 05

#define my_malloc(size) kmalloc(size,GFP_KERNEL)
#define my_free(ptr)kfree(ptr)

#define LOCK_START sch_tree_lock(sch);
#define LOCK_END   sch_tree_unlock(sch);
#define ENQUEUE_SUCCESS 0
#define ENQUEUE_FAILNET_XMIT_DROP

#if defined 

Bug#299826: Fix for kernel 2.6.25 and 2.6.26

2008-08-20 Thread Jonas Smedegaard
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Aug 20, 2008 at 04:02:14PM +0200, Rune Kock wrote:
I've fixed up WRR for kernel 2.6.25 and 2.6.26.  Attached is a wrr.c
to replace the usual one.

At the moment, this has only been tested a little bit.

I'm sending this fix to upstream as well.

Supercool!

I am preparing an updated package now.


  - jonas

- -- 
* Jonas Smedegaard - idealist og Internet-arkitekt
* Tlf.: +45 40843136  Website: http://dr.jones.dk/

  [x] quote me freely  [ ] ask before reusing  [ ] keep private
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkisMqoACgkQn7DbMsAkQLhYYQCfUDaK0IddItK4E4sWVCsIuhLc
WEMAn0GO1O0W3s/cLG0LpgL7UZ0qypS/
=nUIr
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]