From: "Måns Rullgård" <mans@mansr.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v4] net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller
Date: Sat, 31 Oct 2015 16:03:26 +0000 [thread overview]
Message-ID: <yw1xlhajauup.fsf@unicorn.mansr.com> (raw)
In-Reply-To: <20151030222841.GA24712@electric-eye.fr.zoreil.com> (Francois Romieu's message of "Fri, 30 Oct 2015 23:28:42 +0100")
Francois Romieu <romieu@fr.zoreil.com> writes:
>> +static int nb8800_poll(struct napi_struct *napi, int budget)
>> +{
>> + struct net_device *dev = napi->dev;
>> + struct nb8800_priv *priv = netdev_priv(dev);
>> + struct nb8800_dma_desc *rx;
>> + int work = 0;
>> + int last = priv->rx_eoc;
>> + int next;
>> +
>> + while (work < budget) {
>> + struct rx_buf *rx_buf;
>> + u32 report;
>> + int len;
>> +
>> + next = (last + 1) & (RX_DESC_COUNT - 1);
>> +
>> + rx_buf = &priv->rx_bufs[next];
>> + rx = &priv->rx_descs[next];
>> + report = rx->report;
>> +
>> + if (!report)
>> + break;
>> +
>> + if (IS_RX_ERROR(report)) {
>> + nb8800_rx_error(dev, report);
>> + } else if (likely(rx_buf->page)) {
>> + len = RX_BYTES_TRANSFERRED(report);
>> + nb8800_receive(dev, next, len);
>> + }
>> +
>> + rx->report = 0;
>> + if (!rx_buf->page)
>> + nb8800_alloc_rx(dev, next, true);
>
> It looks like it receives, then tries to allocate new resources. If so
> it may deplete the ring and you should instead consider allocating new
> resources first, then receive data if alloc + map suceeded.
The hardware receives a frame and stores it in the provided DMA buffer,
then raises an interrupt and moves on to the next buffer. When a buffer
is handed over to the network stack, a new one has to take its place in
the DMA queue. I'm not sure how you're suggesting this be done
differently.
--
Måns Rullgård
mans@mansr.com
next prev parent reply other threads:[~2015-10-31 16:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 16:48 Mans Rullgard
2015-10-30 22:28 ` Francois Romieu
2015-10-31 16:03 ` Måns Rullgård [this message]
2015-10-31 18:07 ` Francois Romieu
2015-10-31 18:44 ` Måns Rullgård
2015-10-31 17:21 ` Andy Shevchenko
2015-10-31 18:41 ` Måns Rullgård
2015-10-31 20:06 ` Andy Shevchenko
2015-10-31 21:41 ` Måns Rullgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yw1xlhajauup.fsf@unicorn.mansr.com \
--to=mans@mansr.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®