From patchwork Wed Jan 11 04:22:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13095994 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 1C9E2C5479D for ; Wed, 11 Jan 2023 04:22:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FE9C90000A; Tue, 10 Jan 2023 23:22:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B4C290000B; Tue, 10 Jan 2023 23:22:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12EF990000A; Tue, 10 Jan 2023 23:22:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F1C68900003 for ; Tue, 10 Jan 2023 23:22:25 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CFF67120398 for ; Wed, 11 Jan 2023 04:22:25 +0000 (UTC) X-FDA: 80341221450.21.2431475 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id 4BCC440002 for ; Wed, 11 Jan 2023 04:22:24 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=E9lPWmVW; spf=none (imf17.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=1673410944; 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=sIvsfRyHd+n90C8eGgTzNiW5NYYQVxV4bU3jT+uf9ZE=; b=g1pY8AH12Q7cDxTokDmnHWZKDWoACVqECYqUluG0PiSXA2eEXHdYqR1yswEFpiKYExtqvn xBBKSISZLoHD2noPEfzs4XHgPTjoYSwuUIYeh8xd2vnI9vPu4KJ4cbh+266gCLojrCyhR0 Zvrw/ZdBKk+IGo5VowDxfHfQKHhGHEQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=E9lPWmVW; spf=none (imf17.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=1673410944; a=rsa-sha256; cv=none; b=LdEOFul4tgHcf7tb3c24vIbTrUvUX6PdTxzeZ50xEgvBZx8KIkCQejsedocGNv9TGmcMw8 d4KNdpMydAfVOcDIGXn/w/iqGnUxdnNsA8bRFUnpxLRwDXNXTHFKNBbKtm/uEj4rq3VBkJ SL3oj/ovejtorsEzg2rWBEPwtuicCaY= 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=sIvsfRyHd+n90C8eGgTzNiW5NYYQVxV4bU3jT+uf9ZE=; b=E9lPWmVWGAZEtiz2aU0caCoAjM 0FaB62SnKuQ7vhAud1coGaNAZWFv6wS/MayWmIttQoI9kZi5cUYTt7rIuo8UYZHLDJHwzfabR15XV 2KC6PUfmKhj1IbzBoJJpIowxEGC7SSlscrgXzl3CpZ/RfZbqD4Ms5gy3QFu/dcACcOJLm5pripjTr 1GUWLYuSaaWnsXx+WNMLSvRkwtJyWPLnlC/KI8qHhrdzLHHg6TisKhTv1hthzZn0ioCbCN2efQk8S 4NCTzlVNJc5uQ9thLVUWog9oEgKfD1nBOZCr0U7LrPSkjOBsGE6f3ekYluynD3ogsjjZBCcx4uv2J rhLM/FoA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFScz-003nyo-Tp; Wed, 11 Jan 2023 04:22:17 +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 , Jesper Dangaard Brouer , Jesse Brandeburg Subject: [PATCH v3 20/26] xdp: Convert to netmem Date: Wed, 11 Jan 2023 04:22:08 +0000 Message-Id: <20230111042214.907030-21-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230111042214.907030-1-willy@infradead.org> References: <20230111042214.907030-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4BCC440002 X-Stat-Signature: esntu9zgshdzgxk1r7xbcpnrjorw8pc8 X-Rspam-User: X-HE-Tag: 1673410944-861768 X-HE-Meta: U2FsdGVkX18DRtMXs+WfBT/SDFIhyBq++rWIT8nEB46Hk4jm7i39Yhly1B0smPM45ts4w+B2Y6Z8X+Oei8nb6uGywdqLcuPQ1A5RTMCB5oOgk5IJwhXY/+fGWM/tv8GJrQKhGrtzIKfk+HyZY0eYisrtpV+cAiK975Sd6OPMpH4r69NlTc7wFq1GAtm7HFK+0NhJGSBvdeQ2u8SPJoKlD+FMCfuiBK01BBlMn6Q31G3tDyQUjB/drKJAHoAk4M2+AWrqXdS3R3OL6OpYTkW7epXJMCC4mC9inPQh/ixUgXdzupKwU2aohoUF/o2ujIuhVSmdnU8vfrENUQjTLvmjugKsXqM1iVC1czX8kyFkjuEx97gdtHuExa2Ufu8J1QU0RObOlMUFprlVkpUMyEKHgGDosQ8Zw1T7YEemwhuVM2DbJLViYQvHYkqSw36XRarHTM7ETxcuLvUtaFhTwnIX1TI+3ZfOYT+iuq/EGNu8HewIqgxbHfQhqzahdq4K/4fJlV1iLawH3ycC4Ut7Vl44rawbls1oG+AwKCnyzkZTJZsnNeYw8jK/KaMovFsiTwaXYt2Zj94Hgx/OKFFg4jrLwiU2xRIeZ7Inln1kzaoihIFHrtEqt0XhKFqd+pUzPd4vPk5G4gzLPr/8abE7Gxks4hIL7LhWw2Vocnl/NTjgI0ypiF2RjQjZJetntuXtXZDO6thUAQBkHxoeRlOZWf+UHB4uDcbtob0TkbEU3xvi83SjTEr1e5DeB9IWovHXAt+u0VSnlGejDMPpZWKSVh3Zneub8c1sHH/zo3h7QimYOFnu/HLhmk1mwqwDDKIUnsH4ty6W7/11ITzZJP74iZgbe+VK3MaezWNRgio4lBf1Zwm6yrwykfKaZ4KxG7S52koE 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 Reviewed-by: Jesse Brandeburg --- 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);