From nobody Thu Oct 31 16:01:41 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 4XfTJQ1Vd9z5bwhB; Thu, 31 Oct 2024 16:01:42 +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 4XfTJP4M6mz4TFn; Thu, 31 Oct 2024 16:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390501; 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=FKzJAP/Quvbb7b4tteumDyPVyVDFJmkMO/DVs86tCFY=; b=QdJP1K7CgRh+uTu9zTTWZN37joDkO4uj9upRl7emj63SpW9vKftCCAtnwFljc7Irjj6zIG TUU5OheNSJRv8NWBtKv4IGb2fpcxMYsOGUclrBatl7S33gMhBZ7Lti3a0fkeIn25TMxwyX NX1jQMJ0YdwEJR7yAh475fZbPrSe7/J2o85jvRyr4dENZJy22pJecMAm58L4OhlWDbcYVb McYDSSCdcXhKE9zlDwwv1LTbmUiSrdbnzhbdymJrHcxQOKKfF0K0oL2Clvv6w+mX8YPN62 Pb4BZMxVTz8Qde/48B+KhZdbBRz3QEZeUz3DPwW2F105vJyTZJ4wRv/kT9XCOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390501; 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=FKzJAP/Quvbb7b4tteumDyPVyVDFJmkMO/DVs86tCFY=; b=n7hhXlqJzqg7/pKCq908mkTQaIW9f0jM2Qf6Ob0OsSafCvMrie4n6zkjIx8hUOv43mrvfp WBTuE3s/iYADIFAHGFZkW45q8aq1o9Usi5BEr1mF5n/GYcM0F5A+lH3jjZDGRqBFWu/oT2 coU8A89n0Na3VUKut6q/eMjKmbYe9KuygUfkiy90PeqWrGQikOgSRueJPwg62zegf6CNhc JSwXNRhdziU0B/ATm80Ga4RjaRee+UNMXrt6DkUToRYJo3WbrwPIjSler0ajEY93ueaMaN xnvdq7En/ctZI/8L2a3WD2TtEAE1hWk0N/LznhTP/ZDsnjHRlSoOpJGAyR2iJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730390501; a=rsa-sha256; cv=none; b=C1bVlZnGV0k7+R4TXERdVaaed7avmbZwwJCcZW6z3mXalSQnW6T/2LoWaRGCMP1EHgcNJj kMLeysazWS7VjuLkW3+0I9MxaaRLUYBW1QI9y/ZH78sS3Qagp+fHohu0yY984RShkjvvUD 5AwcUwwvziIvCwalnmLN2uec5aOYkvgpT2sWchCYtYo4koebpl6j2L+dG+ctjoiCUR1shQ L5Bm+VpotlXOWI5hJxk63W+34Xv24uqGTynRg0DzXavomQ20h9KzjNsO+WmfM4b4eWAiIO srLonGBoSsrAzSvZfezR6QCbB44h90jQDFGiyollL4ua4wT2zWf/IquBYRAW7Q== 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 4XfTJP3xGnzjb1; Thu, 31 Oct 2024 16:01:41 +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 49VG1fAK073427; Thu, 31 Oct 2024 16:01:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VG1f6e073424; Thu, 31 Oct 2024 16:01:41 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:01:41 GMT Message-Id: <202410311601.49VG1f6e073424@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: 86ec26e7a9b8 - stable/14 - ena: Support max large LLQ depth from the device 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: 86ec26e7a9b878397c3b664d66fdfc8ecfdee10d Auto-Submitted: auto-generated The branch stable/14 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=86ec26e7a9b878397c3b664d66fdfc8ecfdee10d commit 86ec26e7a9b878397c3b664d66fdfc8ecfdee10d Author: Osama Abboud AuthorDate: 2024-08-07 06:24:22 +0000 Commit: Osama Abboud CommitDate: 2024-10-31 14:54:11 +0000 ena: Support max large LLQ depth from the device Large LLQ depth size is currently calculated by dividing the maximum possible size of LLQ by 2. In newer paltforms, starting from r8g the size of BAR2, which contains LLQ, will be increased, and the maximum depth of wide LLQ will be set according to a value set by the device, instead of hardcoded division by 2. The new value will be stored by the device in max_wide_llq_depth field for drivers that expose ENA_ADMIN_LLQ_FEATURE_VERSION_1 or higher to the device. There is an assumption that max_llq_depth >= max_wide_llq_depth, since they both use the same bar, and if it is possible to have a wide LLQ of size max_wide_llq_depth, it is possible to have a normal LLQ of the same size, since it will occupy half of the space. Also moved the large LLQ case calculation of max_tx_queue_size before its rounddown. Approved by: cperciva (mentor) Sponsored by: Amazon, Inc. (cherry picked from commit d0419551d96c8f995bdf6388a8e69684be33f9b5) --- sys/dev/ena/ena.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index fadba819652b..28a4d7842306 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -2831,28 +2831,34 @@ ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx, struct ena_adapter * max_queues->max_packet_rx_descs); } - /* round down to the nearest power of 2 */ - max_tx_queue_size = 1 << (flsl(max_tx_queue_size) - 1); - max_rx_queue_size = 1 << (flsl(max_rx_queue_size) - 1); - - /* - * When using large headers, we multiply the entry size by 2, - * and therefore divide the queue size by 2, leaving the amount - * of memory used by the queues unchanged. - */ if (adapter->llq_policy == ENA_ADMIN_LIST_ENTRY_SIZE_256B) { - if (ena_dev->tx_mem_queue_type == - ENA_ADMIN_PLACEMENT_POLICY_DEV) { - max_tx_queue_size /= 2; - ena_log(ctx->pdev, INFO, - "Using large headers and decreasing maximum Tx queue size to %d\n", - max_tx_queue_size); + if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { + if (llq->max_wide_llq_depth != max_tx_queue_size) { + if (llq->max_wide_llq_depth == 0) { + /* if there is no large llq max depth from device, we divide + * the queue size by 2, leaving the amount of memory + * used by the queues unchanged. + */ + max_tx_queue_size /= 2; + } else { + max_tx_queue_size = llq->max_wide_llq_depth; + } + ena_log(ctx->pdev, INFO, + "Using large LLQ headers and decreasing maximum Tx queue size to %d\n", + max_tx_queue_size); + } else { + ena_log(ctx->pdev, INFO, "Using large LLQ headers\n"); + } } else { ena_log(ctx->pdev, WARN, "Using large headers failed: LLQ is disabled or device does not support large headers\n"); } } + /* round down to the nearest power of 2 */ + max_tx_queue_size = 1 << (flsl(max_tx_queue_size) - 1); + max_rx_queue_size = 1 << (flsl(max_rx_queue_size) - 1); + tx_queue_size = clamp_val(tx_queue_size, ENA_MIN_RING_SIZE, max_tx_queue_size); rx_queue_size = clamp_val(rx_queue_size, ENA_MIN_RING_SIZE,