[469] in linux-net channel archive

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

Boing.. 8)

daemon@ATHENA.MIT.EDU (Alan Cox)
Tue Jun 13 07:13:42 1995

From: iialan@iifeak.swan.ac.uk (Alan Cox)
To: linux-net@vger.rutgers.edu
Date: Tue, 13 Jun 1995 10:07:32 +0100 (BST)

Your message was not delivered to  
        pete@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN
        host/domain (NXDOMAIN) 


Pete the domainless writes..
> Some of the features I'm planning on putting in are:
> 
> - Committed Information Rate: at any time, traffic from specified 
> addresses will be guaranteed bandwidth up to the CIR
> - Bursting: any connection can at any time use up any additional 
> available bandwidth, as long as it doesn't infringe on someone else's CIR 
> usage (the burst ceiling can be set arbitrarily)
> - All parameters configurable on an IP-address or IP-group level, for 
> in-bound and/or out-bound traffic
> - Accounting to track all CIR/bursting usage by address
> - Time-sensitive parameters (for instance, CIR could be effective during 
> business hours only for some customers, or CIR could be adjusted to 
> different levels to allow for special events, etc)

You definitely ought to look at the internet RSVP drafts (RSVP is a 
resource reservation protocol). It doesn't really do what you want but
it has similar ideas.

> (packet_size/rate). This seems to work better, but I'm worried about the 
> repercussions of having busy-wait code in ip.c. I don't know if it'd be 
> permissable to busy-wait with yield() (is there such a kernel call?), or 
> maybe have some kind of call-back, where I calculate the required time to 
> send, then have the IP process sleep until that time had elapsed (I don't 
> know how I'd do this, unfortunately).

You'll screw performance totally. What I think you would need to do is a bit
different something in ip_forward() like

	ctrlblock=find_block_for(iph->saddr);
	if(ctrlblock)	/* Throttled */
	{
		if(ctrlblock->used+skb->len>ctrlblock->limit)
		{
			kfree_skb(skb, FREE_READ);
			return;
		}
		if(ctrlblock->used+skb->len>ctrlblock->thresh)
		{
			skb_queue_tail(&ctrlblock->queue,skb);
			schedule_timer(ctrlblock);
			return;
		}
		ctrlblock->used+=skb->len;
	}
	/* Drop through  */
> 

ie if the queue is full, drop frames, if its semi full queue them and schedule
a timer (which is what the imaginary schedule_timer function does) else if
it fits send it. Its effectively your busy wait done properly with an
additional check so the queue cannot grow forever

> Am I approaching this right? Is the ip.c code the right place to do this, 
> or should I look into a network device driver implementation? I think 
> that a device-driver implementation might be easier, but only if it could 
> be a device on top of the actual network device driver, so that every 
> device driver wouldn't have to be modified. Can Linux even do this? Isn't 
> that how the IP-tunnel driver works in 1.3.0?

Its currently a little messy to do (needs to copy the buffer) but works. I'm
working on the messyness bit slowly.

Alan


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