From nobody Mon Aug 31 18:05:13 2026 X-Original-To: dev-commits-src-all@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 4hYcNB0HCLz6r8xk for ; Mon, 31 Aug 2026 18:05:14 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hYcN93sh7z3SRy for ; Mon, 31 Aug 2026 18:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788199513; 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=MJhWHcAdpG+CuJyLgrYB14OlQAApQMXMyqxcpgiUzzU=; b=fcupR6A1g4P5Bu8pRrU9v6dorOEX4PuY+uNJ/kdGOCJzd7NdSfQSFPAcIL+hZ0C/B7VWIl 0l7ESK5aPE02pwgfxQPw9qZl2Vq/Hb6Ynu/HeGJjcMDDYJ5mnTPIsprWU/XGh9IIpRkjDs kXWUxJFAKNe1Nq67gWA/VeOCNZIn15gG2dm+J4YBs57Lxxv4pzgXrIuiZb62tivUN6lDIR A1FT1fLA2gIWuOYCh2cG/0JXec17KN6nOtMO9OrUxs10uSmuw5kep7G7yEiMUoYVVrm0cg TEzslWfIUFCil8UDJG7H8NpeOseE/TYMiVqe0F6NnyZ89LA7JxMEbGixMEcMLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788199513; a=rsa-sha256; cv=none; b=VtYznCkuqhU8s1EpqPybgijmSt7M/KhUNsCQFQPjgct7lh7kjqtpdJoHIovoPk/zjrXxn3 E/zch8zWtCgyitMFtD61jIzHFNvrovS/3WOJN6Od+Kux8qSW8hM+/qU3NdKrLm/5bqTdAK ed0QnyoieGLSzotzulHVaO7vF043VaY1XXcYFD1I6t7bw4o1p+XWxlLeRkMHkqofmPSxMS NdAIDkEZAk7BJrGLWKK5o/RygG4Se0I9YHnw4TQKruOUP/Q8Gke76Qt6L/CD3Lfvnnqph2 w/EKHJFdNvcVeVdcE4HW6HxbzFaT0sZyi5AzrFates8sEpSEhKhNwfqk/pA82w== 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=1788199513; 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=MJhWHcAdpG+CuJyLgrYB14OlQAApQMXMyqxcpgiUzzU=; b=UDMuEU4cAFWUjLnBF1G5zgH4KKmM2lm6YAQLsu5OwZQHa0osIH9oe/IZsyBKiPXB+jD4SK /GaIC56YwspsYurkQY25nGBiq22R+6L0hUt6XIGqyuYOjsQKhJhJu01Rn24pXjX2Ju95c/ uUyJuOhTJxidwn+qsDia0UBzu1FkJ84M25d0Nkps5boMgUujze1uwRJulURduZtWuJXhw7 ItJtVX+RBr/DUZIHpQVX1KHW2NPwqsn8ikvoeDiDcP0X1BGLAI81cudyy0eb/JuSPENEH0 /0qN1xClVtDJw6mtomzT3gSMDLGddyvdP34+Q836jEUCvsrhSApZd3o9KiJ5aw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hYcN92RKwz6tF for ; Mon, 31 Aug 2026 18:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c696 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 31 Aug 2026 18:05:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Nick Price From: Ed Maste Subject: git: 7d9bb766b5f6 - stable/15 - aq(4): correct Atlantic 2 register access List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 7d9bb766b5f6be9914be08bca520010cf272ed86 Auto-Submitted: auto-generated Date: Mon, 31 Aug 2026 18:05:13 +0000 Message-Id: <6a95c259.3c696.10cdd478@gitrepo.freebsd.org> The branch stable/15 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9bb766b5f6be9914be08bca520010cf272ed86 commit 7d9bb766b5f6be9914be08bca520010cf272ed86 Author: Nick Price AuthorDate: 2026-07-19 16:48:23 +0000 Commit: Ed Maste CommitDate: 2026-08-31 17:37:00 +0000 aq(4): correct Atlantic 2 register access Four Atlantic 2 register-access corrections found in bring-up. B0 aggregate octet counters: the B0 firmware statistics interface reports only aggregate rx/tx good octets, not the per-cast breakdown A0 and Atlantic 1 provide, so every octet sysctl read a permanent zero while frame counters advanced. Populate the aggregate octet fields from the B0 buffer; aq_update_hw_stats() accumulates them directly when the per-cast octets are absent. Drop the duplicate attach-time MCP reboot: aq_hw_mpi_create() already reboots the A2 firmware to read its version and caps, then aq_hw_reset() immediately rebooted it again -- a full MCP restart plus several transaction-id-bracketed window reads, adding attach latency and a duplicate banner. Give aq_hw_reset() a reboot flag and pass reboot=false for A2 at attach; the load-bearing down/stop reboot (which resyncs A2 RX DMA across ifconfig down/up) keeps reboot=true. Skip Atlantic 1 register accesses on Atlantic 2: gate out the 0x7040 Atlantic 1 TPO write (which A2 lacks; already a no-op via the unset TPO2 feature, but Linux hw_atl2 omits it), and guard the aq_hw_mpi_read_stats() direct reads of reg_rx_dma_stat_counter7 (dpc) and the LRO counter (cprc) with !ATLANTIC2 -- those are Atlantic 1 codegen offsets that on Atlantic 2 land on unrelated registers and can report bogus input-drop / LRO counts. HW-validated on AQC107 <-> AQC113C: A1 stats unchanged, A2 IQDROPS stays 0, attach consumes one MCP reboot instead of two, bidirectional iperf3 clean. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58143 (cherry picked from commit c325b4024d61fe20f8140d6891074ca7276c4d58) --- sys/dev/aq/aq2_fw.c | 2 ++ sys/dev/aq/aq_hw.c | 41 ++++++++++++++++++++++++++--------------- sys/dev/aq/aq_hw.h | 2 +- sys/dev/aq/aq_main.c | 4 ++-- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/sys/dev/aq/aq2_fw.c b/sys/dev/aq/aq2_fw.c index 76152a9c07bb..d36b9e841624 100644 --- a/sys/dev/aq/aq2_fw.c +++ b/sys/dev/aq/aq2_fw.c @@ -422,6 +422,8 @@ aq2_fw_get_stats(struct aq_hw *hw, struct aq_hw_stats *stats) stats->ptc = u.a0.tx_good_frames; } else if (hw->aq2_iface == AQ2_FW_INTERFACE_OUT_VERSION_IFACE_VER_B0) { /* B0 reports aggregate octets only; per-cast stays zero. */ + stats->brc = u.b0.rx_good_octets; + stats->btc = u.b0.tx_good_octets; stats->uprc = u.b0.rx_unicast_frames; stats->mprc = u.b0.rx_multicast_frames; stats->bprc = u.b0.rx_broadcast_frames; diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c index 5dbdec172096..ca733ffa7e3d 100644 --- a/sys/dev/aq/aq_hw.c +++ b/sys/dev/aq/aq_hw.c @@ -217,13 +217,17 @@ aq_hw_mpi_read_stats(struct aq_hw *hw, struct aq_hw_stats *stats) int err; err = hw->fw_ops->get_stats(hw, stats); + if (err != 0) + return (err); + + /* No firmware interface reports the RPB drop count; read it directly. */ + stats->dpc = reg_rx_dma_stat_counter7get(hw); - if (err == 0) { - stats->dpc = reg_rx_dma_stat_counter7get(hw); + /* The LRO counter has no A2 counterpart in any reference driver. */ + if (!IS_CHIP_FEATURE(hw, ATLANTIC2)) stats->cprc = stats_rx_lro_coalesced_pkt_count0_get(hw); - } - return (err); + return (0); } static int @@ -364,19 +368,25 @@ aq_hw_set_power(struct aq_hw *hw, unsigned int power_state) /* HW NIC functions */ int -aq_hw_reset(struct aq_hw *hw) +aq_hw_reset(struct aq_hw *hw, bool reboot) { int err = 0; AQ_DBG_ENTER(); - /* A2 resets by rebooting the MCP; A1 uses the RBL/FLB reset. */ - if (IS_CHIP_FEATURE(hw, ATLANTIC2)) - err = aq2_fw_reboot(hw); - else - err = aq_fw_reset(hw); - if (err != 0) - goto err_exit; + /* + * A2 resets by rebooting the MCP; A1 uses the RBL/FLB reset. At attach + * aq_hw_mpi_create() has already done this, so the caller passes + * reboot=false to skip the (costly, on A2) redundant MCP reboot. + */ + if (reboot) { + if (IS_CHIP_FEATURE(hw, ATLANTIC2)) + err = aq2_fw_reboot(hw); + else + err = aq_fw_reset(hw); + if (err != 0) + goto err_exit; + } itr_irq_reg_res_dis_set(hw, 0); itr_res_irq_set(hw, 1); @@ -569,9 +579,10 @@ aq_hw_init_tx_path(struct aq_hw *hw) /* Tx interrupts */ tdm_tx_desc_wr_wb_irq_en_set(hw, 1U); - /* misc */ - AQ_WRITE_REG(hw, 0x00007040U, - IS_CHIP_FEATURE(hw, TPO2) ? 0x00010000U : 0x00000000U); + /* misc (Atlantic 1 TPO register; absent on Atlantic 2) */ + if (!IS_CHIP_FEATURE(hw, ATLANTIC2)) + AQ_WRITE_REG(hw, 0x00007040U, + IS_CHIP_FEATURE(hw, TPO2) ? 0x00010000U : 0x00000000U); tdm_tx_dca_en_set(hw, 0U); tdm_tx_dca_mode_set(hw, 0U); diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h index a19a136ff172..ee824641294f 100644 --- a/sys/dev/aq/aq_hw.h +++ b/sys/dev/aq/aq_hw.h @@ -364,7 +364,7 @@ int aq_hw_set_link_speed(struct aq_hw *hw, uint32_t speed); int aq_hw_fw_downld_dwords(struct aq_hw *hw, uint32_t a, uint32_t *p, uint32_t cnt); -int aq_hw_reset(struct aq_hw *hw); +int aq_hw_reset(struct aq_hw *hw, bool reboot); int aq_hw_mpi_create(struct aq_hw *hw); diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c index b78407a56c67..a8b87daa59d4 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -382,7 +382,7 @@ aq_if_attach_pre(if_ctx_t ctx) if (hw->fast_start_enabled) rc = hw->fw_ops->reset(hw); else - rc = aq_hw_reset(&softc->hw); + rc = aq_hw_reset(&softc->hw, !IS_CHIP_FEATURE(hw, ATLANTIC2)); if (rc != 0) { device_printf(softc->dev, "%s: reset failed, err=%d\n", __func__, rc); @@ -813,7 +813,7 @@ aq_if_stop(if_ctx_t ctx) aq_ring_rx_stop(hw, softc->rx_rings[i]); } - aq_hw_reset(&softc->hw); + aq_hw_reset(&softc->hw, true); memset(&softc->last_stats, 0, sizeof(softc->last_stats)); softc->linkup = false; aq_if_update_admin_status(ctx);