[PATCH v4 11/31] net/ena/base: use correct read once on u8 field
shaibran at amazon.com
shaibran at amazon.com
Tue Mar 12 19:06:56 CET 2024
From: Shai Brandes <shaibran at amazon.com>
The flags field in ena_eth_io_tx_cdesc is 8-bits long.
The current macro used is READ_ONCE16.
Switching to READ_ONCE8 to avoid reading extra data.
Given that there's an implicit cast to u8 in the assignment,
the correct value is being read, but this change makes it
even more accurate.
Signed-off-by: Shai Brandes <shaibran at amazon.com>
Reviewed-by: Amit Bernstein <amitbern at amazon.com>
---
drivers/net/ena/base/ena_eth_com.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ena/base/ena_eth_com.h b/drivers/net/ena/base/ena_eth_com.h
index cee4f35124..6a7c17f84f 100644
--- a/drivers/net/ena/base/ena_eth_com.h
+++ b/drivers/net/ena/base/ena_eth_com.h
@@ -219,7 +219,7 @@ static inline int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq,
* expected, it mean that the device still didn't update
* this completion.
*/
- cdesc_phase = READ_ONCE16(cdesc->flags) & ENA_ETH_IO_TX_CDESC_PHASE_MASK;
+ cdesc_phase = READ_ONCE8(cdesc->flags) & ENA_ETH_IO_TX_CDESC_PHASE_MASK;
if (cdesc_phase != expected_phase)
return ENA_COM_TRY_AGAIN;
--
2.17.1
More information about the dev
mailing list