From nobody Tue Oct 15 17:43:15 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 4XShK015CXz5Ylj6; Tue, 15 Oct 2024 17:43:16 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XShJz3qWQz4ZS3; Tue, 15 Oct 2024 17:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014195; 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=tznwAbFnHYqEPzZeqkbVB6SPY8JPsYmEnxIw5CfnYAI=; b=L2roir4JGr1xrwvDe7s2kbhiNRtpcpM4QWJf8T5bFGtOdPEL39rVv1A02JLdsswNti/5GL O1tRnIw6jBAJcOJHHlbQ2gL67BTPrBtA1tvbBmVvOqg7IOEPHEBsf62J8C0RrYO+6xWoVk WTs9JN0TJoq3Pg9LoZciumWXL2ngnLPgLchGisAoc+vfS1s4fNzyUe3K6QB6JI2+6bAfE0 WJbC4PVLCaIzKxpNQhupinMsWJ9Ynq0mfplLrHKT+2ZOVIBOnPlZegZ9NtCMXebUMRzhOz iB1zDFk3U0ux0s9iTLL2XKGzyreywCFFMj/6XCg7U/WH58q1TJ6K5GPQfwELVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014195; 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=tznwAbFnHYqEPzZeqkbVB6SPY8JPsYmEnxIw5CfnYAI=; b=DINe8M/K6WGCEYUPJsLFPW1rJe//wWdeosdX9l/Zb33xZEptTo0OJbgnXFVOjZyD1rIh8f NmKAo4u3iKWiy5GH/Y4EMx3437JWJWKX9bCFbHv5B/aigllsumMssc8FRf3F9zpMYRWC2Q +tYNXHPRCafc7XpFTVroiYEIEqrue58Pbme2WsPLvwoz+mEk0/dYDGDvlk/LUuIp4rYkNT P0ggiYRM7byVsq3xxs9tKu2EKkjMeNURND7da1fgUAB87LBA4ZfXH5lPi6OHCGLIVBz5Kp 1qsMOhkA6shqlFoU6CeS0whigJRy21AbTpxkYle78V/9koe5OxasX5G4odypiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729014195; a=rsa-sha256; cv=none; b=n5M9OorliRkt9xO3CVyCggwlqfqy7tVXd7JGw4FFVNLeYiwJDoRm9fG86bi25EChGeRvTB 98AEeaej8c5nRCUJl3D1qyArN9Oky/jSNShu1L0kxCfdTkgh41aSTXw25cNMPT5vK+vv3w 00+tMESD2OYUQt0JG1Hz4ac2lLnqlsMMjUy1vP4KwVZkSLlZkUt9mfnBayv7LtcLzhFPZM a+JT7T93cRtB/I1sQ3/JmRnO8oCEbLaXsoZZGqQ4qKSk7m4ZVtXL6tQh6Ki4xXgSE6T09+ pLa5V+xQENsRrZEuuM5QlJCIw4ouaO3ovdttykSWdYEloHflAyjUangDF6gf6w== 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 4XShJz3Rs8zXM0; Tue, 15 Oct 2024 17:43:15 +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 49FHhFTL062498; Tue, 15 Oct 2024 17:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHhFog062495; Tue, 15 Oct 2024 17:43:15 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:43:15 GMT Message-Id: <202410151743.49FHhFog062495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Osama Abboud Subject: git: ce20b51cb71b - main - 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/main X-Git-Reftype: branch X-Git-Commit: ce20b51cb71bfb548fcaafc4bacb8290460f03d5 Auto-Submitted: auto-generated The branch main has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=ce20b51cb71bfb548fcaafc4bacb8290460f03d5 commit ce20b51cb71bfb548fcaafc4bacb8290460f03d5 Author: Osama Abboud AuthorDate: 2024-08-07 06:24:20 +0000 Commit: Osama Abboud CommitDate: 2024-10-15 17:38:32 +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) MFC after: 2 weeks Sponsored by: Amazon, Inc. --- 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 f14a4a9539d1..eef8021b8569 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);