From nobody Sat Jun 20 19:10:42 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gjPDy5M2wz6hNv6 for ; Sat, 20 Jun 2026 19:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gjPDy2wWHz3v4l for ; Sat, 20 Jun 2026 19:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781982642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TvpEWHyLoGUlH94LQmlamAJR5+Xwl2CaIsJf8/pHmQ0=; b=Dd+pdzw5xWWBM3mFuYpON9FZSFCybu664GrgDSKp8xZOqcpH9bucnigk2IArOfdo6YoWu7 Yn3vaHvMk0q87Kzq93L7QYZ6hWO+8rw+WucneC0e1J6dG14li02KTquCQ8izeChB/Bn/Vd C7tUQHZHzfny+8UMOJH53quxJ05vHoUgenD32OiPKTtuBPP6GlOF3j0Ju6p1GmgjqrhLU5 D8YzF/wDFcFRpSJxmc1sErsl9AaApKpeIvO9bi5XGnqOtUPkKtJ1VbPAJ8KakRf8ob+bGz LgNwTOEdgYa99ECK8mxrKbTTngvjgNRl8Qte1qcrXW0avHrJiIZAny0uBWcmsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781982642; a=rsa-sha256; cv=none; b=a+Ld6TIIFB2S3Sz+HOCqxKKpBIjKzs+L7f3fiPlMUqrl+hDCdKOLo5sKE8cn9Zfh3jo+vg Q5GrQsKB4XzcERa5y+fQ+MtOZMCRSyoOTHRp87UONKBXd419k8LYmsiu+ELCuvZxqvv16v /JNZytx9PZUsDbYahme56qnnVyqt5SAnFpr2lbdbTmTZRaZmE/B6UpAqXUCJTA7Yl4PTH7 BteNgMydP3D7baB936oXsiR3gQh7bbIteHN2tiejFw/+CNP5sNPjeyHZXltsrINfFAdevV kEQ9nGwqDFtKWteQOKBqp6qOjmMobsfDfAppFEfwyrm0GZrj0gofxWKe+Y+Uzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781982642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TvpEWHyLoGUlH94LQmlamAJR5+Xwl2CaIsJf8/pHmQ0=; b=H4oTNBpxXw0Vqtn0QY4c6ENvl83i+cboZ3oQ9+AEXbyO8gE8a9rYUbi1SQSKEVi0YovABG ASfD1FC0b3/gIme6M1ZX6nb9RK/84ru+H2Z3TcNqB3IjzLJxFKoV1lEnNSCFDdtIDTrJc2 y9uK3RZem/V5YkH8UirjPhO1WVxloAZ4iKDMQhL8/CUohM62KYyyPxy0thaupSod8uwJRM NV/8ERfI3nhko1SwI7pF712ZYNpFBezIvxbF24wNMnYG+wh00uLLo5iokQ+yyB5JFre2X0 FKJkIL+3RP4pFOQ+ay5GROuY75fujouwtnTH6ukvk76V+4PBV0SgerqaE2NJTw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gjPDy1RG7zk39 for ; Sat, 20 Jun 2026 19:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 334bd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 20 Jun 2026 19:10:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Nick Price From: Adrian Chadd Subject: git: 76d0a25be397 - main - aq(4): add a runtime dev.aq.N.debug trace control List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76d0a25be3976634631bab975f4c2ddbc98f72a2 Auto-Submitted: auto-generated Date: Sat, 20 Jun 2026 19:10:42 +0000 Message-Id: <6a36e5b2.334bd.6852a26a@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=76d0a25be3976634631bab975f4c2ddbc98f72a2 commit 76d0a25be3976634631bab975f4c2ddbc98f72a2 Author: Nick Price AuthorDate: 2026-06-20 19:03:28 +0000 Commit: Adrian Chadd CommitDate: 2026-06-20 19:10:16 +0000 aq(4): add a runtime dev.aq.N.debug trace control The trace_* family (trace/trace_error/trace_warn/trace_detail, used in the F/W and init/config paths) was gated behind the compile-time AQ_CFG_DEBUG_LVL, which is 0, so the dbg_level_/dbg_categories_ runtime variables were dead and tracing could only be enabled by recompiling. Decouple trace_base_ from AQ_CFG_DEBUG_LVL so it is always compiled and gated purely at runtime on dbg_level_/dbg_categories_, make those two variables writable (no longer const, default level 0 = off), and expose them as dev.aq.N.debug (verbosity) and dev.aq.N.debug_categories (subsystem mask) sysctls. The datapath-heavy AQ_DBG_ENTER/PRINT/DUMP macros and the trace_aq_*_descr descriptor dumps stay behind AQ_CFG_DEBUG_LVL (still 0), so the per-packet paths are untouched -- trace_* is only used off the datapath. The two variables are global (the trace macros reference them directly), so the per-device sysctls share one backing store, which is fine for a debug knob. Validated on AQC107: dev.aq.0.debug defaults to 0 with no trace output; setting it to 6 emits the F/W init/reset/capabilities traces on the next F/W operation; setting it back to 0 silences them; traffic unaffected at line rate, rx_err=0. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57440 --- sys/dev/aq/aq_dbg.c | 4 ++-- sys/dev/aq/aq_dbg.h | 10 +++------- sys/dev/aq/aq_main.c | 8 ++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/aq/aq_dbg.c b/sys/dev/aq/aq_dbg.c index ec3954185749..86e8fb9cc82a 100644 --- a/sys/dev/aq/aq_dbg.c +++ b/sys/dev/aq/aq_dbg.c @@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$"); #include "aq_dbg.h" -const enum aq_debug_level dbg_level_ = lvl_detail; -const uint32_t dbg_categories_ = dbg_init | dbg_config | dbg_fw; +int dbg_level_ = 0; +uint32_t dbg_categories_ = dbg_init | dbg_config | dbg_tx | dbg_rx | dbg_intr | dbg_fw; diff --git a/sys/dev/aq/aq_dbg.h b/sys/dev/aq/aq_dbg.h index 280572e7d5da..7b546d4f3d78 100644 --- a/sys/dev/aq/aq_dbg.h +++ b/sys/dev/aq/aq_dbg.h @@ -109,16 +109,12 @@ enum aq_debug_category #define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) -extern const enum aq_debug_level dbg_level_; -extern const uint32_t dbg_categories_; +extern int dbg_level_; +extern uint32_t dbg_categories_; #define log_base_(_lvl, _fmt, args...) printf( "atlantic: " _fmt "\n", ##args) -#if AQ_CFG_DEBUG_LVL > 0 -#define trace_base_(_lvl, _cat, _fmt, args...) do { if (dbg_level_ >= _lvl && (_cat & dbg_categories_)) { printf( "atlantic: " _fmt " @%s,%d\n", ##args, __FILENAME__, __LINE__); }} while (0) -#else -#define trace_base_(_lvl, _cat, _fmt, ...) do {} while (0) -#endif // AQ_CFG_DEBUG_LVL > 0 +#define trace_base_(_lvl, _cat, _fmt, args...) do { if (dbg_level_ >= (_lvl) && ((_cat) & dbg_categories_)) { printf( "atlantic: " _fmt " @%s,%d\n", ##args, __FILENAME__, __LINE__); }} while (0) #define aq_log_warn(_fmt, args...) log_base_(lvl_warn, "/!\\ " _fmt, ##args) #define aq_log(_fmt, args...) log_base_(lvl_trace, _fmt, ##args) diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c index ecb7e66e5b15..e1b294012b27 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -1311,6 +1311,14 @@ aq_add_stats_sysctls(struct aq_dev *softc) CTLTYPE_STRING | CTLFLAG_RD, softc, 0, aq_sysctl_print_rss_config, "A", "Prints RSS Configuration"); + /* Runtime trace controls (global) */ + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "debug", + CTLFLAG_RW, &dbg_level_, 0, + "Trace verbosity: 0=off, 3=err, 4=+warn, 5=+trace, 6=+detail"); + SYSCTL_ADD_U32(ctx, child, OID_AUTO, "debug_categories", + CTLFLAG_RW, &dbg_categories_, 0, + "Trace category mask: init=1 config=2 tx=4 rx=8 intr=16 fw=32"); + /* Driver Statistics */ for (int i = 0; i < softc->tx_rings_count; i++) { struct aq_ring *ring = softc->tx_rings[i];