- }
- }
- dev->xmit_lock_owner = -1;
- spin_unlock_bh(&dev->xmit_lock);
- if (net_ratelimit())
- printk(KERN_CRIT "Virtual device %s asks to "
- "queue packet!\n", dev->name);
- goto out_enetdown;
- } else {
- /* Recursion is detected! It is possible,
- * unfortunately */
- if (net_ratelimit())
- printk(KERN_CRIT "Dead loop on virtual device "
- "%s, fix it urgently!\n", dev->name);
- }
- }
- spin_unlock_bh(&dev->queue_lock);
-out_enetdown:
- rc = -ENETDOWN;
-out_kfree_skb:
- kfree_skb(skb);
-out:
- return rc;
-}
-
-
-/*=======================================================================
- Receiver routines
- =======================================================================*/
-
-int netdev_max_backlog = 300;
-int weight_p = 64; /* old backlog weight */
-/* These numbers are selected based on intuition and some
- * experimentatiom, if you have more scientific way of doing this
- * please go ahead and fix things.
- */
-int no_cong_thresh = 10;
-int no_cong = 20;
-int lo_cong = 100;
-int mod_cong = 290;
-
-DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
-
-
-#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);