-#ifdef CONFIG_NET_HW_FLOWCONTROL
-atomic_t netdev_dropping = ATOMIC_INIT(0);
-static unsigned long netdev_fc_mask = 1;
-unsigned long netdev_fc_xoff;
-spinlock_t netdev_fc_lock = SPIN_LOCK_UNLOCKED;
-
-static struct
-{
- void (*stimul)(struct net_device *);
- struct net_device *dev;
-} netdev_fc_slots[BITS_PER_LONG];
-
-int netdev_register_fc(struct net_device *dev,
- void (*stimul)(struct net_device *dev))
-{
- int bit = 0;
- unsigned long flags;
-
- spin_lock_irqsave(&netdev_fc_lock, flags);
- if (netdev_fc_mask != ~0UL) {
- bit = ffz(netdev_fc_mask);
- netdev_fc_slots[bit].stimul = stimul;
- netdev_fc_slots[bit].dev = dev;
- set_bit(bit, &netdev_fc_mask);
- clear_bit(bit, &netdev_fc_xoff);
- }
- spin_unlock_irqrestore(&netdev_fc_lock, flags);
- return bit;
-}
-
-void netdev_unregister_fc(int bit)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&netdev_fc_lock, flags);
- if (bit > 0) {
- netdev_fc_slots[bit].stimul = NULL;
- netdev_fc_slots[bit].dev = NULL;
- clear_bit(bit, &netdev_fc_mask);
- clear_bit(bit, &netdev_fc_xoff);
- }
- spin_unlock_irqrestore(&netdev_fc_lock, flags);
-}
-
-static void netdev_wakeup(void)
-{
- unsigned long xoff;
-
- spin_lock(&netdev_fc_lock);
- xoff = netdev_fc_xoff;
- netdev_fc_xoff = 0;
- while (xoff) {
- int i = ffz(~xoff);
- xoff &= ~(1 << i);
- netdev_fc_slots[i].stimul(netdev_fc_slots[i].dev);
- }
- spin_unlock(&netdev_fc_lock);
-}
-#endif
-