/* We do this to firstly avoid sleeping with the network device locked, and secondly so we can round up more than one packet to transmit which means we can try and avoid generating too many transmit done interrupts.  */
static netdev_tx_t ks8851_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* We do this to firstly avoid sleeping with the network device locked, and secondly so we can round up more than one packet to transmit which means we can try and avoid generating too many transmit done interrupts.  */
static netdev_tx_t ks8851_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct ks8851_net *ks = netdev_priv(dev);
	unsigned needed = calc_txlen(skb->len);
	netdev_tx_t ret = NETDEV_TX_OK;
	if (netif_msg_tx_queued(ks))
		ks_dbg(ks, "%s: skb %p, %d@%p\n", __func__,
		       skb, skb->len, skb->data);
	spin_lock(&ks->statelock);
	if (needed > ks->tx_space) {
		netif_stop_queue(dev);
		ret = NETDEV_TX_BUSY;
	} else {
		ks->tx_space -= needed;
		skb_queue_tail(&ks->txq, skb);
	}
	spin_unlock(&ks->statelock);
	schedule_work(&ks->tx_work);
	return ret;
}