All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 06/10] net/macb: clean up ring buffer logic
Date: Wed, 31 Oct 2012 10:59:24 +0100	[thread overview]
Message-ID: <5090F67C.9020104@atmel.com> (raw)
In-Reply-To: <CACiLriQnQcoXFqrqNt3nkY47nR8FnXbqWjtPRp250gueHSMDmQ@mail.gmail.com>

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.

Best regards,
-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
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>, <davem@davemloft.net>,
	<bhutchings@solarflare.com>,
	<linux-arm-kernel@lists.infradead.org>, <plagnioj@jcrosoft.com>,
	<patrice.vilchez@atmel.com>, <linux-kernel@vger.kernel.org>,
	<manabian@gmail.com>
Subject: Re: [PATCH v3 06/10] net/macb: clean up ring buffer logic
Date: Wed, 31 Oct 2012 10:59:24 +0100	[thread overview]
Message-ID: <5090F67C.9020104@atmel.com> (raw)
In-Reply-To: <CACiLriQnQcoXFqrqNt3nkY47nR8FnXbqWjtPRp250gueHSMDmQ@mail.gmail.com>

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.

Best regards,
-- 
Nicolas Ferre

  parent reply	other threads:[~2012-10-31  9:59 UTC|newest]

Thread overview: 48+ 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 ` 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   ` Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 02/10] net/macb: memory barriers cleanup Nicolas Ferre
2012-10-30 10:17   ` Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 03/10] net/macb: change debugging messages Nicolas Ferre
2012-10-30 10:17   ` Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 04/10] net/macb: remove macb_get_drvinfo() Nicolas Ferre
2012-10-30 10:17   ` 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   ` Nicolas Ferre
2012-10-30 10:17 ` [PATCH v3 06/10] net/macb: clean up ring buffer logic Nicolas Ferre
2012-10-30 10:17   ` Nicolas Ferre
2012-10-30 11:12   ` David Laight
2012-10-30 11:12     ` David Laight
2012-10-30 18:22     ` Håvard Skinnemoen
2012-10-30 18:22       ` Håvard Skinnemoen
2012-10-31  8:57       ` David Laight
2012-10-31  8:57         ` David Laight
2012-10-31  9:59       ` Nicolas Ferre [this message]
2012-10-31  9:59         ` Nicolas Ferre
2012-10-31 10:39         ` Nicolas Ferre
2012-10-31 10:39           ` Nicolas Ferre
2012-10-31  9:48           ` David Laight
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-10-30 11:30     ` Nicolas Ferre
2012-11-03 19:04     ` David Miller
2012-11-03 19:04       ` David Miller
2012-11-04 23:02       ` Nicolas Ferre
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:17   ` Nicolas Ferre
2012-10-30 10:18 ` [PATCH v3 08/10] net/macb: better manage tx errors Nicolas Ferre
2012-10-30 10:18   ` 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   ` Nicolas Ferre
2012-10-30 10:18 ` [PATCH v3 10/10] net/macb: add pinctrl consumer support Nicolas Ferre
2012-10-30 10:18   ` Nicolas Ferre
2012-10-30 17:37   ` Joachim Eastwood
2012-10-30 17:37     ` Joachim Eastwood
2012-10-31 10:42     ` Nicolas Ferre
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 11:26   ` Nicolas Ferre
2012-10-30 17:31 ` Joachim Eastwood
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=5090F67C.9020104@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.