int qdisc_restart(struct net_device *dev) { struct Qdisc *q = dev->qdisc; unsigned lockless = (dev->features & NETIF_F_LLTX); struct sk_buff *skb = NULL; int ret; ret = try_get_tx_pkt(&skb, dev, q); if (ret == 0) return qqlen(q); /* we have a packet to send */ if (!lockless) { if (!netif_tx_trylock(dev)) return handle_tx_locked(skb, dev, q); } /* all clear .. */ spin_unlock(&dev->queue_lock); /* churn baby churn .. */ ret = dev_hard_start_xmit(skb, dev); if (!lockless) netif_tx_unlock(dev); spin_lock(&dev->queue_lock); q = dev->qdisc; /* most likely result, packet went ok */ if (ret == NETDEV_TX_OK) return qqlen(q); /* only for lockless drivers .. */ if (ret == NETDEV_TX_LOCKED && lockless) { return handle_tx_locked(skb, dev, q); } if (unlikely (ret != NETDEV_TX_BUSY)) { /* XXX: Do we need a ratelimit? or put a * BUG_ON((int) ret != NETDEV_TX_BUSY) ? **/ printk("BUG %s code %d qlen %d\n",dev->name, ret, q->q.qlen); } return handle_dev_requeue(skb, dev, q); }