Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX

From: Corentin Labbe
Date: Tue Jan 31 2017 - 08:41:13 EST


On Tue, Jan 31, 2017 at 11:28:03AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > The stmmac driver run TX completion under NAPI but without checking the
> > work done by the TX completion function.
> >
> > This patch add work/budget to the TX completion function.
> >
> > The visible effect is that it keep the driver longer under NAPI and
> > boost performance.
> > Under dwmac-sun8i the iperf goes from 140Mbit/s to 500Mbit/s.
> > Under dwmac-sunxi an iperf run use half less interrupts.
>
> I think that this patch should be sent separately with more details
> about the implementation you are adopting and results.
>

This patch is just implementing what NAPI documentation say.
"The budget parameter places a limit on the amount of work the driver may do. Each received packet counts as one unit of work. The poll() function may also process TX completions, in which case if it processes the entire TX ring then it should count that work as the rest of the budget. Otherwise, TX completions are not counted."

For the history, I have done the sun8i-emac driver for H3/A64 and get with if very good performance.
Some people find that the hardware was in fact a modified version of dwmac and so I start working on dwmac-sun8i glue driver.
Testing dwmac-sun8i give very bad performance and the only real difference between thoses two driver was the handling of NAPI TX mitigation.

The performance are tested with a simple iperf.
I will redo some test with some numbers

> For example, in the timer callback you force 256 (it seems
> DMA_TX_SIZE/2); do you think this should be tunable or fixed to
> NAPI budget?

I think that the whole "TX mitigation timer" is useless when using TX completion within NAPI.
I will do some bench for checking with and without it.

>
> I'd like to understand if performance you get are for TCP traffic;
> can you tell me what happens on unidirectional traffic?
>
> Thx a lot for your effort, pls let me know
>
> Regards
> peppe
>