From nobody Thu Oct 31 16:01:39 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 4XfTJM5dDlz5bwmw; Thu, 31 Oct 2024 16:01:39 +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 4XfTJM3nHrz4THD; Thu, 31 Oct 2024 16:01:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390499; 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=1fPd/P8HcCLeb2jWf7gKHE3gxcstvBj4cW033l3T3bk=; b=DoeUgFnOEN4FYujfaB8lKHiGL819SSdSxeyXCWSSEiFtxWM722IjutGBtHg4+8m744b62C P/ieLMNleLG7AH9cPROsZ2Lm/rEUca+Ab8ism+lSqUpU4smjqnpPOIDiiPKpJu5BzAy9fJ Rg/jQ3pMReWicdMYUKRU8loubriuQnjPe3aVnvK2vlSIt+QeY+KizZV+S7YwLucLI/NSu3 c9yhycVLXDIIcLDV/71I++Qu60K4nXuQ5fC/vopkvUm45y+KNLGpEwcUA/RtQQgd0rL2OW JsvKHMjyGliKErIQisl1p2zsNdmJdRBUUVOGnBY38m/zcCzqWQ6W+udMs5FP7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390499; 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=1fPd/P8HcCLeb2jWf7gKHE3gxcstvBj4cW033l3T3bk=; b=ed3KnEB/U2w6HjGA2n0DcIEo5bZfqpYjTG4s+LgTWk/qFHTWAW5v3bZJWuHuDDMW4gNO/q su4b0V+JFev9yf/YLsnyg1XF6tvpWfyFj37MnDZ6FrRuh+Hmt+vvaqyui1nOTfHhKQBA9I Y3/+kH3jqKIkWJVLVv+7cgbZdynBx+bkhhSEU9hyw1nikq9BJuOZJ5ECeRGXTEvthV+a0U 0bE+uutW41fwzUxJ3RXr191btn0vDI2/5176Me6mVjgCp67VwbktRQNGjq5NURh7O8lTpb R5ntDphQi5rm6JEQ4ZCVqlJKztFcmeV4Ty4I7YDFNI1o4Nbqu8EeuLFJ6N/stg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730390499; a=rsa-sha256; cv=none; b=qS8aYjOvVYWJImVT9lryUIScIDgxgVXGpDDDQgocfdXcWm7Y+ZRcm8iNLRv1fQPwFKwY0H xQ30bjv5X6ge1GmQZI80fVdSXv9L4Ipp8noaYangB98L0K4BRBeMcLBDmOddt2p17RXArU +CEXNEacx75bR7nOCPawZpDopJwrUu8oos4SLZO6L8qNhoHx5MvVk8ANObUJn5h7WMSqcJ CSbxviGnYWPwAU969xEK81pB6IPh8jqD8kgWbGk2PikGLgFJLhL2gWX4PNuFUrdUNFBIKv oGA5nyJ7AwRfB0HIB6JQaP/i436noc6Oy5dk6g/WfUf275g7Wh6/nUmVz2L8Hg== 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 4XfTJM2crJzjh1; Thu, 31 Oct 2024 16:01:39 +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 49VG1dYt073312; Thu, 31 Oct 2024 16:01:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VG1dkr073309; Thu, 31 Oct 2024 16:01:39 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:01:39 GMT Message-Id: <202410311601.49VG1dkr073309@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: ebb857f4ce31 - stable/14 - ena: Add support for device request reset message over AENQ 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/stable/14 X-Git-Reftype: branch X-Git-Commit: ebb857f4ce31065ade247919ee7e4e71706bad08 Auto-Submitted: auto-generated The branch stable/14 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=ebb857f4ce31065ade247919ee7e4e71706bad08 commit ebb857f4ce31065ade247919ee7e4e71706bad08 Author: Osama Abboud AuthorDate: 2024-08-07 06:24:21 +0000 Commit: Osama Abboud CommitDate: 2024-10-31 14:54:11 +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 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 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");