Page MenuHomeFreeBSD

aq(4): observability controls and sysctl/header hygiene
Needs ReviewPublic

Authored by nick_spun.io on Fri, Jul 24, 3:38 PM.
Tags
None
Referenced Files
F164259861: D58434.id182900.diff
Thu, Jul 30, 4:39 AM
F164253991: D58434.id182897.diff
Thu, Jul 30, 3:36 AM
F164233157: D58434.id182618.diff
Wed, Jul 29, 10:19 PM
F164204026: D58434.id182751.diff
Wed, Jul 29, 3:32 PM
F164201644: D58434.diff
Wed, Jul 29, 2:53 PM
F164161137: D58434.id182751.diff
Wed, Jul 29, 6:32 AM
Unknown Object (File)
Tue, Jul 28, 7:09 PM
Unknown Object (File)
Tue, Jul 28, 4:40 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Fold the driver's observability and infrastructure work.

Make aq_device.h self-contained: it declares struct aq_dev in terms of
iflib, bitstring, socket, and ethernet types but included none of the
headers that define them, compiling only because every includer happened
to pull those first. Include what it uses. No functional change.

Make the debug controls per-instance. The debug and debug_categories
sysctls were registered per device but pointed at file-scope globals, so
writing dev.aq.1.debug also changed dev.aq.0.debug and a card could not
be traced in isolation. Move the level and category mask into struct
aq_dev, reach them through the aq_dev back-pointer in struct aq_hw (wired
up in attach_pre before the first firmware trace and guarded against a
NULL deref), emit through device_printf() so each line carries its unit,
and seed initial values from per-unit device hints so attach can be
traced.

Expose the PHY die temperature as dev.aq.N.temperature through a new
firmware get_temp op: Atlantic 1 v2 reads it through the mailbox MPI
control/state toggle, Atlantic 2 from the phy_health_monitor block in the
OUT window (located at 0x13620 and confirmed by its ready bit). Atlantic
1 v1 has no sensor and exposes no node. Because this is the first
firmware accessor iflib does not serialise, add a per-instance mutex in
struct aq_hw and take it across the v2 read-modify-write in set_mode(),
get_stats(), get_mode(), and get_temp(); the v1 and Atlantic 2 paths do
not need it and say so.

Trace the Atlantic 2 firmware path, which previously emitted nothing at
any debug level (aq2_fw.c did not even include aq_dbg.h): the boot
handshake, reset policy, MAC address, and link mode set/read, using the
existing dbg_init and dbg_fw categories, with the per-poll mode read at
detail level.

Scope the driver sysctls to a context freed at detach. They were
registered on the device newbus context, which newbus tears down only
after DEVICE_DETACH returns, yet iflib frees the rings and softc inside
DEVICE_DETACH -- a sysctl read racing detach could touch freed memory.
Give the driver its own sysctl_ctx_list and free it at the start of
aq_if_detach, draining in-flight readers first.

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

Diff Detail

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

Event Timeline

Tighten source comments; no functional change.

Self-review pass: no functional change to this commit. Commit message
amended to carry the Differential Revision reference.

Quieten the default boot: gate the per-vector attach messages behind bootverbose, announce the Atlantic 2 firmware banner once per attach rather than on every bring-up, and say that a TX ring shares an RX ring's vector instead of reporting it as a separate assignment.

Drop the explanatory block comments; the reasoning is in the commit message.

Collapse the multi-line block comments to single lines; the reasoning is already in the commit message.

Refreshed after the comment-cleanup rebase of the series.