From patchwork Tue Dec 19 21:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13499105 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDDA03EA78 for ; Tue, 19 Dec 2023 21:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="oux1MZOq" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d3b5f9860bso13764695ad.3 for ; Tue, 19 Dec 2023 13:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703019858; x=1703624658; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+R3fraE1AUJLiBUl+irWqkEYdm8NtMUbP7MGr9N7dq0=; b=oux1MZOq0AzQgkcRmTCoj873Fn++FIU+nsu6uzWncnnZnBKhfjnsVhQmhuanI8ANrp 441FQdX/PIBwqAwSTclUPmw51AHBolPPqVidjmbvYdV6jpbKyhLeOMAD2f+rb0XPFRXD 1UF59ZJDEmS68G/aZQalCwtyuIb07xxrw3gaBQDCEMk6POItlGSjVr7inj5wFKxXH3En 82J3w82CPGNwPSykYLF5NjH2kMYS9vBQhV8LsCPTez/TQ2wdqRHuF33hoG0Dp0qJp8NE UhOikBtYWJdeeZPiIuI6Cn0SDmXR5uEtFVBRFpUUepmYOQYQwJd7wSYsFnLCV0/qd1lv 2Hfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703019858; x=1703624658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+R3fraE1AUJLiBUl+irWqkEYdm8NtMUbP7MGr9N7dq0=; b=bLxAKatA5dPs5QodFdlw0my4LUsDNw3KQ/fl71pmjA4XlEPoZrWHhZX+cAG2MUyd4j 3h54hp3vUfGLqEs3s+0XwDuJP3X5mU8a9XE4mv8L0LwnyAADw1GQRGVOOXckls1Zq+pM aqOXIyRbxGwD3ejE1ZfTXzDNn9GUaglXmCpJinLJZvi7rCdPhIZS7wECStIFrSlg8je6 AHrJ/cqW6D/gYFwnXgRK6PpG40XMdKELXRNMH91m+UlWARoKY2mDewz6Hc0i9s37kkfy 8YinxoKiwjhWzzRRpyef3fyrQyV/h2sJNOwD855RUO1chZxKkS+y0Nl8lI52Pq0Rx5Zu f4yw== X-Gm-Message-State: AOJu0Yx+U+asfFSvSMsoRUwV1QU0SpEg1HbvIEbqaXdkeKxz2ukeX169 uvu68I3zfLquR//u6ikRSC/Shw== X-Google-Smtp-Source: AGHT+IHv2Ih+zIMLBLTSl+oRkb/qmBFcX3CARWtV0GirJ8tYSwTCNeW0vzrX5FsoKxAiegCWCFM5LA== X-Received: by 2002:a17:902:704c:b0:1d0:6ffd:ae22 with SMTP id h12-20020a170902704c00b001d06ffdae22mr9681493plt.137.1703019858245; Tue, 19 Dec 2023 13:04:18 -0800 (PST) Received: from localhost (fwdproxy-prn-002.fbsv.net. [2a03:2880:ff:2::face:b00c]) by smtp.gmail.com with ESMTPSA id u2-20020a170902e80200b001acae9734c0sm4100365plg.266.2023.12.19.13.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 13:04:17 -0800 (PST) From: David Wei To: io-uring@vger.kernel.org, netdev@vger.kernel.org Cc: Jens Axboe , Pavel Begunkov , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Eric Dumazet , Jesper Dangaard Brouer , David Ahern , Mina Almasry Subject: [RFC PATCH v3 14/20] net: page pool: add io_uring memory provider Date: Tue, 19 Dec 2023 13:03:51 -0800 Message-Id: <20231219210357.4029713-15-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231219210357.4029713-1-dw@davidwei.uk> References: <20231219210357.4029713-1-dw@davidwei.uk> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Pavel Begunkov Allow creating a special io_uring pp memory providers, which will be for implementing io_uring zerocopy receive. Signed-off-by: Pavel Begunkov Signed-off-by: David Wei --- include/net/page_pool/types.h | 1 + net/core/page_pool.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index fd846cac9fb6..f54ee759e362 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -129,6 +129,7 @@ struct mem_provider; enum pp_memory_provider_type { __PP_MP_NONE, /* Use system allocator directly */ PP_MP_DMABUF_DEVMEM, /* dmabuf devmem provider */ + PP_MP_IOU_ZCRX, /* io_uring zerocopy receive provider */ }; struct pp_memory_provider_ops { diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 9e3073d61a97..ebf5ff009d9d 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -242,6 +243,11 @@ static int page_pool_init(struct page_pool *pool, case PP_MP_DMABUF_DEVMEM: pool->mp_ops = &dmabuf_devmem_ops; break; +#if defined(CONFIG_IO_URING) + case PP_MP_IOU_ZCRX: + pool->mp_ops = &io_uring_pp_zc_ops; + break; +#endif default: err = -EINVAL; goto free_ptr_ring;