From patchwork Fri Apr 9 22:37:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12195159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFEFDC43461 for ; Fri, 9 Apr 2021 22:38:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F7F261178 for ; Fri, 9 Apr 2021 22:38:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F7F261178 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8C2286B0070; Fri, 9 Apr 2021 18:38:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84A696B0071; Fri, 9 Apr 2021 18:38:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64F136B0072; Fri, 9 Apr 2021 18:38:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 428376B0070 for ; Fri, 9 Apr 2021 18:38:09 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E0A0E18010BF3 for ; Fri, 9 Apr 2021 22:38:08 +0000 (UTC) X-FDA: 78014293056.08.90B18B6 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf27.hostedemail.com (Postfix) with ESMTP id C343980192C0 for ; Fri, 9 Apr 2021 22:38:00 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id v6so9736028ejo.6 for ; Fri, 09 Apr 2021 15:38:08 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=RQaj4GV0Jq3ffxY/eFd7Oq4i8/CAPwtBW6FzUex6oGs=; b=isfFzVCNNrUMT/3zm4f2HgcuegTds+TiX2nkhVrSg5iAjC2q9mmmUc7Fp6wrmOTEmA eSjcRNeG4QkvUnoSgrr6I8LYlLYWWXhjg4SnkZdN3H6mNThze5kKabwQjodtBWSsohC5 yoB1W94nZ/EKMSEJ44Z9Fh4BuchB7sllpOemLxX4KYuMAWm+1s2HS9pjtKSwh5WpJ2hN HnQH5S+/aSTzOGdngHUkomBuTWFi5UrzOf1aNdobZZ3o+8Yde1LJPYOJYPwOGEWN/rrH oSBaRpVjNLURN5s4Oy/8E+nYAbuhSziA/xDFoo1m3rBM3By74zKozJfsjtjPQZTxPoVi t2nQ== X-Gm-Message-State: AOAM530AlSLM3x+/pWBGbniMOqquKw2R4h0JbQzoKdpJcogtBLJE93x9 cJRNoLEq/SKanjN/+Ozh7ew= X-Google-Smtp-Source: ABdhPJx4JIcTBS5XaTVR5i9muuS54gLr6k4CxbJYfTE18J+nrM5vNX7CvYmgumecUrk1XBF+7DSXBw== X-Received: by 2002:a17:907:33cb:: with SMTP id zk11mr1145396ejb.231.1618007887368; Fri, 09 Apr 2021 15:38:07 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-93-66-21-119.cust.vodafonedsl.it. [93.66.21.119]) by smtp.gmail.com with ESMTPSA id s20sm2108726edu.93.2021.04.09.15.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 15:38:06 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Ilias Apalodimas , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Guoqing Jiang , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Aleksandr Nogikh , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, Matthew Wilcox , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Subject: [PATCH net-next v3 0/5] page_pool: recycle buffers Date: Sat, 10 Apr 2021 00:37:56 +0200 Message-Id: <20210409223801.104657-1-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Stat-Signature: hkiyo94z48xnh3hgix5pcfom7akqxxks X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C343980192C0 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=mail-ej1-f52.google.com; client-ip=209.85.218.52 X-HE-DKIM-Result: none/none X-HE-Tag: 1618007880-421042 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: From: Matteo Croce This is a respin of [1] This patchset shows the plans for allowing page_pool to handle and maintain DMA map/unmap of the pages it serves to the driver. For this to work a return hook in the network core is introduced. The overall purpose is to simplify drivers, by providing a page allocation API that does recycling, such that each driver doesn't have to reinvent its own recycling scheme. Using page_pool in a driver does not require implementing XDP support, but it makes it trivially easy to do so. Instead of allocating buffers specifically for SKBs we now allocate a generic buffer and either wrap it on an SKB (via build_skb) or create an XDP frame. The recycling code leverages the XDP recycle APIs. The Marvell mvpp2 and mvneta drivers are used in this patchset to demonstrate how to use the API, and tested on a MacchiatoBIN and EspressoBIN boards respectively. Please let this going in on a future -rc1 so to allow enough time to have wider tests. [1] https://lore.kernel.org/netdev/154413868810.21735.572808840657728172.stgit@firesoul/ v2 -> v3: - added missing SOBs - CCed the MM people v1 -> v2: - fix a commit message - avoid setting pp_recycle multiple times on mvneta - squash two patches to avoid breaking bisect Ilias Apalodimas (1): page_pool: Allow drivers to hint on SKB recycling Jesper Dangaard Brouer (1): xdp: reduce size of struct xdp_mem_info Matteo Croce (3): mm: add a signature in struct page mvpp2: recycle buffers mvneta: recycle buffers .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 2 +- drivers/net/ethernet/marvell/mvneta.c | 7 ++- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++---- drivers/net/ethernet/marvell/sky2.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +- include/linux/mm_types.h | 1 + include/linux/skbuff.h | 35 ++++++++++++-- include/net/page_pool.h | 15 ++++++ include/net/xdp.h | 5 +- net/core/page_pool.c | 47 +++++++++++++++++++ net/core/skbuff.c | 20 +++++++- net/core/xdp.c | 14 ++++-- net/tls/tls_device.c | 2 +- 13 files changed, 142 insertions(+), 27 deletions(-)