#ifdef SHAPER_COMPLEX /* and broken.. */  while(ptr && ptr!=(struct sk_buff *)&shaper->sendq) { if(ptr->pri<skb->pri && jiffies - SHAPERCB(ptr)->shapeclock < SHAPER_MAXSLIP) { struct sk_buff *tmp=ptr->prev;  /* *	It goes before us therefore we slip the length *	of the new frame. */  SHAPERCB(ptr)->shapeclock+=SHAPERCB(skb)->shapelen; SHAPERCB(ptr)->shapelatency+=SHAPERCB(skb)->shapelen;  /* *	The packet may have slipped so far back it *	fell off. */ if(SHAPERCB(ptr)->shapelatency > SHAPER_LATENCY) { skb_unlink(ptr); dev_kfree_skb(ptr); } ptr=tmp; } else break; } if(ptr==NULL || ptr==(struct sk_buff *)&shaper->sendq) skb_queue_head(&shaper->sendq,skb); else { struct sk_buff *tmp; /* *	Set the packet clock out time according to the *	frames ahead. Im sure a bit of thought could drop *	this loop. */ for(tmp=skb_peek(&shaper->sendq); tmp!=NULL && tmp!=ptr; tmp=tmp->next) SHAPERCB(skb)->shapeclock+=tmp->shapelen; skb_append(ptr,skb); } #else 
static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev){	struct shaper *shaper = dev->priv; 	struct sk_buff *ptr;  	spin_lock(&shaper->lock); 	ptr=shaper->sendq.prev; 	 	/* 	 *	Set up our packet details 	 */ 	  	SHAPERCB(skb)->shapelatency=0; 	SHAPERCB(skb)->shapeclock=shaper->recovery; 	if(time_before(SHAPERCB(skb)->shapeclock, jiffies)) 		SHAPERCB(skb)->shapeclock=jiffies; 	skb->priority=0;	/* short term bug fix */ 	SHAPERCB(skb)->shapestamp=jiffies; 	 	/* 	 *	Time slots for this packet. 	 */ 	  	SHAPERCB(skb)->shapelen= shaper_clocks(shaper,skb); 	#ifdef SHAPER_COMPLEX /* and broken.. */ 	while(ptr && ptr!=(struct sk_buff *)&shaper->sendq) 	{ 		if(ptr->pri<skb->pri  			&& jiffies - SHAPERCB(ptr)->shapeclock < SHAPER_MAXSLIP) 		{ 			struct sk_buff *tmp=ptr->prev; 			/* 			 *	It goes before us therefore we slip the length 			 *	of the new frame. 			 */ 			SHAPERCB(ptr)->shapeclock+=SHAPERCB(skb)->shapelen; 			SHAPERCB(ptr)->shapelatency+=SHAPERCB(skb)->shapelen; 			/* 			 *	The packet may have slipped so far back it 			 *	fell off. 			 */ 			if(SHAPERCB(ptr)->shapelatency > SHAPER_LATENCY) 			{ 				skb_unlink(ptr); 				dev_kfree_skb(ptr); 			} 			ptr=tmp; 		} 		else 			break; 	} 	if(ptr==NULL || ptr==(struct sk_buff *)&shaper->sendq) 		skb_queue_head(&shaper->sendq,skb); 	else 	{ 		struct sk_buff *tmp; 		/* 		 *	Set the packet clock out time according to the 		 *	frames ahead. Im sure a bit of thought could drop 		 *	this loop. 		 */ 		for(tmp=skb_peek(&shaper->sendq); tmp!=NULL && tmp!=ptr; tmp=tmp->next) 			SHAPERCB(skb)->shapeclock+=tmp->shapelen; 		skb_append(ptr,skb); 	}#else	{		struct sk_buff *tmp;		/*		 *	Up our shape clock by the time pending on the queue		 *	(Should keep this in the shaper as a variable..)		 */		for(tmp=skb_peek(&shaper->sendq); tmp!=NULL && 			tmp!=(struct sk_buff *)&shaper->sendq; tmp=tmp->next)			SHAPERCB(skb)->shapeclock+=SHAPERCB(tmp)->shapelen;		/*		 *	Queue over time. Spill packet.		 */		if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) {			dev_kfree_skb(skb);			shaper->stats.tx_dropped++;		} else			skb_queue_tail(&shaper->sendq, skb);	}#endif 		if(sh_debug) 		printk("Frame queued.\n"); 	if(skb_queue_len(&shaper->sendq)>SHAPER_QLEN) 	{ 		ptr=skb_dequeue(&shaper->sendq);                dev_kfree_skb(ptr);                shaper->stats.collisions++; 	}	shaper_kick(shaper);	spin_unlock(&shaper->lock); 	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8728b834b226ffcf2c94a58530090e292af2a7bf/shaper.c/buggy/drivers/net/shaper.c