Date: Sun, 02 Aug 2026 23:10:34 +0000 From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Nick Price <nick@spun.io> Subject: git: ae7e2c9170f6 - main - aq(4): clean up diagnostics and remove dead code Message-ID: <6a6fce6a.425f9.54d210b4@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ae7e2c9170f6f7e39ab3132eb72c89f9f6e3a4d6 commit ae7e2c9170f6f7e39ab3132eb72c89f9f6e3a4d6 Author: Nick Price <nick@spun.io> AuthorDate: 2026-08-02 22:44:43 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2026-08-02 22:44:43 +0000 aq(4): clean up diagnostics and remove dead code Non-functional cleanup, no change in behavior. device_printf() already prefixes each line with the device name, so the inline "atlantic:" token in the status and error messages produced a doubled prefix and diverged from the trace macros; remove it so all output carries one uniform "aqN:" prefix. Compile the RX/TX descriptor tracers only when AQ_CFG_DEBUG_LVL > 2 and make them no-op macros otherwise, so the default build no longer pays a cross-TU call plus argument evaluation per descriptor. Drop enum aq_dev_state, struct aq_rx_filters, and struct aq_vlan_tag, which have no remaining references now that VLAN state lives in a bitstr_t. Replace the four identical aq_sysctl_print_{tx,rx}_{head,tail} handlers, each carrying a dead write path on a read-only oid, with one aq_sysctl_print_ring_ptr that selects the accessor from arg2. Reduce the thermal and PHY-recovery comments to single terse lines that keep the load-bearing register numbers and the A1-vs-A2 recovery difference. Signed-off-by: Nick Price <nick@spun.io> Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58436 --- sys/dev/aq/aq_dbg.c | 3 ++ sys/dev/aq/aq_dbg.h | 6 +++ sys/dev/aq/aq_device.h | 18 ------- sys/dev/aq/aq_irq.c | 4 +- sys/dev/aq/aq_main.c | 126 +++++++++++++++++-------------------------------- 5 files changed, 53 insertions(+), 104 deletions(-) diff --git a/sys/dev/aq/aq_dbg.c b/sys/dev/aq/aq_dbg.c index 44391322143d..078d561f5f9e 100644 --- a/sys/dev/aq/aq_dbg.c +++ b/sys/dev/aq/aq_dbg.c @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); (BIT(BIT_BEGIN - BIT_END + 1) -1)) #define __field(TYPE, VAR) TYPE VAR; + +#if AQ_CFG_DEBUG_LVL > 2 void trace_aq_tx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer, volatile uint64_t descr[2]) @@ -192,3 +194,4 @@ trace_aq_tx_context_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer, __entry->des_typ); #endif } +#endif diff --git a/sys/dev/aq/aq_dbg.h b/sys/dev/aq/aq_dbg.h index 148916e3cbda..805ac3f05f44 100644 --- a/sys/dev/aq/aq_dbg.h +++ b/sys/dev/aq/aq_dbg.h @@ -150,11 +150,17 @@ enum aq_debug_category #define trace_detail(_hw, _cat, _fmt, args...) \ aq_trace_base(_hw, lvl_detail, _cat, _fmt, ##args) +#if AQ_CFG_DEBUG_LVL > 2 void trace_aq_tx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer, volatile uint64_t descr[2]); void trace_aq_rx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer, volatile uint64_t descr[2]); void trace_aq_tx_context_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer, volatile uint64_t descr[2]); +#else +#define trace_aq_tx_descr(...) ((void)0) +#define trace_aq_rx_descr(...) ((void)0) +#define trace_aq_tx_context_descr(...) ((void)0) +#endif #endif // AQ_DBG_H diff --git a/sys/dev/aq/aq_device.h b/sys/dev/aq/aq_device.h index 1ace227974a5..07482e5402ca 100644 --- a/sys/dev/aq/aq_device.h +++ b/sys/dev/aq/aq_device.h @@ -92,24 +92,6 @@ struct aq_stats { uint64_t bbtc; }; -enum aq_dev_state { - AQ_DEV_STATE_UNLOAD, - AQ_DEV_STATE_PCI_STOP, - AQ_DEV_STATE_DOWN, - AQ_DEV_STATE_UP, -}; - -struct aq_rx_filters { - unsigned int rule_cnt; - struct aq_rx_filter_vlan vlan_filters[AQ_HW_VLAN_MAX_FILTERS]; - struct aq_rx_filter_l2 etype_filters[AQ_HW_ETYPE_MAX_FILTERS]; -}; - -struct aq_vlan_tag { - SLIST_ENTRY(aq_vlan_tag) next; - uint16_t tag; -}; - struct aq_dev { device_t dev; if_ctx_t ctx; diff --git a/sys/dev/aq/aq_irq.c b/sys/dev/aq/aq_irq.c index 325a957b1e8f..dc1b0ac351ff 100644 --- a/sys/dev/aq/aq_irq.c +++ b/sys/dev/aq/aq_irq.c @@ -219,7 +219,7 @@ aq_if_update_admin_status(if_ctx_t ctx) struct aq_hw_fc_info fc_neg; aq_hw_get_link_state(hw, &link_speed, &fc_neg); if (link_speed && !aq_dev->linkup) { /* link was DOWN */ - device_printf(aq_dev->dev, "atlantic: link UP: speed=%d\n", link_speed); + device_printf(aq_dev->dev, "link UP: speed=%d\n", link_speed); aq_dev->linkup = 1; aq_dev->phy_fault_last = 0; @@ -234,7 +234,7 @@ aq_if_update_admin_status(if_ctx_t ctx) /* update ITR settings according new link speed */ aq_hw_interrupt_moderation_set(hw); } else if (link_speed == 0U && aq_dev->linkup) { /* link was UP */ - device_printf(aq_dev->dev, "atlantic: link DOWN\n"); + device_printf(aq_dev->dev, "link DOWN\n"); aq_dev->linkup = 0; diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c index 4fe9aad42a71..445d02da3257 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -629,7 +629,7 @@ aq_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, M_AQ, M_NOWAIT | M_ZERO); if (!ring){ rc = ENOMEM; - device_printf(softc->dev, "atlantic: tx_ring malloc fail\n"); + device_printf(softc->dev, "tx_ring malloc fail\n"); goto fail; } ring->tx_descs = (volatile struct aq_tx_desc*)vaddrs[i]; @@ -644,7 +644,7 @@ aq_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, rc = aq_ring_stats_alloc(ring); if (rc != 0) { device_printf(softc->dev, - "atlantic: tx_ring stats alloc fail\n"); + "tx_ring stats alloc fail\n"); goto fail; } } @@ -675,7 +675,7 @@ aq_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, if (!ring){ rc = ENOMEM; device_printf(softc->dev, - "atlantic: rx_ring malloc fail\n"); + "rx_ring malloc fail\n"); goto fail; } @@ -690,7 +690,7 @@ aq_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, rc = aq_ring_stats_alloc(ring); if (rc != 0) { device_printf(softc->dev, - "atlantic: rx_ring stats alloc fail\n"); + "rx_ring stats alloc fail\n"); goto fail; } } @@ -756,7 +756,7 @@ aq_if_init(if_ctx_t ctx) err = aq_hw_init(&softc->hw, softc->hw.mac_addr, softc->msix, softc->scctx->isc_intr == IFLIB_INTR_MSIX); if (err != 0) { - device_printf(softc->dev, "atlantic: aq_hw_init: %d\n", err); + device_printf(softc->dev, "aq_hw_init: %d\n", err); AQ_DBG_EXIT(err); return; } @@ -774,12 +774,12 @@ aq_if_init(if_ctx_t ctx) err = aq_ring_tx_init(&softc->hw, ring); if (err) { device_printf(softc->dev, - "atlantic: aq_ring_tx_init: %d\n", err); + "aq_ring_tx_init: %d\n", err); } err = aq_ring_tx_start(hw, ring); if (err != 0) { device_printf(softc->dev, - "atlantic: aq_ring_tx_start: %d\n", err); + "aq_ring_tx_start: %d\n", err); } } for (i = 0; i < softc->rx_rings_count; i++) { @@ -788,12 +788,12 @@ aq_if_init(if_ctx_t ctx) err = aq_ring_rx_init(&softc->hw, ring); if (err) { device_printf(softc->dev, - "atlantic: aq_ring_rx_init: %d\n", err); + "aq_ring_rx_init: %d\n", err); } err = aq_ring_rx_start(hw, ring); if (err != 0) { device_printf(softc->dev, - "atlantic: aq_ring_rx_start: %d\n", err); + "aq_ring_rx_start: %d\n", err); } aq_if_rx_queue_intr_enable(ctx, i); } @@ -1325,80 +1325,38 @@ aq_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS) return (0); } -static int -aq_sysctl_print_tx_head(SYSCTL_HANDLER_ARGS) -{ - struct aq_ring *ring = arg1; - int error = 0; - unsigned int val; - - if (!ring) - return (0); - - val = tdm_tx_desc_head_ptr_get(&ring->dev->hw, ring->index); - - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return (error); - - return (0); -} - -static int -aq_sysctl_print_tx_tail(SYSCTL_HANDLER_ARGS) -{ - struct aq_ring *ring = arg1; - int error = 0; - unsigned int val; - - if (!ring) - return (0); - - val = reg_tx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index); - - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return (error); - - return (0); -} - -static int -aq_sysctl_print_rx_head(SYSCTL_HANDLER_ARGS) -{ - struct aq_ring *ring = arg1; - int error = 0; - unsigned int val; - - if (!ring) - return (0); - - val = rdm_rx_desc_head_ptr_get(&ring->dev->hw, ring->index); - - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return (error); - - return (0); -} +enum aq_ring_ptr { + AQ_RING_TX_HEAD, + AQ_RING_TX_TAIL, + AQ_RING_RX_HEAD, + AQ_RING_RX_TAIL, +}; static int -aq_sysctl_print_rx_tail(SYSCTL_HANDLER_ARGS) +aq_sysctl_print_ring_ptr(SYSCTL_HANDLER_ARGS) { - struct aq_ring *ring = arg1; - int error = 0; - unsigned int val; + struct aq_ring *ring = arg1; + unsigned int val; - if (!ring) + if (ring == NULL) return (0); - val = reg_rx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index); - - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return (error); + switch (arg2) { + case AQ_RING_TX_HEAD: + val = tdm_tx_desc_head_ptr_get(&ring->dev->hw, ring->index); + break; + case AQ_RING_TX_TAIL: + val = reg_tx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index); + break; + case AQ_RING_RX_HEAD: + val = rdm_rx_desc_head_ptr_get(&ring->dev->hw, ring->index); + break; + default: /* AQ_RING_RX_TAIL */ + val = reg_rx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index); + break; + } - return (0); + return (sysctl_handle_int(oidp, &val, 0, req)); } static int @@ -1467,11 +1425,11 @@ aq_add_stats_sysctls(struct aq_dev *softc) SYSCTL_ADD_COUNTER_U64(ctx, queue_list, OID_AUTO, "tx_bytes", CTLFLAG_RD, &(ring->stats.tx_bytes), "TX Octets"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "tx_head", - CTLTYPE_UINT | CTLFLAG_RD, ring, 0, - aq_sysctl_print_tx_head, "IU", "ring head pointer"); + CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_TX_HEAD, + aq_sysctl_print_ring_ptr, "IU", "ring head pointer"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "tx_tail", - CTLTYPE_UINT | CTLFLAG_RD, ring, 0, - aq_sysctl_print_tx_tail, "IU", "ring tail pointer"); + CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_TX_TAIL, + aq_sysctl_print_ring_ptr, "IU", "ring tail pointer"); } for (int i = 0; i < softc->rx_rings_count; i++) { @@ -1490,11 +1448,11 @@ aq_add_stats_sysctls(struct aq_dev *softc) SYSCTL_ADD_COUNTER_U64(ctx, queue_list, OID_AUTO, "irq", CTLFLAG_RD, &(ring->stats.irq), "RX interrupts"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rx_head", - CTLTYPE_UINT | CTLFLAG_RD, ring, 0, - aq_sysctl_print_rx_head, "IU", "ring head pointer"); + CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_RX_HEAD, + aq_sysctl_print_ring_ptr, "IU", "ring head pointer"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rx_tail", - CTLTYPE_UINT | CTLFLAG_RD, ring, 0, - aq_sysctl_print_rx_tail, "IU", " ring tail pointer"); + CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_RX_TAIL, + aq_sysctl_print_ring_ptr, "IU", "ring tail pointer"); } stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac",home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6fce6a.425f9.54d210b4>
