From nobody Thu Oct 31 16:01:35 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 4XfTJJ1cb7z5bwh1; Thu, 31 Oct 2024 16:01:36 +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 4XfTJH6xTmz4TDl; Thu, 31 Oct 2024 16:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390496; 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=aLNOEJwEACZLR/CbyVTrwHS3c1+IXeUUrV0c6t/6ckg=; b=yRzRZLdwyoj29Tt50nskpEW1HLN/E0uY32nwRise+dZ9ejBkrcrL6NIST/LwnhYOv9IAQf p6faFQW1Y5GHbCohwI7sbFRJw2aCiTRO1b0EZtCsXOJbBLZPRNM/TiSIXdB0RoI2Oaan0A ck3tTT/scltbV2KxmQlDhSX8IPun6oyWF2Z0fgAOJP5dMJIcz+oOt4NuvETFDdowDO7KUu ayQh7qb0c7M6SnVqxSoSnjgsT+a9WpHdgA/fRVevIulmD0Rff412Wjj+Cun5Htt9eRrGzg tKKVdJyfrhcdJmPOHEWc+4cYMQnv7lcm258FzHwj4EXuABFovfOZuvee8PD58Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730390496; 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=aLNOEJwEACZLR/CbyVTrwHS3c1+IXeUUrV0c6t/6ckg=; b=O20MZ1OwZjvLSy+D0N4XNvsvO56iR+TIBpoVpWGWQLLSphCQHjGeBKUMNe1CFXI3zPicEp t0cEDFDxVgo62pAN+zIbov7tBFAIo7YAtxu/IJER2bskD2nQuFfh/+LZKqQGMO2YOhgzsU 7Qptx8K90dO92app/oD+8VLCKNbNc1jsAnjUstNqSso7ghCQZMWaU9e4MYKe4D/KI91qKh hCvy2qCZweKKFMO2vi/d88nLKTVb/bPMfWnS0qzmKFTsp/3MEUo+5x3R2u86/bLlJAPjVY tRqKXgwdgra5dO+b8tHLokP5v7nKZYfNGjAyXx+J9puQjzD0OKF1knceuC/Ajg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730390496; a=rsa-sha256; cv=none; b=KddsAuKgUzvSMP1J1fEk4rC5sQrFmtGb5R3Qr0rtdx9o5kdaeHTCWSh3ROOkUpfynMRxUE tM0PRW9aZZaThbw6zaqQF+N/0H83vFMHCA9gJol9RV1Vyeln8Z/GWMbY55Mzr53SblQNya ao+YELlCUJBrwKTLcf0bUHLrdmxWcDRYvtipF+Lo6ufATuAFa7x4KcbOXiW1kct0MvrcFT hRE/pYmrVaj8GQjbxq/C8gr055YgCwMx3CCeDoSv7o2Hgvon2oqiGJbZyBFiPHSWCLOrdj Nj8pAcu5iViCeK/cbqLyWuxdkpCE3fzX+b4G5Fg8Fb5QdiKPtV5oqmDrR2tuQg== 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 4XfTJH6WSDzjZy; Thu, 31 Oct 2024 16:01:35 +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 49VG1ZOJ071465; Thu, 31 Oct 2024 16:01:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VG1ZVn071450; Thu, 31 Oct 2024 16:01:35 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:01:35 GMT Message-Id: <202410311601.49VG1ZVn071450@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: b0830d2b6bbc - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: b0830d2b6bbc76fcbfe937f674e06e14933ad3ef Auto-Submitted: auto-generated The branch stable/14 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=b0830d2b6bbc76fcbfe937f674e06e14933ad3ef commit b0830d2b6bbc76fcbfe937f674e06e14933ad3ef Author: Osama Abboud AuthorDate: 2024-08-07 06:24:20 +0000 Commit: Osama Abboud CommitDate: 2024-10-31 14:54:11 +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 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);