From nobody Tue Oct 15 17:43:18 2024 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 4XShK33sHwz5YlYj; Tue, 15 Oct 2024 17:43:19 +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 4XShK30DdJz4ZSf; Tue, 15 Oct 2024 17:43:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014199; 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=jz2yvjnLH6er26D0OoP/tYL3s53OMufdYSYtLWlNsXM=; b=vc1tdnIgaOCQJeNCw2uoS/qSzs1/VvjstNYozS4MkPgoqJvhQYFBJzoEEiTTmwLKbXeM6j oScUV/+wYBZo2QbweY7EPfkQ7Zbzv72JMxkDDt36LA17+ccpYpItZjvFhD4Cz8K3bZg2Nt DTzZ10B9bCoFCcMb2pRctG1CdpkEkYYAsZdEbUrTa5r98uE0lWGpbrL00oOcWEb3MR1WTv z6YeTGZDEeXhxodfbEWPtw10xUSae/AvDHr9Yzw/IPpkbTNKnCXYSBTwHxRVwk8TQ64z22 1+jLoLP0OYesUzJCItoSXztb7/ro9/ggKOlQEnkLR9tOvLY6CjNHBxcNcwYUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014199; 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=jz2yvjnLH6er26D0OoP/tYL3s53OMufdYSYtLWlNsXM=; b=JllEr3xODGmTwflMMx3q3WtHJAZ6xaixINFg1swcz40Bbr2KoGf2a4/zw+orzvMx+039mJ rwrmNZ/KlqSbGP9qaBPZ9qK3jsktXCoUNg64P2OzIPmGNtzOTxjs/u0VE7pI7xoU/bIUO/ POPsT9eQi5FxVtHo1kt3xddp61jxScrY23NULGPNHYLzkF4UyfYZItFYenQPruDndbzRUZ rC8m0iVoSzVKvbHEhfeXSkCuAIscV35WtD3bFw4A83xTiyAasfYP0J4BIQGFDP2ZC+0nE2 VfeJlN7LneB1Cf1yyCcARYvEuekks66QXI92+c/7iQuwd4iScyOXoL8933xDmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729014199; a=rsa-sha256; cv=none; b=I2mQ+w2QkA+l0u9aoT2NXZ8r4PsCC9Zq0jFjVxH5RxeosBe4p47mG/3lf+qZ5zyfOtP3fR Wds5sCxNgpFLT9hOivf0znlUDz68VykpPG+pi8kX+h/BncjCj+F7Q4hmFRrnEyFPT5X9Es 3v4vQXRqzaftVc3so9pjyKKIOVxclbkJS7HgDfMtrOhKkhsKqr4rJN9qO77id7drJnU3K7 AOnnIqqRr09vGiUG7wQf6PyDf0SAAUI5v/vk6FBxRmx/8xOTj84oU4j4cqxkBoquM+QGEm kErrSfinNXxgypf4YROzUGvSj6jpn69DW3u682mdPSKxMwbQEiEWInElGL8kTQ== 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 4XShK26yk0zXM1; Tue, 15 Oct 2024 17:43:18 +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 49FHhIhq062665; Tue, 15 Oct 2024 17:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHhIId062662; Tue, 15 Oct 2024 17:43:18 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:43:18 GMT Message-Id: <202410151743.49FHhIId062662@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: 705879424bc7 - main - ena: Add support for device request reset message over AENQ 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 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: 705879424bc76fcc925e78eb7643dbf4bd9a11eb Auto-Submitted: auto-generated The branch main has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=705879424bc76fcc925e78eb7643dbf4bd9a11eb commit 705879424bc76fcc925e78eb7643dbf4bd9a11eb Author: Osama Abboud AuthorDate: 2024-08-07 06:24:21 +0000 Commit: Osama Abboud CommitDate: 2024-10-15 17:38:32 +0000 ena: Add support for device request reset message over AENQ This commit adds a handler for the new aenq message ENA_ADMIN_DEVICE_REQUEST_RESET, which in turn causes the driver to trigger reset of a new type: ENA_REGS_RESET_DEVICE_REQUEST. Also adds counting of such occurrences in a new statistic for it. Approved by: cperciva (mentor) MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 13 ++++++++++++- sys/dev/ena/ena.h | 2 ++ sys/dev/ena/ena_sysctl.c | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index bfde950cb2b1..2c96f8def20a 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -2990,7 +2990,8 @@ ena_device_init(struct ena_adapter *adapter, device_t pdev, BIT(ENA_ADMIN_WARNING) | BIT(ENA_ADMIN_NOTIFICATION) | BIT(ENA_ADMIN_KEEP_ALIVE) | - BIT(ENA_ADMIN_CONF_NOTIFICATIONS); + BIT(ENA_ADMIN_CONF_NOTIFICATIONS) | + BIT(ENA_ADMIN_DEVICE_REQUEST_RESET); aenq_groups &= get_feat_ctx->aenq.supported_groups; rc = ena_com_set_aenq_config(ena_dev, aenq_groups); @@ -4195,12 +4196,22 @@ static void ena_conf_notification(void *adapter_data, } } +static void ena_admin_device_request_reset(void *adapter_data, + struct ena_admin_aenq_entry *aenq_e) +{ + struct ena_adapter *adapter = (struct ena_adapter *)adapter_data; + ena_log(adapter->pdev, WARN, + "The device has detected an unhealthy state, reset is requested\n"); + ena_trigger_reset(adapter, ENA_REGS_RESET_DEVICE_REQUEST); +} + static struct ena_aenq_handlers aenq_handlers = { .handlers = { [ENA_ADMIN_LINK_CHANGE] = ena_update_on_link_change, [ENA_ADMIN_NOTIFICATION] = ena_notification, [ENA_ADMIN_KEEP_ALIVE] = ena_keep_alive_wd, [ENA_ADMIN_CONF_NOTIFICATIONS] = ena_conf_notification, + [ENA_ADMIN_DEVICE_REQUEST_RESET] = ena_admin_device_request_reset, }, .unimplemented_handler = unimplemented_aenq_handler }; diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index c9eb9e8c43d3..7ec470638859 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -396,6 +396,7 @@ struct ena_stats_dev { counter_u64_t rx_desc_malformed; counter_u64_t missing_admin_interrupt; counter_u64_t admin_to; + counter_u64_t device_request_reset; }; struct ena_hw_stats { @@ -558,6 +559,7 @@ static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_R 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), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT, missing_admin_interrupt), + ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_DEVICE_REQUEST, device_request_reset), }; int ena_up(struct ena_adapter *adapter); diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index 32fde58c610c..9c3c47186b4e 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -301,6 +301,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter) &dev_stats->missing_admin_interrupt, "Missing admin interrupts count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "admin_to", CTLFLAG_RD, &dev_stats->admin_to, "Admin queue timeouts count"); + SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "device_request_reset", CTLFLAG_RD, + &dev_stats->device_request_reset, "Device reset requests count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "total_resets", CTLFLAG_RD, &dev_stats->total_resets, "Total resets count");