Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266671

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

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
Date 2015-11-10 19:00 +0100
Message-ID <qtln3-8aF-3@gated-at.bofh.it> (permalink)
References <qtjOi-7kQ-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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() ?

I see you correctly use late napi_complete_done(napi, work), but this
matters only if napi_gro_receive() was used.



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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller Eric Dumazet <eric.dumazet@gmail.com> - 2015-11-10 19:00 +0100
  Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller Måns Rullgård <mans@mansr.com> - 2015-11-10 19:10 +0100
    Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller David Miller <davem@davemloft.net> - 2015-11-10 21:10 +0100
      Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller Måns Rullgård <mans@mansr.com> - 2015-11-10 22:00 +0100
        Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller David Miller <davem@davemloft.net> - 2015-11-10 22:10 +0100
          Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller Måns Rullgård <mans@mansr.com> - 2015-11-10 22:30 +0100
            Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller Eric Dumazet <eric.dumazet@gmail.com> - 2015-11-10 23:00 +0100
              Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller Mason <slash.tmp@free.fr> - 2015-11-11 14:50 +0100
                Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller Måns Rullgård <mans@mansr.com> - 2015-11-11 15:00 +0100
                Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller Eric Dumazet <eric.dumazet@gmail.com> - 2015-11-11 15:20 +0100
                Re: [PATCH v5] net: ethernet: add driver for Aurora VLSI NB8800  Ethernet controller Eric Dumazet <eric.dumazet@gmail.com> - 2015-11-11 15:10 +0100

csiph-web