]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring/zcrx: declare some constants for query
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 15 Feb 2026 23:29:39 +0000 (23:29 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 Mar 2026 13:21:54 +0000 (07:21 -0600)
Add constants for zcrx features and supported registration flags that
can be reused by the query code. I was going to add another registration
flag, and this patch helps to avoid duplication and keeps changes
specific to zcrx files.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/query.c
io_uring/zcrx.c
io_uring/zcrx.h

index 63cc30c9803d197269238c6c3fd1c74d95e3bf5e..c1704d088374caab95b63e3b29a7c0844c8ca00e 100644 (file)
@@ -34,12 +34,12 @@ static ssize_t io_query_zcrx(union io_query_data *data)
 {
        struct io_uring_query_zcrx *e = &data->zcrx;
 
-       e->register_flags = ZCRX_REG_IMPORT;
+       e->register_flags = ZCRX_SUPPORTED_REG_FLAGS;
        e->area_flags = IORING_ZCRX_AREA_DMABUF;
        e->nr_ctrl_opcodes = __ZCRX_CTRL_LAST;
        e->rq_hdr_size = sizeof(struct io_uring);
        e->rq_hdr_alignment = L1_CACHE_BYTES;
-       e->features = ZCRX_FEATURE_RX_PAGE_SIZE;
+       e->features = ZCRX_FEATURES;
        e->__resv2 = 0;
        return sizeof(*e);
 }
index 62d693287457fe291c885092cfeec5df63169253..73fa82759771079e583494e4324e48dc421ba0f3 100644 (file)
@@ -778,11 +778,13 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
                return -EFAULT;
        if (!mem_is_zero(&reg.__resv, sizeof(reg.__resv)) || reg.zcrx_id)
                return -EINVAL;
+       if (reg.flags & ~ZCRX_SUPPORTED_REG_FLAGS)
+               return -EINVAL;
        if (reg.flags & ZCRX_REG_IMPORT)
                return import_zcrx(ctx, arg, &reg);
        if (copy_from_user(&rd, u64_to_user_ptr(reg.region_ptr), sizeof(rd)))
                return -EFAULT;
-       if (reg.if_rxq == -1 || !reg.rq_entries || reg.flags)
+       if (reg.if_rxq == -1 || !reg.rq_entries)
                return -EINVAL;
        if (reg.rq_entries > IO_RQ_MAX_ENTRIES) {
                if (!(ctx->flags & IORING_SETUP_CLAMP))
index 32ab95b2cb811a74785d45eb65a67db947330815..0ddcf0ee88615f6798bbcf9d7aae42673e9b5b77 100644 (file)
@@ -8,6 +8,9 @@
 #include <net/page_pool/types.h>
 #include <net/net_trackers.h>
 
+#define ZCRX_SUPPORTED_REG_FLAGS       (ZCRX_REG_IMPORT)
+#define ZCRX_FEATURES                  (ZCRX_FEATURE_RX_PAGE_SIZE)
+
 struct io_zcrx_mem {
        unsigned long                   size;
        bool                            is_dmabuf;