Page MenuHomeFreeBSD

aq(4): remove dead code and tidy macros, diagnostics, and naming
ClosedPublic

Authored by nick_spun.io on Fri, Jul 10, 3:56 AM.
Referenced Files
F164530197: D58140.id182234.diff
Sat, Aug 1, 8:42 PM
Unknown Object (File)
Sat, Aug 1, 2:28 PM
Unknown Object (File)
Fri, Jul 31, 7:09 AM
Unknown Object (File)
Fri, Jul 31, 12:32 AM
Unknown Object (File)
Thu, Jul 30, 1:37 PM
Unknown Object (File)
Thu, Jul 30, 10:01 AM
Unknown Object (File)
Wed, Jul 29, 4:24 PM
Unknown Object (File)
Wed, Jul 29, 8:40 AM
Subscribers

Details

Summary

Non-functional cleanup, with two diagnostic corrections.

Dead code: delete leftover commented-out AQ_DBG_ENTER/EXIT/PRINT calls
(aq_hw.c, aq_fw2x.c, aq_irq.c, aq_main.c), a commented-out aq_nic_cfg
local, the stale old-signature parameter blocks between the ring-init
declarations and their bodies (aq_ring.c), a trailing note on a live
statement, and the unused DumpHex() vendor debug helper (no callers; its
body only compiled under AQ_CFG_DEBUG_LVL > 3).

Register-write macros: parenthesize AQ_WRITE_REG_BIT's msk/shift/value
arguments so a compound argument cannot mis-bind, give AQ_HW_FLUSH() an
explicit hw parameter instead of capturing it from caller scope, and drop
the duplicate lowercase aq_hw_write_reg[_bit] aliases (converting the 43
call sites to the uppercase spelling) so there is a single form.

Diagnostics: the aq_log* family expanded through the base log macro, which
ignored its level and printed unconditionally, while the error traces
gated on a debug level that defaulted below LOG_ERR and so were suppressed

  • backwards. Gate the base log macro the way the trace one does and

default the level to lvl_error, so the once-per-event firmware reset /
capability errors are visible by default while the verbose info/dump
output stays opt-in.

Naming: rename identifiers carried verbatim from the vendor import that do
not match style -- names mixing an ALL-CAPS macro-style prefix with a
lowercase tail, and a trailing underscore the vendor used as a
"file-local" marker in place of static.

  • dbg_level_ / dbg_categories_ -> aq_dbg_level / aq_dbg_categories: these are real globals (the log/trace macros reference them from every translation unit), so the trailing underscore was never a stand-in for static; give them the aq_ namespace so the driver stops exporting generically-named global symbols.
  • log_base_ / trace_base_ -> aq_log_base / aq_trace_base: the internal macros behind the aq_log*/trace* families.
  • bootExitCode / flbStatus -> boot_exit_code / flb_status (aq_fw.c); flb_status now matches the identically-purposed variable already spelled that way in the sibling FLB-reset path.

Cosmetic: terminate the ring/HW-init, MSI-X admin-handler, and
media-change error messages with a newline so they are not garbled into
adjacent dmesg output, and label the per-queue rx_bytes sysctl "RX Octets"
(it was copy-pasted "TX Octets").

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Wed, Jul 15, 8:22 PM
This revision now requires review to proceed.Sun, Jul 19, 3:35 AM
This revision was not accepted when it landed; it landed in state Needs Review.Sun, Jul 19, 4:50 PM
This revision was automatically updated to reflect the committed changes.