From patchwork Thu Jan 5 21:46:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13090549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9D07C3DA7A for ; Thu, 5 Jan 2023 21:46:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6A9A8E000C; Thu, 5 Jan 2023 16:46:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A4EA7900004; Thu, 5 Jan 2023 16:46:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40B258E0005; Thu, 5 Jan 2023 16:46:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C5BCA8E000B for ; Thu, 5 Jan 2023 16:46:34 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 80DA61C5E39 for ; Thu, 5 Jan 2023 21:46:34 +0000 (UTC) X-FDA: 80322079908.07.41F2D2F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 9E4024000A for ; Thu, 5 Jan 2023 21:46:32 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jhhqxfbI; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672955193; a=rsa-sha256; cv=none; b=vzBttWHLrXuKrLwdxTODJO98QQZuzoyqByVKRR2wy3Xo5Caowg4yRbPyLG3Nu9Is6AoDyI dII0TTTcAGIgrDm5FxSltppQ/sVRKNGSev3fS3+cWB4mmGex0QeYrmunKsZbTNorQVICj2 /7hYA+l3FFaiNowsLOWOwSrInju7r0A= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jhhqxfbI; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672955193; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v8XZwj+qrPdVX2joAsiJ+16x3YDJToWBKe9JDnAu2v0=; b=wic9DFx5OMGYEQ62kd6jHpRv4zyT2T2X6t/spYZD5Zte8MeuPBzSmJizHOj/70/UZIwa7z BrqH2lPZ8ioRDZRX5BwwfuBioGARmrl+hmBcDa2yYK9EdbLCX72Hrtf25cb6d78vnZjXIT Qq1ChjzGU3F1lZuZZx6FhJ/ls5Fp2Xw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=v8XZwj+qrPdVX2joAsiJ+16x3YDJToWBKe9JDnAu2v0=; b=jhhqxfbIe+lYs0FzsttLqke7z8 XS4XLQXn2EJUYRmYVtPYUvXoPPwkPeiNS02jes+dFai5qoZ7hlECJ/7bLXVYRJUM6CJDRdq7SHV5H dH8dG8Y9dn6qTfxADoTwzb2MczMdVa6+NKtCPTd6oFArL8WVNzwq+zRXah7FqNjUsb85Jg6xLAu4H SLFc6eFrdPu+GRe0wKnL0RuPbpYP+Vwc9l6sHcYCn1V5ymRmDd5niCXuxufqxiM1JJRdpyVNofPKo LsTD2kmdr537YkEzVVJzEbVYFNj5kn6ca7qZpP/xyD6Bxui+OWnUQbEOftW687VVpr9DpdT18AcSa ue5aHJjQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDY4J-00GWoI-8F; Thu, 05 Jan 2023 21:46:35 +0000 From: "Matthew Wilcox (Oracle)" To: Jesper Dangaard Brouer , Ilias Apalodimas Cc: "Matthew Wilcox (Oracle)" , netdev@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt Subject: [PATCH v2 19/24] xdp: Convert to netmem Date: Thu, 5 Jan 2023 21:46:26 +0000 Message-Id: <20230105214631.3939268-20-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230105214631.3939268-1-willy@infradead.org> References: <20230105214631.3939268-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9E4024000A X-Stat-Signature: 3ethdttxcugsrtgpckho57qbek46utkt X-HE-Tag: 1672955192-206654 X-HE-Meta: U2FsdGVkX1/ifYQgSpXBbE7+6XC+tprMqAbGS1xQY7Y2zxkMSuWJ9nZdb2XY6joDJKfzngJrVFn+GaTQwByo5VWrVl+gQLox3Y2NEnjrmw6YYnUNPjtN9mio5cUCdlvQq8vJoZ3uskbSEiV5Uaf8qKrM76MNDF3FCN4UtKyw7hsRl1GCVVSvxSWP6njVexHfIqiAWyBIppltfRajtniVtN7JvvzlybbHuwCSIyYKy/a10A+gmD8AsooIHfbUr70C/d7cKhjeVWjb5qt2JBGiIFVH6DuvSnWY3eBxaSOxj7bXaoOvTounLoUIZW31J0fwyLY41iZ9mspCkNgQP0Lp2oz1qN75M8BYqbmaCXmbTwWYTwEPrTTLJw75lB+hBwGLi0ZqtzOwyCsaqYiN1xydN7bgfi3jz95QiJwlQsu1YOuesjyRlHAf3U2C7WWGTC4oUwklvIxYnctukOoqW08hoH4MraoA1DFpX760r/XJONF7/rANhWrexoMvsd0iIrFoAdP3n0mogYc0MyVd+xAwTtTbaSYMLZTeW+i7kvlMzmeuRs/7eex8OblP5i22iBDRF5aQ2fvmKgNFBeCrBFDx1+LOBK/VqM9BDNUITL6npCA0BhrwcVriRqr+Op7piKFzKGJ+uOJemmv68dqAiMK55CFQTi/A5nP4AtxyIZ5f5FDEFL0cJF4QMNYwL7iOCeFspN6F2UQUPAIqVp5RYbt8zH7Fl3iZGqwDgXdxfy7FH3teKHaCyqRMffS3Gd7kRcdc3MCKsDLI24nAomP8QYdw4uQIV5RFReTmEMe0TrnxO3KXvOIsy9k+IT1AaQMOuZJgaAUoHrEogPmq3lyEEwZx2IY1lUPdpFLxqZEuV0poGeron3Kx9LiM9csuNOHnalU/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We dereference the 'pp' member of struct page, so we must use a netmem here. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Jesper Dangaard Brouer Reviewed-by: Ilias Apalodimas --- net/core/xdp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/core/xdp.c b/net/core/xdp.c index 844c9d99dc0e..7520c3b27356 100644 --- a/net/core/xdp.c +++ b/net/core/xdp.c @@ -375,17 +375,18 @@ EXPORT_SYMBOL_GPL(xdp_rxq_info_reg_mem_model); void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct, struct xdp_buff *xdp) { + struct netmem *nmem; struct page *page; switch (mem->type) { case MEM_TYPE_PAGE_POOL: - page = virt_to_head_page(data); + nmem = virt_to_netmem(data); if (napi_direct && xdp_return_frame_no_direct()) napi_direct = false; - /* No need to check ((page->pp_magic & ~0x3UL) == PP_SIGNATURE) + /* No need to check ((nmem->pp_magic & ~0x3UL) == PP_SIGNATURE) * as mem->type knows this a page_pool page */ - page_pool_put_full_page(page->pp, page, napi_direct); + page_pool_put_full_netmem(nmem->pp, nmem, napi_direct); break; case MEM_TYPE_PAGE_SHARED: page_frag_free(data);