{
struct shaper *shaper = dev->priv;
struct sk_buff *ptr;
-
- if (down_trylock(&shaper->sem))
- return -1;
+ spin_lock(&shaper->lock);
ptr=shaper->sendq.prev;
/*
shaper->stats.collisions++;
}
shaper_kick(shaper);
- up(&shaper->sem);
+ spin_unlock(&shaper->lock);
return 0;
}
{
struct shaper *shaper = (struct shaper *)data;
- if (!down_trylock(&shaper->sem)) {
- shaper_kick(shaper);
- up(&shaper->sem);
- } else
- mod_timer(&shaper->timer, jiffies);
+ spin_lock(&shaper->lock);
+ shaper_kick(shaper);
+ spin_unlock(&shaper->lock);
}
/*
}
-/*
- * Flush the shaper queues on a closedown
- */
-
-static void shaper_flush(struct shaper *shaper)
-{
- struct sk_buff *skb;
-
- down(&shaper->sem);
- while((skb=skb_dequeue(&shaper->sendq))!=NULL)
- dev_kfree_skb(skb);
- shaper_kick(shaper);
- up(&shaper->sem);
-}
-
/*
* Bring the interface up. We just disallow this until a
* bind.
static int shaper_close(struct net_device *dev)
{
struct shaper *shaper=dev->priv;
- shaper_flush(shaper);
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(&shaper->sendq)) != NULL)
+ dev_kfree_skb(skb);
+
+ spin_lock_bh(&shaper->lock);
+ shaper_kick(shaper);
+ spin_unlock_bh(&shaper->lock);
+
del_timer_sync(&shaper->timer);
return 0;
}
init_timer(&sh->timer);
sh->timer.function=shaper_timer;
sh->timer.data=(unsigned long)sh;
+ spin_lock_init(&sh->lock);
}
/*