Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller

From: Måns Rullgård
Date: Tue Nov 10 2015 - 13:08:06 EST


Eric Dumazet <eric.dumazet@xxxxxxxxx> writes:

> On Tue, 2015-11-10 at 16:14 +0000, Mans Rullgard wrote:
>> This adds a driver for the Aurora VLSI NB8800 Ethernet controller.
>> It is an almost complete rewrite of a driver originally found in
>> a Sigma Designs 2.6.22 tree.
>
> ...
>
>> +
>> +static int nb8800_xmit(struct sk_buff *skb, struct net_device *dev)
>> +{
>> + struct nb8800_priv *priv = netdev_priv(dev);
>> + struct nb8800_tx_desc *txd;
>> + struct nb8800_tx_buf *txb;
>> + struct nb8800_dma_desc *dma;
>> + dma_addr_t dma_addr;
>> + unsigned int dma_len;
>> + unsigned long flags;
>> + int align;
>> + int next;
>> +
>> + if (atomic_read(&priv->tx_free) <= NB8800_DESC_LOW) {
>> + netif_stop_queue(dev);
>> + return NETDEV_TX_BUSY;
>> + }
>> +
>> + align = (8 - (uintptr_t)skb->data) & 7;
>> +
>> + dma_len = skb->len - align;
>> + dma_addr = dma_map_single(&dev->dev, skb->data + align,
>> + dma_len, DMA_TO_DEVICE);
>> +
>> + if (dma_mapping_error(&dev->dev, dma_addr)) {
>> + netdev_err(dev, "tx dma mapping error\n");
>> + kfree_skb(skb);
>> + dev->stats.tx_dropped++;
>> + return NETDEV_TX_OK;
>> + }
>> +
>> + if (atomic_dec_return(&priv->tx_free) <= NB8800_DESC_LOW)
>> + netif_stop_queue(dev);
>
> You probably also want to clear skb->xmit_more or risk a stall

Very true, will fix.

--
Måns Rullgård
mans@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/