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) {