[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yw1xr3jxraqs.fsf@unicorn.mansr.com>
Date: Tue, 10 Nov 2015 18:05:15 +0000
From: Måns Rullgård <mans@...sr.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
slash.tmp@...e.fr
Subject: Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
Eric Dumazet <eric.dumazet@...il.com> 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 void nb8800_receive(struct net_device *dev, int i, int len)
>> +{
>> + struct nb8800_priv *priv = netdev_priv(dev);
>> + struct nb8800_rx_desc *rxd = &priv->rx_descs[i];
>> + struct page *page = priv->rx_bufs[i].page;
>> + int offset = priv->rx_bufs[i].offset;
>> + void *data = page_address(page) + offset;
>> + dma_addr_t dma = rxd->desc.s_addr;
>> + struct sk_buff *skb;
>> + int size;
>> + int err;
>> +
>> + size = len <= RX_COPYBREAK ? len : RX_COPYHDR;
>> +
>> + skb = napi_alloc_skb(&priv->napi, size);
>> + if (!skb) {
>> + netdev_err(dev, "rx skb allocation failed\n");
>> + dev->stats.rx_dropped++;
>> + return;
>> + }
>> +
>> + if (len <= RX_COPYBREAK) {
>> + dma_sync_single_for_cpu(&dev->dev, dma, len, DMA_FROM_DEVICE);
>> + memcpy(skb_put(skb, len), data, len);
>> + dma_sync_single_for_device(&dev->dev, dma, len,
>> + DMA_FROM_DEVICE);
>> + } else {
>> + err = nb8800_alloc_rx(dev, i, true);
>> + if (err) {
>> + netdev_err(dev, "rx buffer allocation failed\n");
>> + dev->stats.rx_dropped++;
>> + return;
>> + }
>> +
>> + dma_unmap_page(&dev->dev, dma, RX_BUF_SIZE, DMA_FROM_DEVICE);
>> + memcpy(skb_put(skb, RX_COPYHDR), data, RX_COPYHDR);
>> + skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
>> + offset + RX_COPYHDR, len - RX_COPYHDR,
>> + RX_BUF_SIZE);
>> + }
>> +
>> + skb->protocol = eth_type_trans(skb, dev);
>> + netif_receive_skb(skb);
>> +}
>> +
>
> Any reason you do not use napi_gro_receive(&priv->napi, skb) instead of
> netif_receive_skb() ?
Because I haven't been following the netdev list closely for the last
five years, and no documentation I read mentioned this function. I can
certainly change it.
--
Måns Rullgård
mans@...sr.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists