From patchwork Tue Jun 18 13:05:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 167150 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4197165ilk; Tue, 18 Jun 2019 06:05:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHy1d3WTfoR+jcESD4Axd7E5NRkkkTHXjWlQMc8RfZckQljsJD9arIdJpAZiA879YH2LZV X-Received: by 2002:a17:902:24c:: with SMTP id 70mr112987402plc.2.1560863121145; Tue, 18 Jun 2019 06:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560863121; cv=none; d=google.com; s=arc-20160816; b=AL1UJTfh9dz2nZqwAIyUTJWDAyiST1t3tBLoH62bibVm+2vHx3w3bcditRdDdsF+oY poLx5BxVP6KqjdpjsIKSoVLGTCLgm/HIs1Ah+vs99dD2r+wSFlkkKcw0alOvXkLb5wSl 58WDF5uqWVf9lAV2Dyedy19x7w79SRUnB/rj7Hp5dUEU82Hsz4pTiPujlwoO7lkOolBC M35TI4hkiaPMoCe9w2vRTQprSooNP0sJUDVi/QxwnruqR38ci3NWBBynfwqUtQapPjOR xOdxzzYRneYZ5yhqEr/C7bQZn3xNhYpiG4+23UqYwf4CeLurP+8I8Nsni8aWpZrvA68e E1Qg== 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=BmWe/qrZpHqckw3ywSc2HEpjgw38Hi93R9qlekkAbus=; b=zZ79EoH5rn4nlibvVkFMGFBqoeoJWcqZMSx8D6bkcyZfo1RZ827tRdi+tzJCpQbvib rEAee02k27hB3p6QazRrFDbXmfCFF+w7Cdm6aDUhJhXg0agGJOnmzRB9XGPlJZ0itEB2 j5pCGXoc7wVhY+WW0aKyQwjI2llKLbhYJ8wazW6Xt3ekgThROJfPr1Fk7g5cgNe0dAWo si43Ruz88dnc79uMsKeS1fJaIdVnHtz1r3wpl2IQo548dmzvC7/bkZxz+f9Gy8GQwBkp JcxBY55B7hCy48NTcDdy6sE4whRQdAi0p9/ih5Fr05L3tZJmTaK7hkYqKUaWBTfxEKL2 oH7Q== 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 2si150284pgy.541.2019.06.18.06.05.20; Tue, 18 Jun 2019 06:05:21 -0700 (PDT) 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 S1726158AbfFRNFT (ORCPT + 9 others); Tue, 18 Jun 2019 09:05:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfFRNFT (ORCPT ); Tue, 18 Jun 2019 09:05:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66F65C05B1CD; Tue, 18 Jun 2019 13:05:19 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-41.brq.redhat.com [10.40.200.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42A5D7FD44; Tue, 18 Jun 2019 13:05:13 +0000 (UTC) Received: from [192.168.5.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 6A3FE31256FCB; Tue, 18 Jun 2019 15:05:12 +0200 (CEST) Subject: [PATCH net-next v2 01/12] net: page_pool: add helper function to retrieve dma addresses From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, Ilias Apalodimas , Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , Tariq Toukan , Jesper Dangaard Brouer Cc: toshiaki.makita1@gmail.com, grygorii.strashko@ti.com, ivan.khoronzhuk@linaro.org, mcroce@redhat.com Date: Tue, 18 Jun 2019 15:05:12 +0200 Message-ID: <156086311236.27760.10158530288130730889.stgit@firesoul> In-Reply-To: <156086304827.27760.11339786046465638081.stgit@firesoul> References: <156086304827.27760.11339786046465638081.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 18 Jun 2019 13:05:19 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ilias Apalodimas On a previous patch dma addr was stored in 'struct page'. Use that to retrieve DMA addresses used by network drivers Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer --- include/net/page_pool.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 694d055e01ef..b885d86cb7a1 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -132,6 +132,11 @@ static inline void page_pool_recycle_direct(struct page_pool *pool, __page_pool_put_page(pool, page, true); } +static inline dma_addr_t page_pool_get_dma_addr(struct page *page) +{ + return page->dma_addr; +} + static inline bool is_page_pool_compiled_in(void) { #ifdef CONFIG_PAGE_POOL From patchwork Tue Jun 18 13:05:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 167151 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4197263ilk; Tue, 18 Jun 2019 06:05:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWZiwKTvliSSzNxjMxt7Z8pSREBBsa8bPofCK6JEbNCMTiMEBQ79kV7UT/utVKFbRmK50e X-Received: by 2002:a17:902:2926:: with SMTP id g35mr68187358plb.269.1560863124728; Tue, 18 Jun 2019 06:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560863124; cv=none; d=google.com; s=arc-20160816; b=KaiMqSWHadppwIBVEsdEdZ3bILQbG8U76BKYjhSNyxvyt1Jkzut9KL1NLnKNiArcvM OzcoUXqgRus4GyC5N53TziPbM29u9FQ/C4Vuec3AvDx0/98rFmTMfgwkOo2zU5UR4aOG TSgr5yM4figJwltFsf0PvipLkwvv4DoaSdX1n+Cff3Idv31DG3zS0SH0UZraLeH9cmKJ bh6gYkS0cQgH0QITcVIrHT9KRLVbOgb6wv7gy1jVZfCaUM8Kg4c3i1mX/2zACfd6As4K bgBIsM/Jq6fq7Y3TER8Ji9XL37Y2H5FzkCJ8cobGorBjgj8mLGYsx3OFOP9RF4Rx4VG7 X2ZQ== 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=mXMfmXQMkJc/W/FjiAVHX0AFBhX7RixtjUnDFZCg+aA=; b=tpZGg8r4Zx3uw9ti/cXgXYryPotaJypWRM72XL+3MnlOdnYY2UJfOsd+GbdjNBRVnS TAznTcDgro2S+EcegJde017kUAnU6QtaZtiWsoq5N2U3ThJMC02NL7zh2qlNRmSHA3NH s+KegQ0spM2baTwksDplXNfB+GayZW6LEhL9BJM1k6UCmNwvu90keKsqmoPmDsk4o0Nj BM3St/BCrsAZpBBWZpZ/cvzCKAOpC1542mYSZAw1komo1Wm7NJ2GjAUGVMPMHu1jCEXy AB1yGIRE8XPtU1d/K0xg9Gzs19XKMvGpy/XoJH8sETltREv2PtmS9XSm9xbbrjmuOQPT JtSQ== 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 2si150284pgy.541.2019.06.18.06.05.24; Tue, 18 Jun 2019 06:05:24 -0700 (PDT) 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 S1728845AbfFRNFX (ORCPT + 9 others); Tue, 18 Jun 2019 09:05:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21410 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbfFRNFW (ORCPT ); Tue, 18 Jun 2019 09:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55E57308302F; Tue, 18 Jun 2019 13:05:22 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-41.brq.redhat.com [10.40.200.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50D331017E33; Tue, 18 Jun 2019 13:05:18 +0000 (UTC) Received: from [192.168.5.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 7C2A4306665E6; Tue, 18 Jun 2019 15:05:17 +0200 (CEST) Subject: [PATCH net-next v2 02/12] net: page_pool: add helper function to unmap dma addresses From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, Ilias Apalodimas , Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , Tariq Toukan , Jesper Dangaard Brouer Cc: toshiaki.makita1@gmail.com, grygorii.strashko@ti.com, ivan.khoronzhuk@linaro.org, mcroce@redhat.com Date: Tue, 18 Jun 2019 15:05:17 +0200 Message-ID: <156086311744.27760.5417231838560145863.stgit@firesoul> In-Reply-To: <156086304827.27760.11339786046465638081.stgit@firesoul> References: <156086304827.27760.11339786046465638081.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 18 Jun 2019 13:05:22 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ilias Apalodimas On a previous patch dma addr was stored in 'struct page'. Use that to unmap DMA addresses used by network drivers Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer --- include/net/page_pool.h | 1 + net/core/page_pool.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/net/page_pool.h b/include/net/page_pool.h index b885d86cb7a1..ad218cef88c5 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -110,6 +110,7 @@ static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool) 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, diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 5b2252c6d49b..205af7bd6d09 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -190,6 +190,13 @@ static void __page_pool_clean_page(struct page_pool *pool, page->dma_addr = 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) {