From patchwork Thu Mar 28 14:47:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 161318 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp805983jan; Thu, 28 Mar 2019 07:47:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7oa6vV6coChlov/hIGPcr7DREyAoawiQu7CRvy5ayeGdCG9mejUFgOThwyVpniMZz4llR X-Received: by 2002:a62:3585:: with SMTP id c127mr40938579pfa.71.1553784445539; Thu, 28 Mar 2019 07:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553784445; cv=none; d=google.com; s=arc-20160816; b=tKxUrCrolup2uUXW2RyMYMmzvF3uU2fwYs9cRXVwNGFe56AFyMwZtvcqUkjNBmVtLF sp2ru1DoS61ci410Z9LP8lSRzeD0DMmBf9FSbZX330S28y3G2GYQ1M+wPCRm/Shhu/Il SNEU5IycCyQEV9vOjPhRL105anvrcYN9BUe34F0rfJ12vDwaVUsfxNT8ZKNYUivwn3YW /lfpCoiLgpQc3Jvr/oD7HEADV+YHJjuCatG4ehWvSPqUouhnto1pi78ymfZj/fjRrTPq zQ8h/2yUlENCDw/e38GHzuKYjr4e0P8PIlqvBt5hJ1S+TzIxuoZcx568EjZU6f6NcV9/ gt3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=HWZ+8t0RXb66eJXzmJXGu8ooK4qVIsnGjH9596so8Ec=; b=qxVOvpuKXDCBQg8XORsuDHcHcOu0oB0sN9nTkfOxbAyyuVfO+mzZDryCz2WY0wtR+V j86zs89CMH5WfhVCGusxJm/pVgq6MiJYuBsKFbOZU40aC5qaad7GdxEkihKSa9YNPssj JvQAgfuzcuC27wmWsQ5JHnijAHooU5lEKY0BUgBL9ndpBfZX9Kn7XXcE+kBCTrWX6NTR Ca4LoM3G8EwhWr+uBWye2eAWCHMLLEPl1dPA5V8I8rG7V0zOxUNlIWT7IoNKVzq/ajza Vdw1vXw5gOnPeIvhCRnrEDhMuldcUziTXy4apR/nUrjaoIrslWI2sBkWN/twDTqUOL1R v0Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmQAbqYd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a40si22993177pla.234.2019.03.28.07.47.25; Thu, 28 Mar 2019 07:47:25 -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; dkim=pass header.i=@linaro.org header.s=google header.b=pmQAbqYd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbfC1OrY (ORCPT + 9 others); Thu, 28 Mar 2019 10:47:24 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33539 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbfC1OrY (ORCPT ); Thu, 28 Mar 2019 10:47:24 -0400 Received: by mail-wm1-f65.google.com with SMTP id z6so7470186wmi.0 for ; Thu, 28 Mar 2019 07:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=HWZ+8t0RXb66eJXzmJXGu8ooK4qVIsnGjH9596so8Ec=; b=pmQAbqYd8pntk9Ip91KxLi3nFRH0gUuA/fg020NB0g8owoGwr/9aie92WqZ9Hkp+wE HOPN94Z1sIAACnvMqaJ+y1kPx3E15PMxpxPLjDwz9lKwgp1cNPKmlO0U2Cjv9nIdg46N t4pi8VQLB3BilR22Le6kxxLSoWozXNZdnTtyfzVPW6yiTVGGFEUc6kKTSYcAZBQo51Uc Oy/gy72valr2YMPTanZz4ESJC1cnsOSZdxRkSpkMm7SLFWbR826ZdT2rYHjzd7pi2A8m U4rkv14hMKJToBkB7oEBh26iAdOXYCky2LBdOTD2Up3V5qUxyqTxjkhYpoVbBkobQR8q lEmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HWZ+8t0RXb66eJXzmJXGu8ooK4qVIsnGjH9596so8Ec=; b=peImXWJB84lBc6DzVxdwX7uslesZDCNt4hOO/N8gGRIAIWerL1a4QGopMJx4zHAKU/ ZO0GBXaE5R82n6Ezj13RmDXbqBy88t4O8f/AVBHyB+gfy8NHgi4f1Ep7YyhoySE7FZP7 3a7WeRCCxDJiuZrH8FO8AO7BPjspuQwGcehSLGQpXoulD5np0pFDLhBmqX3rd+MwyCvj aYngtmhSZBrXXvgAkPUCMaOJvfb+IeUi85U4XZ+jEk5kk0KqFkDCZBiyAuaz+gnx0X1/ t1eV74PMG3LPbabeMn/2XI6vvduKNdYOk+8gjWxE4YYGyMxnA15M9xuEyDs2EjdKsqSz ozMw== X-Gm-Message-State: APjAAAUu9/4tU8zCbeTDjc42gk1vhLWFT/W0G56CiKeX93362wzCbTDE zpQgVjgbysMTDCi67jOYrb82Tw== X-Received: by 2002:a1c:1d4:: with SMTP id 203mr234354wmb.101.1553784442270; Thu, 28 Mar 2019 07:47:22 -0700 (PDT) Received: from apalos.lan (ppp-94-64-206-130.home.otenet.gr. [94.64.206.130]) by smtp.gmail.com with ESMTPSA id v184sm5680854wma.6.2019.03.28.07.47.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Mar 2019 07:47:21 -0700 (PDT) From: Ilias Apalodimas To: brouer@redhat.com, netdev@vger.kernel.org Cc: tariqt@mellanox.com, davem@davemloft.net, toke@redhat.com, mcroce@redhat.com, Ilias Apalodimas Subject: [net-next, PATCH 1/2] net: page_pool: add helper funtion to retrieve dma addresses Date: Thu, 28 Mar 2019 16:47:17 +0200 Message-Id: <1553784438-17503-1-git-send-email-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The page_pool API has no users for it's DMA capabilities yet. Retrieving DMA addresses used by network drivers will be needed for real users. commit 1567b85eb8ad ("net: page_pool: don't use page->private to store dma_addr_t") uses 'struct page' to store the addresses. This patch provides a helper for retrieving them. Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer --- include/net/page_pool.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 694d055..b885d86 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 Thu Mar 28 14:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 161319 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp806023jan; Thu, 28 Mar 2019 07:47:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8kvcCnubvKEd+hFpOb+QWD57u78C9aE/XXAIvBxA/dqgIrEMsU34W3b8iv9j8RlrmD+Xn X-Received: by 2002:aa7:885a:: with SMTP id k26mr41213661pfo.70.1553784447673; Thu, 28 Mar 2019 07:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553784447; cv=none; d=google.com; s=arc-20160816; b=TbIC58RO6BPAOLDcUPCvGjMeMTZdtANY0IWXCGSYS3Gn02xByMjAkE5vz9akPiUkq2 EFBgbRTDc3I5+e7E136WPaz5fOOIoKJDdS2QsYDx4z2gwjmJXhBfp+AaeHZtHnPgbanI 0xoJpaO+7bdjW/K4cut6MlGuCGtXl9qh9vxRrySP7qqglP+ZfjaxL3D5c8ufyhrHDWqR +fvR294LGjTyk6SeaDKTDQhcoMJW+qcpU/VduYSCkhSivSvukhHme0ieYABmUbXKDA52 bF1lI2ernSLCsX+o3jjY69mzVHz6CgpMwUZcULZ54MYgF9REew+SCVGytjcUFNA3qVK2 RITQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=oqZ48IvbPvrq08/kzjAZtAIPpAx5tJ8sPvlrYGu/HUI=; b=TF5M1oTDEDC6heBbqT9wLQKd1UOql+WnU4D/VoLhuQl8Qp8zD8ph0KiS3EOW4tbK7x fqfyqjsHYi2U/fbp3kTEWfEQb4qEz6dmaWhuIxyuaiWopkT92Kp520Ft7XYKAaGUgQWF /QPdN0rJFTuDnFFZ/5vl948hhsotJ5YQhJRghMWZ5DvsWzSMIrL2BnYkgDDk4wdKX/q5 08h3HOB1zBkppmzqK0uprh4jPKp5JtiszQ9Ac9uHmJzS1G0eu3UpicZLi184djqHLM+G vQTVFhlQCUKOPKgFf9zkUZXigGxF3i0b+yGnW8lPZFGfhEfJMyNyL7gqS3Tm3V3YdR6U ZIxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ok1R544u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a40si22993177pla.234.2019.03.28.07.47.27; Thu, 28 Mar 2019 07:47:27 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Ok1R544u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfC1Or0 (ORCPT + 9 others); Thu, 28 Mar 2019 10:47:26 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42649 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbfC1OrZ (ORCPT ); Thu, 28 Mar 2019 10:47:25 -0400 Received: by mail-wr1-f66.google.com with SMTP id g3so19762359wrx.9 for ; Thu, 28 Mar 2019 07:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oqZ48IvbPvrq08/kzjAZtAIPpAx5tJ8sPvlrYGu/HUI=; b=Ok1R544uxfBNns1tuA/3YAuJL445IyCuOrJXyERu7Iuysy35sa6iXIvIwMOTn9jl2s OVT++YTwlTUPKTTqUMODa48SKZVH45OzG7Ox6mljLFPDUbItOJujL2BGwTDObpH+SIuj MlW7NmduvPAVaIy9PlgZ5cwWU5CVfJ0ngWMRzqQamwNfgmdT7FiQbdULUamZ2GIPwrA+ 5IzbnwOa4PNzy0AmetwbaC5+vjtLNjAno+pDEuLYOWfuvoH5SuBvmla3MRLZb+zZq/SR AYMqsLvMudhxekJ4lVMchU1pQRRoYHhpHpZYVXxy1pLYQSrIOy08rrLAm+KCTn4gkVzK PzYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oqZ48IvbPvrq08/kzjAZtAIPpAx5tJ8sPvlrYGu/HUI=; b=HmqR27DvPL4CSIGXH8SM1+pj28eWwY3RunwtWe4uLiz4sAisei11mi2H0ds0itM/B/ x2o0hzbWS76aTB+oE/GPD5i+TTwGrWP8lrKse+qqgRVGz1Ep9VPyI7xZT8Yhtc4yy7ZR yQbvmf86doNjX5VmmKkO4KZVyWXBdkmsxS17xlakxszUi7yWt4hLIWhNrAh+oDOI28qc shC354XpsupygHxXwH29AALog8uGZXRLFj78sh9CXuFuycdAHnupUbPsgWcpkC6Jz14m gK2Zo4Oax7Jaq3Dg0sU4TfxqGr0OYaqnRUgy/Mg9Mo1UjZglNacurzuY4EZY6iyP2ZnW Dj2w== X-Gm-Message-State: APjAAAWuq8WYA5ZKeYR+qj6FJFpe4ctZCg4LLk0RQRpC5zAb1Tb11Da6 brtkcEspmas1P3ap5DzhbJYXhA== X-Received: by 2002:adf:db10:: with SMTP id s16mr19730262wri.181.1553784443779; Thu, 28 Mar 2019 07:47:23 -0700 (PDT) Received: from apalos.lan (ppp-94-64-206-130.home.otenet.gr. [94.64.206.130]) by smtp.gmail.com with ESMTPSA id v184sm5680854wma.6.2019.03.28.07.47.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Mar 2019 07:47:23 -0700 (PDT) From: Ilias Apalodimas To: brouer@redhat.com, netdev@vger.kernel.org Cc: tariqt@mellanox.com, davem@davemloft.net, toke@redhat.com, mcroce@redhat.com, Ilias Apalodimas Subject: [net-next, PATCH 2/2] net: page_pool: add helper funtion to unmap dma addresses Date: Thu, 28 Mar 2019 16:47:18 +0200 Message-Id: <1553784438-17503-2-git-send-email-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553784438-17503-1-git-send-email-ilias.apalodimas@linaro.org> References: <1553784438-17503-1-git-send-email-ilias.apalodimas@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The page_pool API has no users for it's DMA capabilities yet. Unmapping DMA addresses used by network drivers will be needed for real users. commit 1567b85eb8ad ("net: page_pool: don't use page->private to store dma_addr_t") uses 'struct page' to store the addresses. This patch provides a helper for unmapping them. 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(+) -- 2.7.4 diff --git a/include/net/page_pool.h b/include/net/page_pool.h index b885d86..ad218ce 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 897a69a..83b4ba2 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -189,6 +189,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) {