[PATCH net-next RFC] net: ethernet: mtk_eth_soc: use prefetch methods
Elad Yifee
eladwf at gmail.com
Mon Jul 22 11:04:06 PDT 2024
On Mon, Jul 22, 2024 at 7:17 PM Joe Damato <jdamato at fastly.com> wrote:
>
> On Sat, Jul 20, 2024 at 07:46:18PM +0300, Elad Yifee wrote:
> > Utilize kernel prefetch methods for faster cache line access.
> > This change boosts driver performance,
> > allowing the CPU to handle about 5% more packets/sec.
>
> Nit: It'd be great to see before/after numbers and/or an explanation of
> how you measured this in the commit message.
Sure, I'll add iperf3 results in the next version.
> Is there any reason to mix net_prefetch (as you have below) with
> prefetch and prefetchw ?
>
> IMHO: you should consider using net_prefetch and net_prefetchw
> everywhere instead of using both in your code.
You are right, honestly I didn't notice it exists.
I'll replace all prefetchw with net_prefetchw.
> > @@ -2039,7 +2040,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
> > idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
> > rxd = ring->dma + idx * eth->soc->rx.desc_size;
> > data = ring->data[idx];
> > -
> > + prefetch(rxd);
>
> Maybe net_prefetch instead, as mentioned above?
This is the only case where I think prefetch should be used since it's
only the descriptor.
Thank you for your suggestions
More information about the Linux-mediatek
mailing list