[PATCH io_uring-7.1 v2 4/5] io_uring/zcrx: use dma_len for chunk size calculation

Pavel Begunkov
2026-03-25T13:09:24Z

Buffers are now dma-mapped earlier and we can sg_dma_len(), otherwise,
since it's walking with for_each_sgtable_dma_sg(), it might wrongfully
reject some configurations. As a bonus, it'd now be able to use larger
chunks if dma addresses are coalesced e.g by iommu.

Fixes: 8c0cab0b7bf76 ("always dma map in advance")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index d9174cb31a44..e1d2e1f1b766 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -63,7 +63,7 @@ static int io_area_max_shift(struct io_zcrx_mem *mem)
unsigned i;

for_each_sgtable_dma_sg(sgt, sg, i)
- shift = min(shift, __ffs(sg->length));
+ shift = min(shift, __ffs(sg_dma_len(sg)));
return shift;
}

--
2.53.0