Page MenuHomeFreeBSD

aq(4): make the debug controls per-instance
AbandonedPublic

Authored by nick_spun.io on Mon, Jul 20, 1:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 24, 4:28 AM
Unknown Object (File)
Thu, Jul 23, 11:27 PM
Unknown Object (File)
Thu, Jul 23, 7:24 PM
Unknown Object (File)
Thu, Jul 23, 12:46 AM
Subscribers

Details

Reviewers
None
Summary

The debug and debug_categories sysctls were registered once per device
but every instance pointed at a single pair of file-scope globals in
aq_dbg.c. On a machine with more than one Atlantic card, writing
dev.aq.1.debug also changed dev.aq.0.debug, so a card could not be
traced in isolation. Output was emitted with a literal "atlantic: "
prefix carrying no unit number, so even a message produced at the
intended verbosity could not be attributed to a card.

Move the level and the category mask into struct aq_dev and reach them
from the firmware and hardware layers through the aq_dev back-pointer
in struct aq_hw, which until now was declared and never assigned. Wire
it up in aq_if_attach_pre() next to hw->dev, before the first firmware
call can trace. This mirrors the Linux driver, whose struct aq_hw_s
carries an aq_nic_cfg pointer that the hw_atl layer dereferences
directly.

Guard the dereference. Tracing begins inside attach_pre, so a NULL
back-pointer is reachable if that assignment is ever moved below the
firmware bring-up, and the result would be a page fault at attach
rather than a missing message. Linux guards the same pointer.

Emit through device_printf() so each line carries its unit, and give
the descriptor tracers an aq_hw argument for the same reason the
macros take one.

Seed the initial values from per-unit device hints, so tracing can be
turned on for attach, which runs before the sysctls exist:

hint.aq.1.debug=6
hint.aq.1.debug_categories=63

The compile-time AQ_DBG_* macros are untouched. AQ_CFG_DEBUG_LVL is
hardcoded to 0 and is not overridden anywhere, so they expand to
nothing and produce no output.

Tested on a host with an AQC107 and an AQC113 direct-attached at
10Gbase-T. Before the change, setting only dev.aq.1.debug=6 raised
dev.aq.0.debug to 6 and a link bounce emitted ten unattributed
"atlantic:" lines. After it, dev.aq.0.debug holds at 3 and the same
bounce emits none, while dev.aq.0.debug=6 emits five lines all
prefixed "aq0:".

Signed-off-by: Nick Price <nick@spun.io>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74942
Build 71825: arc lint + arc unit

Event Timeline

Superseded by a consolidated aq(4) series; abandoning in favor of new revisions.