Subject: Re: [PATCH v4 2/9] bgmac: leave interrupts disabled as long as there is work to do

From: Felix Fietkau <[email-masked]>
Date: Mon, 13 Apr 2015 17:03:41 +0200

On 2015-04-13 16:34, Rafał Miłecki wrote:
> On 13 April 2015 at 15:52, Felix Fietkau <[email-masked]> wrote:
>> Always poll rx and tx during NAPI poll instead of relying on the status
>> of the first interrupt. This prevents bgmac_poll from leaving unfinished
>> work around until the next IRQ.
>> In my tests this makes bridging/routing throughput under heavy load more
>> stable and ensures that no new IRQs arrive as long as bgmac_poll uses up
>> the entire budget.
> 
> What do you think about keeping u32 int_status; and just updating it
> at the end of bgmac_poll? In case you decide to implement multiple TX
> queues, it may be cheaper to just check a single bit in memory instead
> reading DMA ring status.
Events might arrive in the mean time. I ran some tests, and not checking
the irq status for processing rx/tx gave me fewer total IRQs under load.

>> @@ -1237,25 +1234,17 @@ static irqreturn_t bgmac_interrupt(int irq, void *dev_id)
>>  static int bgmac_poll(struct napi_struct *napi, int weight)
>>  {
>>         struct bgmac *bgmac = container_of(napi, struct bgmac, napi);
>> -       struct bgmac_dma_ring *ring;
>>         int handled = 0;
>>
>> -       if (bgmac->int_status & BGMAC_IS_TX0) {
>> -               ring = &bgmac->tx_ring[0];
>> -               bgmac_dma_tx_free(bgmac, ring);
>> -               bgmac->int_status &= ~BGMAC_IS_TX0;
>> -       }
>> +       /* Ack */
>> +       bgmac_write(bgmac, BGMAC_INT_STATUS, ~0);
> 
> Is this OK to ack every IRQ, even un handled ones?
Yes. The only IRQ types that matter are the ones handled by the poll
function.

>> +       /* poll again if more events arrived in the mean time */
>> +       if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX))
>> +               return handled;
> 
> s/mean time/meantime/ (or meanwhile)
> And if you care to keep one type of comments:
> s/poll/Poll/
Will do.

- Felix