Page MenuHomeFreeBSD

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

Authored by nick_spun.io on Fri, Jul 10, 3:56 AM.

Details

Reviewers
adrian
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 74686
Build 71569: arc lint + arc unit