static void shaper_kick(struct shaper *shaper) { struct sk_buff *skb; /* * Walk the list (may be empty) */ while((skb=skb_peek(&shaper->sendq))!=NULL) { /* * Each packet due to go out by now (within an error * of SHAPER_BURST) gets kicked onto the link */ if(sh_debug) printk("Clock = %ld, jiffies = %ld\n", SHAPERCB(skb)->shapeclock, jiffies); if(time_before_eq(SHAPERCB(skb)->shapeclock, jiffies + SHAPER_BURST)) { /* * Pull the frame and get interrupts back on. */ skb_unlink(skb, &shaper->sendq); if (shaper->recovery < SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen) shaper->recovery = SHAPERCB(skb)->shapeclock + SHAPERCB(skb)->shapelen; /* * Pass on to the physical target device via * our low level packet thrower. */ SHAPERCB(skb)->shapepend=0; shaper_queue_xmit(shaper, skb); /* Fire */ } else break; } /* * Next kick. */ if(skb!=NULL) mod_timer(&shaper->timer, SHAPERCB(skb)->shapeclock); }
static void shaper_kick(struct shaper *shaper) { struct sk_buff *skb; unsigned long flags; save_flags(flags); cli(); del_timer(&shaper->timer); /* * Shaper unlock will kick */ if(shaper->locked) { if(sh_debug) printk("Shaper locked.\n"); shaper->timer.expires=jiffies+1; add_timer(&shaper->timer); restore_flags(flags); return; } /* * Walk the list (may be empty) */ while((skb=skb_peek(&shaper->sendq))!=NULL) { /* * Each packet due to go out by now (within an error * of SHAPER_BURST) gets kicked onto the link */ if(sh_debug) printk("Clock = %d, jiffies = %ld\n", skb->shapeclock, jiffies); if(skb->shapeclock - jiffies <= SHAPER_BURST) { /* * Pull the frame and get interrupts back on. */ skb_unlink(skb); if (shaper->recovery < skb->shapeclock + skb->shapelen) shaper->recovery = skb->shapeclock + skb->shapelen; restore_flags(flags); /* * Pass on to the physical target device via * our low level packet thrower. */ skb->shapepend=0; shaper_queue_xmit(shaper, skb); /* Fire */ cli(); } else break; } /* * Next kick. */ if(skb!=NULL) { del_timer(&shaper->timer); shaper->timer.expires=skb->shapeclock; add_timer(&shaper->timer); } /* * Interrupts on, mission complete */ restore_flags(flags); }