Page MenuHomeFreeBSD

ena: Use correct READ_ONCE on u8 field
Needs ReviewPublic

Authored by osamaabb_amazon.com on Aug 20 2024, 8:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 10, 7:23 AM
Unknown Object (File)
Oct 29 2025, 6:00 AM
Unknown Object (File)
Oct 20 2025, 3:00 AM
Unknown Object (File)
Oct 20 2025, 2:59 AM
Unknown Object (File)
Oct 19 2025, 12:27 PM
Unknown Object (File)
Oct 12 2025, 6:14 AM
Unknown Object (File)
Sep 16 2025, 8:15 AM
Unknown Object (File)
Sep 15 2025, 1:17 AM
Subscribers

Details

Reviewers
cperciva
Summary

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 was stored in cdesc_phase, but this change makes it
even more accurate.

Approved by: cperciva
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 59065
Build 55952: arc lint + arc unit

Event Timeline

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.

Saying "the correct value is being read" sounds wrong if we're reading 16 bits from an 8-bit field. I think you mean "the correct value was stored in cdesc_phase"?

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.

Saying "the correct value is being read" sounds wrong if we're reading 16 bits from an 8-bit field. I think you mean "the correct value was stored in cdesc_phase"?

Ack