Re: [PATCH v2 net-next 12/15] net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18.05.22 17:47, Jakub Kicinski wrote:
On Wed, 18 May 2022 11:53:12 +0200 Lorenzo Bianconi wrote:
> > +	WRITE_ONCE(desc->txd7, 0);
> > + WRITE_ONCE(desc->txd8, 0); > > Why all the WRITE_ONCE()? Don't you just need a barrier between writing > the descriptor and kicking the HW?
I used this approach just to be aligned with current codebase:
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/mediatek/mtk_eth_soc.c#L1006
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/mediatek/mtk_eth_soc.c#L1031

but I guess we can even convert the code to use barrier instead. Agree?

Oh, I didn't realize. No preference on converting the old code
but it looks like a cargo cult to me so in the new code let's
not WRITE_ONCE() all descriptor writes unless there's a reason.
If I remember correctly, the existing places use WRITE_ONCE to prevent write tearing to uncached memory.

- Felix



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux