git: 5d5b31eb79aa - stable/13 - ena: Handle wrap around for prefetch in netmap
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 31 Oct 2024 16:00:09 UTC
The branch stable/13 has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=5d5b31eb79aac0e433c4de878f113f1506688fd2 commit 5d5b31eb79aac0e433c4de878f113f1506688fd2 Author: Osama Abboud <osamaabb@amazon.com> AuthorDate: 2024-08-07 06:24:20 +0000 Commit: Osama Abboud <osamaabb@FreeBSD.org> 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);