From nobody Thu Dec 28 13:57:18 2023 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 4T19725rXGz55sq0; Thu, 28 Dec 2023 13:57:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T197242V8z4X5D; Thu, 28 Dec 2023 13:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703771838; 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=7owzBmxozOo1ahLeYIlu7Nq+1VqNbKgi77F6hpnqXc0=; b=LY7xvXa00WOEA2JYsbjjpOIhfn75xfQSgBHl/w1dHWAyoqJfnHmSyvgtlCZky6fYO2WKDN P+IF92Ei8w6AMD/pVarQp9K5+WB1izHg8IkElmEGi4DtY04DBx/4sXGjqjGlH0hmhAI340 9pzEhnyccJIbczT5v3YHvvkX0FMPZFQX94HQqByOpba7sgBS2dqyEvSm+bDRA6guP0jhRY NnigH/uPDlRjqVrrm5QGSAufSG9+fNdG3IzYgHMAvGbUhQNGDOWDaFYNxec7OY2julLIrg 0AUmGkqMe0qiLK6iubXGJhpw6JOeA9HZ+EaE96gSYxfdKs0SRZiDFylqy3EOGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703771838; a=rsa-sha256; cv=none; b=TrVA+3Vu5u3VLmI7ADubDswQfSUgcU0Noc80le1T4nYGtwACOQqesvCXt8qG+bpraBmhO3 cyomM7+K6J7Fb9eEBfxYxJPhLVtF8ttBkQjXB4JOt+Bzz0rHrzVrBTVk+tDUnaf2Qc3pau aWfNweB18ssAPjC4137hWmD5BcM2lXczXzZkBEXAHL+d63EpOfxDXaoJRBCUxAib6px0Gr 5f9Ms0gwYUkR9gAu49nYch9CwbqkmSogwfOe7ayvoLeR1BhsLzdSNA3Sezf2a/Y/Y2XDsH ye7nW6MjAhU2X0BJpE+7U8RJum/f1d/qSt+/lZjnuMLMfY4NxKUxBvhWl2XDAg== 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=1703771838; 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=7owzBmxozOo1ahLeYIlu7Nq+1VqNbKgi77F6hpnqXc0=; b=E2+1R25LjhEETbc1jNXceYr/WS+X+LiNWhoUfXuKn8UvPEGbRmsWpJXGUfdBLRAwjy50y2 Mq/07SVMxdvRtVOIgeYppLLKQ4ojJKDCB/Sd4Bhbm6f7FyYiwRBUT056+ZsPMSmCWBlpex /uiAChk1jtS9DHKQdQwZ2LA9Vs4uPqlAYkoFUoESri0Lx1W+l4q/sK0jglIoIuh+Rv8Hgz r1BAKe6Vb40sFWcYFfTSInpBl0JdG2kLqqNrYijsBZenfMkFjTB3IZdhQsc/cTjRv/x1WI 0IqGNQ8SIMfkXTMlom9hAJtQqbJOQJMe9sqyhRHpOSzTVep03DZ0djFUnZGzLQ== 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 4T19722w55z9yw; Thu, 28 Dec 2023 13:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSDvI1D036182; Thu, 28 Dec 2023 13:57:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSDvIVk036179; Thu, 28 Dec 2023 13:57:18 GMT (envelope-from git) Date: Thu, 28 Dec 2023 13:57:18 GMT Message-Id: <202312281357.3BSDvIVk036179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Arthur Kiyanovski Subject: git: 5b925280d9a5 - main - ena: Introduce shared sample interval for all stats 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: akiyano X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b925280d9a54eaefd85827bf6e84049aea8fa98 Auto-Submitted: auto-generated The branch main has been updated by akiyano: URL: https://cgit.FreeBSD.org/src/commit/?id=5b925280d9a54eaefd85827bf6e84049aea8fa98 commit 5b925280d9a54eaefd85827bf6e84049aea8fa98 Author: Osama Abboud AuthorDate: 2023-09-12 10:13:48 +0000 Commit: Arthur Kiyanovski CommitDate: 2023-12-28 13:56:18 +0000 ena: Introduce shared sample interval for all stats Rename sample_interval node to stats_sample_interval and move it up in the sysctl tree to make it clear that it's relevant for all the stats and not only ENI metrics (Currently, sample interval node is found under eni_metrics node). Path to node: dev.ena..stats_sample_interval Once this parameter is set it will set the sample interval for all the stats node including SRD/customer metrics. Approved by: cperciva (mentor) MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 12 ++++++------ sys/dev/ena/ena.h | 4 ++-- sys/dev/ena/ena_sysctl.c | 42 +++++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index aca2e0b43041..f6357a43ea34 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -3321,19 +3321,19 @@ ena_timer_service(void *data) check_for_empty_rx_ring(adapter); /* - * User controller update of the ENI metrics. + * User controller update of the ENA metrics. * If the delay was set to 0, then the stats shouldn't be updated at * all. - * Otherwise, wait 'eni_metrics_sample_interval' seconds, before + * Otherwise, wait 'metrics_sample_interval' seconds, before * updating stats. * As timer service is executed every second, it's enough to increment * appropriate counter each time the timer service is executed. */ - if ((adapter->eni_metrics_sample_interval != 0) && - (++adapter->eni_metrics_sample_interval_cnt >= - adapter->eni_metrics_sample_interval)) { + if ((adapter->metrics_sample_interval != 0) && + (++adapter->metrics_sample_interval_cnt >= + adapter->metrics_sample_interval)) { taskqueue_enqueue(adapter->metrics_tq, &adapter->metrics_task); - adapter->eni_metrics_sample_interval_cnt = 0; + adapter->metrics_sample_interval_cnt = 0; } diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 3687e9b2522e..fd0c6e3692c7 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -480,8 +480,8 @@ struct ena_adapter { uint32_t missing_tx_threshold; bool disable_meta_caching; - uint16_t eni_metrics_sample_interval; - uint16_t eni_metrics_sample_interval_cnt; + uint16_t metrics_sample_interval; + uint16_t metrics_sample_interval_cnt; /* Statistics */ struct ena_stats_dev dev_stats; diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index f3b59d047bff..572bccadca8c 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -48,14 +48,14 @@ static int ena_sysctl_rx_queue_size(SYSCTL_HANDLER_ARGS); static int ena_sysctl_io_queues_nb(SYSCTL_HANDLER_ARGS); static int ena_sysctl_irq_base_cpu(SYSCTL_HANDLER_ARGS); static int ena_sysctl_irq_cpu_stride(SYSCTL_HANDLER_ARGS); -static int ena_sysctl_eni_metrics_interval(SYSCTL_HANDLER_ARGS); +static int ena_sysctl_metrics_interval(SYSCTL_HANDLER_ARGS); #ifndef RSS static int ena_sysctl_rss_key(SYSCTL_HANDLER_ARGS); static int ena_sysctl_rss_indir_table(SYSCTL_HANDLER_ARGS); #endif -/* Limit max ENI sample rate to be an hour. */ -#define ENI_METRICS_MAX_SAMPLE_INTERVAL 3600 +/* Limit max ENA sample rate to be an hour. */ +#define ENA_METRICS_MAX_SAMPLE_INTERVAL 3600 #define ENA_HASH_KEY_MSG_SIZE (ENA_HASH_KEY_SIZE * 2 + 1) static SYSCTL_NODE(_hw, OID_AUTO, ena, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -368,16 +368,6 @@ ena_sysctl_add_eni_metrics(struct ena_adapter *adapter) SYSCTL_ADD_U64(ctx, eni_list, OID_AUTO, "linklocal_allowance_exceeded", CTLFLAG_RD, &eni_metrics->linklocal_allowance_exceeded, 0, "Linklocal packet rate allowance exceeded"); - - /* - * Tuneable, which determines how often ENI metrics will be read. - * 0 means it's turned off. Maximum allowed value is limited by: - * ENI_METRICS_MAX_SAMPLE_INTERVAL. - */ - SYSCTL_ADD_PROC(ctx, eni_list, OID_AUTO, "sample_interval", - CTLTYPE_U16 | CTLFLAG_RW | CTLFLAG_MPSAFE, adapter, 0, - ena_sysctl_eni_metrics_interval, "SU", - "Interval in seconds for updating ENI emetrics. 0 turns off the update."); } static void @@ -411,6 +401,16 @@ ena_sysctl_add_tuneables(struct ena_adapter *adapter) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "io_queues_nb", CTLTYPE_U32 | CTLFLAG_RW | CTLFLAG_MPSAFE, adapter, 0, ena_sysctl_io_queues_nb, "I", "Number of IO queues."); + + /* + * Tuneable, which determines how often ENA metrics will be read. + * 0 means it's turned off. Maximum allowed value is limited by: + * ENA_METRICS_MAX_SAMPLE_INTERVAL. + */ + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "stats_sample_interval", + CTLTYPE_U16 | CTLFLAG_RW | CTLFLAG_MPSAFE, adapter, 0, + ena_sysctl_metrics_interval, "SU", + "Interval in seconds for updating Netword interface metrics. 0 turns off the update."); } /* Kernel option RSS prevents manipulation of key hash and indirection table. */ @@ -694,7 +694,7 @@ unlock: } static int -ena_sysctl_eni_metrics_interval(SYSCTL_HANDLER_ARGS) +ena_sysctl_metrics_interval(SYSCTL_HANDLER_ARGS) { struct ena_adapter *adapter = arg1; uint16_t interval; @@ -708,32 +708,32 @@ ena_sysctl_eni_metrics_interval(SYSCTL_HANDLER_ARGS) error = sysctl_wire_old_buffer(req, sizeof(interval)); if (error == 0) { - interval = adapter->eni_metrics_sample_interval; + interval = adapter->metrics_sample_interval; error = sysctl_handle_16(oidp, &interval, 0, req); } if (error != 0 || req->newptr == NULL) goto unlock; - if (interval > ENI_METRICS_MAX_SAMPLE_INTERVAL) { + if (interval > ENA_METRICS_MAX_SAMPLE_INTERVAL) { ena_log(adapter->pdev, ERR, - "ENI metrics update interval is out of range - maximum allowed value: %d seconds\n", - ENI_METRICS_MAX_SAMPLE_INTERVAL); + "ENA metrics update interval is out of range - maximum allowed value: %d seconds\n", + ENA_METRICS_MAX_SAMPLE_INTERVAL); error = EINVAL; goto unlock; } if (interval == 0) { ena_log(adapter->pdev, INFO, - "ENI metrics update is now turned off\n"); + "ENA metrics update is now turned off\n"); bzero(&adapter->eni_metrics, sizeof(adapter->eni_metrics)); } else { ena_log(adapter->pdev, INFO, - "ENI metrics update interval is set to: %" PRIu16 + "ENA metrics update interval is set to: %" PRIu16 " seconds\n", interval); } - adapter->eni_metrics_sample_interval = interval; + adapter->metrics_sample_interval = interval; unlock: ENA_LOCK_UNLOCK();