[474] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: [Project] Managing Available Bandwidth

daemon@ATHENA.MIT.EDU (Matthias Urlichs)
Tue Jun 13 14:32:42 1995

To: submit-linux-dev-net@ratatosk.yggdrasil.com
From: urlichs@smurf.noris.de (Matthias Urlichs)
Date: 13 Jun 1995 18:29:01 +0200

Some comments:

(a) Busy waiting is extremely antisocial. Don't even think about doing it
    that way.
(b) Don't drop packets received from the bandwidth-reduced line; delay
    (and possibly drop) outgoing stuff only. Throttling the data rate on
    the other end is the job of the other side.
(c) Look at drivers/net/eql.c in the 1.3.0 kernel.  It may provide a
    starting point.
(d) Looking at the aforementioned file myself..: PLEASE, everybody, check
    whether you get NULL from kmalloc!

The basic processing should probably look somewhat like this:
- Assume two variables: bw_lim is the number of bytes to send, bw_now says
  how many bytes you did send. Both are per 10th of a second or so.
- Every 10/th second do this:
  if(bw_now > bw_lim)
    bw_now -= bw_lim;
  else
    bw_now = 0;
  while(bw_now < bw_lim) {
	dequeue_packet();
	if(packet == NULL) break;
	bw_now += packet_length();
	send_it();
  }

- If you get a packet:
  if(packet_in_queue()) {
    if(queue_full()) {
	  send_ICMP_sourcequench(); /* at most once per second or so */
	  drop_packet();
	else
      enqueue_packet();
  } else if(bw_now >= bw_lim) {
    enqueue_packet();
  } else {
	bw_now += packet_length();
	send_packet();
  }
    
Quite simple really. The problem is how to figure out which bw_now / bw_lim
variables to use. Ideally, you'd have a priority scheme (Telnet first, then
WWW; FTP and Netnews may soak up the remaining bandwidth), associate one
or possibly many IP filter records with each priority, and share bw_now
among them (Telnet and WWW together may not soak up more than XXX kB/sec).

Next problem: Fairness. If you're not careful, a strict priority scheme
will cause your low-priority sessions to starve themselves to death -- the
policies built into TCP might do that even if the bandwidth distribution
mechanism tries to distribute the bandwidth.

-- 
Four things belong to a judge:  to hear courteously, to answer wisely,
to consider soberly, and to decide impartially.
                                -- Socrates
-- 
Matthias Urlichs        \ XLink-POP Nürnberg  | EMail: urlichs@smurf.noris.de
Schleiermacherstraße 12  \  Unix+Linux+Mac    | Phone: ...please use email.
90491 Nürnberg (Germany)  \   Consulting+Networking+Programming+etc'ing     42
          PGP: 1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE 
      Click <A HREF="http://smurf.noris.de/~urlichs/finger">here</A>.

home help back first fref pref prev next nref lref last post