From patchwork Thu Dec 6 23:25:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 153068 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp11146127ljp; Thu, 6 Dec 2018 15:26:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0HM+OjX5HMYgJY+pu+Uftf2EhtmxzwGPqGqLbzHukdTM+wTtZTaHh1l6mC0rXQljBFBpB X-Received: by 2002:a17:902:7683:: with SMTP id m3mr11442480pll.187.1544138762427; Thu, 06 Dec 2018 15:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544138762; cv=none; d=google.com; s=arc-20160816; b=cDrIqSNl06FDJvX2YS5R0rybvVhpWSO06+r2OPq3bd0CyVNfvWt4LcvSYh2VsKrRF/ MYLE2oE4c8MF1rTLStOLBCaZns+Ocg8lKA1GrtmGymErxFrl55Afgr6y1G3LbRJw7GQm +nV9tUFxkpOtM4c2AZ1sCK2Rt4N5tyjwRnwtJ4DiD9kq2f1IRgzeH+KMksJIpmJbKqz4 7yVOHtxCo0ev947ficAt7vNtn93CDFpEaTP/845ItQCaTx/j0vlBt5R2Mt0MVCEvse4J aX8LSYC6XT/VBTAWpkDQia8eOGHtRjq+X7eW+D2E1H/JRezQSgze3gcvg4n/7glf4Pi3 8gFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=mT7WV54Gg4oJwNbI63meHKsJ37ZINZ7M7JSk3WDX3fQ=; b=IWkHxOxTNeIcyjJ4LEshVt4ERUrESkM6uFBlAhFxnkE78mqIcuwzxJXXKh+RDDK2HS d+9iSh/kNqILHuJymMaMkSbO0QksuW3GHmb5Moqrs8uOrbj1lKuItJuu97D/oqOvqlJB EnzWanaZ/CCxrJlvt5zVNQoOP9obKCaMW45k8o4ZWZVmz023qKHMd+VILM2l8gFKoyWq E6G5lkVXfJ4VK/66WvidoK8fTeG6cIn58RzaM88KvBCDy+VuA+Btp0+1bZAtOLjTr5jL FPo8YJmaQnSY7RvRqMnuBcvvZDznEoqeDQWkI5Q7bCvPKRXHwcOn44LuR/4GuJGicmeA a2VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si1337455pld.86.2018.12.06.15.26.02; Thu, 06 Dec 2018 15:26:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbeLFXZj (ORCPT + 10 others); Thu, 6 Dec 2018 18:25:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58902 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbeLFXZi (ORCPT ); Thu, 6 Dec 2018 18:25:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 599BC300273A; Thu, 6 Dec 2018 23:25:37 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-16.brq.redhat.com [10.40.200.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id E61FC6249B; Thu, 6 Dec 2018 23:25:32 +0000 (UTC) Received: from [192.168.5.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 1D3CA31256FC6; Fri, 7 Dec 2018 00:25:32 +0100 (CET) Subject: [net-next PATCH RFC 1/8] page_pool: add helper functions for DMA From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, "David S. Miller" , Jesper Dangaard Brouer Cc: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , ard.biesheuvel@linaro.org, Jason Wang , ilias.apalodimas@linaro.org, =?utf-8?b?QmrDtnJuVMO2cGVs?= , w@1wt.eu, Saeed Mahameed , mykyta.iziumtsev@gmail.com, Daniel Borkmann , Alexei Starovoitov , Tariq Toukan Date: Fri, 07 Dec 2018 00:25:32 +0100 Message-ID: <154413873204.21735.4234188123129390865.stgit@firesoul> In-Reply-To: <154413868810.21735.572808840657728172.stgit@firesoul> References: <154413868810.21735.572808840657728172.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 06 Dec 2018 23:25:38 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ilias Apalodimas Add helper functions for retreiving dma_addr_t stored in page_private and unmapping dma addresses, mapped via the page_pool API. Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer --- include/net/page_pool.h | 6 ++++++ net/core/page_pool.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 694d055e01ef..439f9183d4cd 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -111,6 +111,8 @@ struct page_pool *page_pool_create(const struct page_pool_params *params); void page_pool_destroy(struct page_pool *pool); +void page_pool_unmap_page(struct page_pool *pool, struct page *page); + /* Never call this directly, use helpers below */ void __page_pool_put_page(struct page_pool *pool, struct page *page, bool allow_direct); @@ -141,4 +143,8 @@ static inline bool is_page_pool_compiled_in(void) #endif } +static inline dma_addr_t page_pool_get_dma_addr(struct page *page) +{ + return page_private(page); +} #endif /* _NET_PAGE_POOL_H */ diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 43a932cb609b..26e14a17a67c 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -184,6 +184,13 @@ static void __page_pool_clean_page(struct page_pool *pool, set_page_private(page, 0); } +/* unmap the page and clean our state */ +void page_pool_unmap_page(struct page_pool *pool, struct page *page) +{ + __page_pool_clean_page(pool, page); +} +EXPORT_SYMBOL(page_pool_unmap_page); + /* Return a page to the page allocator, cleaning up our state */ static void __page_pool_return_page(struct page_pool *pool, struct page *page) {