From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: "Håvard Skinnemoen" <havard@skinnemoen.net>,
"David Laight" <David.Laight@aculab.com>
Cc: <netdev@vger.kernel.org>, <manabian@gmail.com>,
<patrice.vilchez@atmel.com>, <linux-kernel@vger.kernel.org>,
<bhutchings@solarflare.com>, <plagnioj@jcrosoft.com>,
<davem@davemloft.net>, <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 06/10] net/macb: clean up ring buffer logic
Date: Wed, 31 Oct 2012 11:39:49 +0100 [thread overview]
Message-ID: <5090FFF5.6020109@atmel.com> (raw)
In-Reply-To: <5090F67C.9020104@atmel.com>
On 10/31/2012 10:59 AM, Nicolas Ferre :
> On 10/30/2012 07:22 PM, Håvard Skinnemoen :
>> On Tue, Oct 30, 2012 at 4:12 AM, David Laight <David.Laight@aculab.com> wrote:
>>>> Instead of masking head and tail every time we increment them, just let them
>>>> wrap through UINT_MAX and mask them when subscripting. Add simple accessor
>>>> functions to do the subscripting properly to minimize the chances of messing
>>>> this up.
>>> ...
>>>> +static unsigned int macb_tx_ring_avail(struct macb *bp)
>>>> +{
>>>> + return TX_RING_SIZE - (bp->tx_head - bp->tx_tail);
>>>> +}
>>>
>>> That one doesn't look quite right to me.
>>> Surely it should be masking with 'TX_RING_SIZE - 1'
>>
>> Why is that? head and tail can never be more than TX_RING_SIZE apart,
>> so it shouldn't make any difference.
>
> Absolutely.
Well not so absolute, after having thinking twice ;-)
We should move to:
static unsigned int macb_tx_ring_avail(struct macb *bp)
{
return (TX_RING_SIZE - (bp->tx_head - bp->tx_tail) & (TX_RING_SIZE - 1));
}
Thanks David!
(sorry for the noise) Bye,
--
Nicolas Ferre
next prev parent reply other threads:[~2012-10-31 9:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 10:17 [PATCH v3 00/10] net/macb: driver enhancement concerning GEM support, ring logic and cleanup Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 01/10] net/macb: Add support for Gigabit Ethernet mode Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 02/10] net/macb: memory barriers cleanup Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 03/10] net/macb: change debugging messages Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 04/10] net/macb: remove macb_get_drvinfo() Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 05/10] net/macb: tx status is more than 8 bits now Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 06/10] net/macb: clean up ring buffer logic Nicolas Ferre
2012-10-30 11:12 ` David Laight
2012-10-30 18:22 ` Håvard Skinnemoen
2012-10-31 8:57 ` David Laight
2012-10-31 9:59 ` Nicolas Ferre
2012-10-31 10:39 ` Nicolas Ferre [this message]
2012-10-31 9:48 ` David Laight
2012-10-30 11:30 ` [PATCH] net/at91_ether: fix the use of macb structure Nicolas Ferre
2012-11-03 19:04 ` David Miller
2012-11-04 23:02 ` Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 07/10] net/macb: ethtool interface: add register dump feature Nicolas Ferre
2012-10-30 10:18 ` [PATCH v3 08/10] net/macb: better manage tx errors Nicolas Ferre
2012-10-30 10:18 ` [PATCH v3 09/10] net/macb: Offset first RX buffer by two bytes Nicolas Ferre
2012-10-30 10:18 ` [PATCH v3 10/10] net/macb: add pinctrl consumer support Nicolas Ferre
2012-10-30 17:37 ` Joachim Eastwood
2012-10-31 10:42 ` Nicolas Ferre
2012-10-30 11:26 ` [PATCH v3 00/10] net/macb: driver enhancement concerning GEM support, ring logic and cleanup Nicolas Ferre
2012-10-30 17:31 ` Joachim Eastwood
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=5090FFF5.6020109@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=David.Laight@aculab.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=havard@skinnemoen.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manabian@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=patrice.vilchez@atmel.com \
--cc=plagnioj@jcrosoft.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;
as well as URLs for NNTP newsgroup(s).