[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJxxZ0Niah8QXGoa4CT4Y5i7qnSjL2xq_GYq7rUHmdJpaNzBHg@mail.gmail.com>
Date: Tue, 22 Jul 2014 16:53:30 +0800
From: Sonic Zhang <sonic.adi@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
netdev <netdev@...r.kernel.org>,
Francois Romieu <romieu@...zoreil.com>,
adi-buildroot-devel@...ts.sourceforge.net,
"Zhang, Sonic" <sonic.zhang@...log.com>
Subject: Re: [PATCH v7] bfin_mac: convert bfin Ethernet driver to NAPI framework
Hi David,
On Tue, Jul 22, 2014 at 4:01 PM, David Miller <davem@...emloft.net> wrote:
> From: Eric Dumazet <eric.dumazet@...il.com>
> Date: Tue, 22 Jul 2014 09:59:44 +0200
>
>> On Tue, 2014-07-22 at 15:38 +0800, Sonic Zhang wrote:
>>> From: Sonic Zhang <sonic.zhang@...log.com>
>>
>>> + if (i < budget) {
>>> + napi_complete(napi);
>>> + if (lp->rx_irq_disabled--)
>>> + if (!lp->rx_irq_disabled)
>>> + enable_irq(IRQ_MAC_RX);
>>
>>
>> You wrote :
>>
>> if (A--)
>> if (!A)
>> something();
>>
>> Isnt a bit strange ???
>
> Indeed, it's very strange, how about:
>
> if (!--lp->rx_irq_disabled)
>
> which is the canonical way to express this.
if (!--A)
doesn't equal to
if (A--)
if (!A)
In net poll loop, because of NAPI state bit NAPI_STATE_NPSVC, the napi
poll callback may be called with A = 0 (MAC RX IRQ is enabled) if
napi_complete() other than __napi_complete() is used. See the
explanation in my last email.
In this case, the up condition decreases A to a negative number and
the interrupt handler condition "if (!A++)" can never increase A back
to 0 (disable the RX IRQ). While, the down condition only decreases A
if it is not 0.
Regards,
Sonic
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists