RE: [EXTERNAL] Re: [PATCH net v1 1/2] octeon_ep: avoid compiler and IQ/OQ reordering
From: Vimlesh Kumar <hidden>
Date: 2026-01-09 14:25:52
Also in:
lkml
-----Original Message----- From: Paolo Abeni <pabeni@redhat.com> Sent: Monday, December 29, 2025 9:45 PM To: Vimlesh Kumar <redacted>; netdev@vger.kernel.org; linux- kernel@vger.kernel.org Cc: Sathesh B Edara <sedara@marvell.com>; Shinas Rasheed [off-list ref]; Haseeb Gani [off-list ref]; Veerasenareddy Burru [off-list ref]; Andrew Lunn [off-list ref]; David S. Miller [off-list ref]; Eric Dumazet [off-list ref]; Jakub Kicinski [off-list ref]; Satananda Burla [off-list ref]; Abhijit Ayarekar [off-list ref] Subject: [EXTERNAL] Re: [PATCH net v1 1/2] octeon_ep: avoid compiler and IQ/OQ reordering On 12/19/25 8:29 AM, Vimlesh Kumar wrote:quoted
Utilize READ_ONCE and WRITE_ONCE APIs for IO queue Tx/Rx variable access to prevent compiler optimization and reordering. Additionally, ensure IO queue OUT/IN_CNT registers are flushed by performing a read-back after writing.Please explain why such _ONCE() annotation are required, and what could be reordered otherwise. I don't think they are needed,
We use READ_ONCE and WRITE_ONCE APIs in the data path to prevent the compiler from optimizing or reordering read/write operations. The APIs are used to access RX and TX queue counter fields that are shared between the Octeon hardware device and its device driver. These APIs ensure that the driver always reads the most current values from the hardware for various RX and TX counter fields. Additionally, they prevent the compiler from optimizing or reordering read/write operations on these counter fields.
/P