From nobody Thu Oct 31 16:00:13 2024 X-Original-To: dev-commits-src-branches@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 4XfTGk01DYz5bwnd; Thu, 31 Oct 2024 16:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfTGj2Cdqz4PP2; Thu, 31 Oct 2024 16:00:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390413; 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=3M8EvPs5Ms/2aajTn+mHbROAqtSvOqhwxkDUoRFbcgA=; b=XVQ671szo7N3TGsouT+4owx9CTsMbx9sqdc3Ij8TlWplUWp5NhDxMSpp/36POEX1LaWOXP GvjHnEb4PwJH7CHAlt9IBGRlmoC4cpvOefwJmVnsuQ+nCGCvtJ1kiPxkX7E8v0nLmG/7cU RWZVFrXHBQ1anHmCAXOjlk++x8CORMrW+E6TKiLqOhE1o0Z36/EujEm4KSE1y3pUUCPduu twmnDm9zqo16h17AtZB6EZDVMAxnkh6UOP3UimQy097SSNb7gDVaSbpvFJgdY4fTjiks/+ SpmUpLcq+TDHlWs1lmNTvd/hRWm1XIkpV3ZJehCdmVrlQdGbWaui4EZyWuDr4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390413; 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=3M8EvPs5Ms/2aajTn+mHbROAqtSvOqhwxkDUoRFbcgA=; b=hSTVD8AzZnhDVZH31JadA1eOyhq7TsV6crGGn+QodL96tL1VQPVwyuMd5zREDPGF/GBgfw 8SitXzQl3NpgdI2FEYoipHAPmg8WPv+3AnDcRcpPBiQdTCGWHFjYrVhSSpfC70X1wK0b2G kbI0E1alxGrLNberNSvv8BXJwArfoOf3zbXE4BlXTu1DfBRqGQw6rd1nrPhdJRW1Jqt7ar WNGQyfc6tR7TAGnwdrDz/qurmsaOJE+JgIrRsut+/KzbAHf7DLR7yFAeB5/MfYIdiFYvPA Qtoa1HNml15FwGStjjPQfSXzB/o1piX49lmk3b1wEzlUSOwK1D9koZpeOndhPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730390413; a=rsa-sha256; cv=none; b=iwuASxpKrCBUj3ohC+ZpINwKVGLdMq/OmqfmXsFwqfqrArCBJFJqx6eFIkirgDmab3h1jN SQtTC8kQMfwHQwR+2u9PYzwwXWn4QlAYzYy7pl7WVU4KTIuRTfzTecuCWf7gm8pzyGqR+v KQJ5RGieCKUYNf56zyqZZ8w+CSAAQZkKyBJHkGzU6e7NdpBoz5fE9EEK0JCgjrZSFvbXDQ m0gDH2H1tb1U8iRes/BVCclMno3i7pVSnvOcXiQDLFUTASjRM8RissQaubPFET1oqkokN5 l1KsoYVDg+4c+G0Zdy6dzp4Ymiurkk3i6vI8p/0UlSdC0wOijRWoVH+0t59OQw== 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 4XfTGj1qVLzhdY; Thu, 31 Oct 2024 16:00:13 +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 49VG0DcN064203; Thu, 31 Oct 2024 16:00:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VG0DUL064194; Thu, 31 Oct 2024 16:00:13 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:00:13 GMT Message-Id: <202410311600.49VG0DUL064194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Osama Abboud Subject: git: d5141ea592ea - stable/13 - ena: Add support for device request reset message over AENQ List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: d5141ea592eaf1f7fbc24420fb9a6b32fe4b9c7d Auto-Submitted: auto-generated The branch stable/13 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=d5141ea592eaf1f7fbc24420fb9a6b32fe4b9c7d commit d5141ea592eaf1f7fbc24420fb9a6b32fe4b9c7d Author: Osama Abboud AuthorDate: 2024-08-07 06:24:21 +0000 Commit: Osama Abboud CommitDate: 2024-10-31 14:55:20 +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) Sponsored by: Amazon, Inc. (cherry picked from commit 705879424bc76fcc925e78eb7643dbf4bd9a11eb) --- 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 b09deb162a12..951fc6719aa3 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -2991,7 +2991,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); @@ -4196,12 +4197,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 e18328ddc8b2..ce6e0b7375e6 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");