From nobody Tue Oct 15 17:43:07 2024 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 4XShJr2Nqnz5Ylyk; Tue, 15 Oct 2024 17:43:08 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XShJq4Gshz4Z7Z; Tue, 15 Oct 2024 17:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+XvrOdqqdnbVCCJlHdfz0DjP2EFdEJw6mffb2zoSz5w=; b=rTxzDdg4llqezcFXdRDX2g9w4LIlyQxSqXGe3YCaie9g9YcoIiZipzoCRJdBHAKVP4kSp3 y/6vHldHTUYZHpe2BXG/RpQBoGRZihO51GlErZKg0g+78PTpCTl1WeVI4ajw4Wr0B5pkMn O+VkVJv+vPi3m6jbioB0zTOzv7EtUpGh9hmyFAatdWURo9L6UweDdR+Ld23seAH+m6cLqt BfSAVI/T826F/vDWMXc2J7ObKJ0yTc7BO2mE6DPO3PzHNwfoojhAoAtmeby6LE9cS9W/Zt uQjUi7rO9+T/wDtPsX1KuGNIQL59nlvjl05XWQ0UcbxbDFUF+e4FwvOGt8ytHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+XvrOdqqdnbVCCJlHdfz0DjP2EFdEJw6mffb2zoSz5w=; b=uq7KPPtul9WJx55/D6a0PYYPOCTMIcFHQ2M8orpTw2ZGBIChsGE5TmP3L5xr6OgLrl0zAy Vd2n79UEs3LXH7mCxkg+w8Vz/S/K59TBnKrhRiykuE3wTRpjRt/OtXKDkJRHzIZKOiKDrS 6vl3+Qi0hBMHs5Ukgz5INfst8D+/ep7iMz6QAsJFG1nZwwGHDu4QCypftGEh1BcaxGF6vo cPGZoVp9WAVnb5lqBXSFsiaFi/Vo3CbzqPN5Fyq+i5SmS8K4hXWaRu5OXOmKxGEd0y8mIt jV+FOYfKkUbCSLziX7ZhV4AqhHZ8cBCnh9xl7cyISOcFLnGa+GA8sznUxG/MCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729014187; a=rsa-sha256; cv=none; b=VJDgsocZETUbR3bIkK3nwFq+JjRRCcJaw/wCYR908eGfQsxMQBR+crDZM6/rzVEF6DuF3a u9L6iEPITgujOWUl4Gxe2KB7G2855/kGImUKszmd3dr0VJavcIzDTrxsUbhSDLVlsm4d97 bmBmIvm7rQddy6TnxzBnlRaYQjyFhgi2bmo0rcMChdsuWkvBzQr5lCAT65wYwHK5+PgVqd mbH8paGb+D5zh9tXFldHsQ6LAaLrsskfxm+Qzo7tXTAoavVBxrSWeZZ/zO3IV4Y7r85KHf B3mNJTuEyoTGFBSsupfBqEVyueeXAZ8JUJCgKCceUD/mehlNwCLy8pRMdbCkAw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XShJq3vFRzX9S; Tue, 15 Oct 2024 17:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FHh7QC062138; Tue, 15 Oct 2024 17:43:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHh7QV062135; Tue, 15 Oct 2024 17:43:07 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:43:07 GMT Message-Id: <202410151743.49FHh7QV062135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Osama Abboud Subject: git: 4af71159db3c - main - ena: Add reset reason for corrupted RX cdescs 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: osamaabb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4af71159db3cd4a37055b2b3d982ec53703c5c3d Auto-Submitted: auto-generated The branch main has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=4af71159db3cd4a37055b2b3d982ec53703c5c3d commit 4af71159db3cd4a37055b2b3d982ec53703c5c3d Author: Osama Abboud AuthorDate: 2024-08-07 06:24:19 +0000 Commit: Osama Abboud CommitDate: 2024-10-15 17:38:31 +0000 ena: Add reset reason for corrupted RX cdescs RX completion descriptors may sometimes contain errors due to corruption. Upon identifying such a case, the driver will trigger a reset with an explicit reset reason ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED. Approved by: cperciva (mentor) MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.h | 2 ++ sys/dev/ena/ena_datapath.c | 2 ++ sys/dev/ena/ena_netmap.c | 2 ++ sys/dev/ena/ena_sysctl.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 22c42a9346f7..b747736224d8 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -390,6 +390,7 @@ struct ena_stats_dev { counter_u64_t invalid_state; counter_u64_t missing_intr; counter_u64_t tx_desc_malformed; + counter_u64_t rx_desc_malformed; }; struct ena_hw_stats { @@ -550,6 +551,7 @@ static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_R ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_DRIVER_INVALID_STATE, invalid_state), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISS_INTERRUPT, missing_intr), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED, tx_desc_malformed), + ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED, rx_desc_malformed), }; int ena_up(struct ena_adapter *adapter); diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index c63a8914f9c2..6cbe46cead3e 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -599,6 +599,8 @@ ena_rx_cleanup(struct ena_ring *rx_ring) counter_u64_add(rx_ring->rx_stats.bad_desc_num, 1); reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; + } else if (rc == ENA_COM_FAULT) { + reset_reason = ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED; } else { counter_u64_add(rx_ring->rx_stats.bad_req_id, 1); diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c index 618d25a07f67..0666d7deb827 100644 --- a/sys/dev/ena/ena_netmap.c +++ b/sys/dev/ena/ena_netmap.c @@ -938,6 +938,8 @@ ena_netmap_rx_frame(struct ena_netmap_ctx *ctx) if (rc == ENA_COM_NO_SPACE) { counter_u64_add(ctx->ring->rx_stats.bad_desc_num, 1); reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; + } else if (rc == ENA_COM_FAULT) { + reset_reason = ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED; } else { counter_u64_add(ctx->ring->rx_stats.bad_req_id, 1); reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index f6f9f68e6334..79c167221a0f 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -296,6 +296,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter) &dev_stats->missing_intr, "Missing interrupt count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "tx_desc_malformed", CTLFLAG_RD, &dev_stats->tx_desc_malformed, "TX descriptors malformed count"); + SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "rx_desc_malformed", CTLFLAG_RD, + &dev_stats->rx_desc_malformed, "RX descriptors malformed count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "total_resets", CTLFLAG_RD, &dev_stats->total_resets, "Total resets count");