Page MenuHomeFreeBSD

Refactor style of the ENA driver
ClosedPublic

Authored by mk_semihalf.com on Oct 31 2017, 1:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 6:36 AM
Unknown Object (File)
Nov 25 2023, 11:41 PM
Unknown Object (File)
Nov 23 2023, 3:34 PM
Unknown Object (File)
Nov 23 2023, 6:21 AM
Unknown Object (File)
Nov 16 2023, 7:22 AM
Unknown Object (File)
Sep 6 2023, 6:44 PM
Unknown Object (File)
Aug 15 2023, 6:28 AM
Unknown Object (File)
Jul 27 2023, 2:29 AM

Details

Summary
  • Change all conditional checks in "if" statement to boolean expressions
  • Initialzie variables with too complex values outside the declaration
  • Fix indentations
  • Move code associated with sysctls to ena_sysctl.c file
  • For consistency, remove unnecesary "return" from void functions
  • Use if_getdrvflags() function instead of accesing variable directly

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Most of these changes look to be in the right direction. I don't think evaluating if a bool == true or == false is necessary. In some places parentheses have been added which are not strictly needed, I don't feel strongly about those either way. I did not evaluate for completeness.

sys/dev/ena/ena.c
1430 ↗(On Diff #34523)

This one is not necessary, rss_support is already a bool.

1433 ↗(On Diff #34523)

As above, frag is bool.

1434 ↗(On Diff #34523)

style(9) discourages excess parentheses when the parsing is not confusing. I don't have a complaint if you prefer to parenthesize this, but FYI it is not required by style.

1587–1598 ↗(On Diff #34523)

As above, l3_csum_err and l4_csum_err are already bools.

The boolean variables are no longer compared explicitly to true/false.

sys/dev/ena/ena.c
2220 ↗(On Diff #34672)

Please correct the condition or leave the original version, if running field is boolean.

2455 ↗(On Diff #34672)

Please align lines 2427 and 2428

2980 ↗(On Diff #34672)

is_drbr_empty is should be treated as boolean

mk_semihalf.com marked 3 inline comments as done.

Fix style issues and invalid conditional check

This revision is now accepted and ready to land.Nov 9 2017, 11:27 AM
This revision was automatically updated to reflect the committed changes.