From nobody Thu Oct 31 16:00:09 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 4XfTGf17jZz5bwjX; Thu, 31 Oct 2024 16:00:10 +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 4XfTGd75Ttz4PHb; Thu, 31 Oct 2024 16:00:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390410; 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=yQqLTEzab7Ubn/NBvgm69gll4vFn8v2SIHiSzBe3brQ=; b=RsR/UE0FfktYwk3VqM3kcZ9mKOIiIt9y8/T1z9lZuOcTie+JUvf6xpfqY1TSUSC5BWQEep u8/zgLyDW1b2akVroDRg1sJ7A83RRVL4PCne9xl3AHli1UqlojSCw+SwpWChYhV31D8nXc KfJZpXtrJwRJ/Tx2rDqaOyuiEBt/SkubOjguAmn1rNH9yHwalchJTLD68N0N5WaGgbkV28 8npFnx/V0as6VPrxI/dYJVNCNw6RzW7uTrmyUID6/91GhqYY5JQHnO9t3G9OqL5KVrWDHT pkwjJh0S6mcEgbFLYHcYR/UreQfrICL+A629XXKrqqf1VpqdEVyUzCcl5R0ysA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390410; 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=yQqLTEzab7Ubn/NBvgm69gll4vFn8v2SIHiSzBe3brQ=; b=t0LuMk+6JMkhoMXUDTyVpC8KYvpUTwH+yAI9B+oS7K2zmWAIg1vZztSwksKFitGFv6wv60 Lim1u4sbnzKl4NdN7ymJNZUUr3IME+FK4PkN4zGB+LXwT1rHS93vu5BUQ+FMRZ0UMWkSxx /ACf05hZ0B38eURmw65VR5S2oB2atGzR0wlCtUhk00qoBjCC39wm2OpPwLtM9HcxUKah+X xyLkx4ohGcJT3bGnkLaT6gcKQha4PUEheGj/sZ8nLRpB6x/MSxoAKyid86n7z0gEQ7DEgf w+DqcFsYwa6tEnAv8EWwph6q9NzP3cMEwBTSFEJ0kA9CClDQx3ErFGUPs6CFtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730390410; a=rsa-sha256; cv=none; b=dOZh3hPq58qYR9o2b5ydnclh41oX7Y0e9yhrKgzd/q5K6ASF/tClNHLjxWcvdE2f7rTDNo P9X6r63ojABjXqTeCkbgAP3zofzMbICBmF/d2R5Q4aIPq2FicYldQ180Tb9A/pQdfyidfx FXUJuIHsD9GIT8n2e8BKNV32VxyxoMwoh9UpJUktENlhNGNT+zUt5Kv2mbIa0zG+h5glZd 7EyidyKxVTGzxNGo4xtMowRd7rUpnuDV+t9+k+kD4dE4Won+XBly+fYO7UbtBXrCXqyIlF NDbU3yRcsLDWKP9vwUz+72i1xdH440TMW2d4j3Ko8VGS6rAC1Wtuc+qIB1p8JA== 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 4XfTGd6jRrzhdW; Thu, 31 Oct 2024 16:00:09 +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 49VG09xN062164; Thu, 31 Oct 2024 16:00:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VG09kU062159; Thu, 31 Oct 2024 16:00:09 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:00:09 GMT Message-Id: <202410311600.49VG09kU062159@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: 5d5b31eb79aa - stable/13 - ena: Handle wrap around for prefetch in netmap 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/13 X-Git-Reftype: branch X-Git-Commit: 5d5b31eb79aac0e433c4de878f113f1506688fd2 Auto-Submitted: auto-generated The branch stable/13 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=5d5b31eb79aac0e433c4de878f113f1506688fd2 commit 5d5b31eb79aac0e433c4de878f113f1506688fd2 Author: Osama Abboud AuthorDate: 2024-08-07 06:24:20 +0000 Commit: Osama Abboud CommitDate: 2024-10-31 14:55:20 +0000 ena: Handle wrap around for prefetch in netmap Netmap index wraps around based on the number of netmap kernel ring slots. Currently the driver prefetches the next slot using nm_i + 1 which may be wrong since it does not handle wrap around. This patch fixes that by using the kernel API for fetching the next netmap index. Approved by: cperciva (mentor) Sponsored by: Amazon, Inc. (cherry picked from commit ce20b51cb71bfb548fcaafc4bacb8290460f03d5) --- sys/dev/ena/ena_netmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c index ae269cca853a..910b447b12c6 100644 --- a/sys/dev/ena/ena_netmap.c +++ b/sys/dev/ena/ena_netmap.c @@ -577,7 +577,7 @@ ena_netmap_tx_map_slots(struct ena_netmap_ctx *ctx, remaining_len = *packet_len; delta = 0; - __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + __builtin_prefetch(&ctx->slots[nm_next(ctx->nm_i, ctx->lim)]); if (tx_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { /* * When the device is in LLQ mode, the driver will copy @@ -664,7 +664,7 @@ ena_netmap_tx_map_slots(struct ena_netmap_ctx *ctx, * The first segment is already counted in. */ while (delta > 0) { - __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + __builtin_prefetch(&ctx->slots[nm_next(ctx->nm_i, ctx->lim)]); frag_len = slot->len; /* @@ -722,7 +722,7 @@ ena_netmap_tx_map_slots(struct ena_netmap_ctx *ctx, /* Map all remaining data (regular routine for non-LLQ mode) */ while (remaining_len > 0) { - __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + __builtin_prefetch(&ctx->slots[nm_next(ctx->nm_i, ctx->lim)]); rc = ena_netmap_map_single_slot(ctx->na, slot, adapter->tx_buf_tag, *nm_maps, &vaddr, &paddr);