From patchwork Tue May 16 16:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 1782145 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=JFM29Ot6; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QLM070PNyz20dg for ; Wed, 17 May 2023 02:20:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EA7F541E63; Tue, 16 May 2023 16:20:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EA7F541E63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1684254005; bh=0X5Sa9AeSb0Y3xzuNPpztd1nKq2EjqdyElgC4HN9/5c=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=JFM29Ot6U2mYj5FdbLEf4VQkKBkPmz7JGFTYpYfuyunz9xTKqfjcBC73Go2d09vp7 KGaa0pFbg4QOcL+dTEXnnEGMey6rbfRh6y2irkV5M10W3NmpVhP6P6jJERQ4HQAxph HHCDlLFybVK+KFHw957r/E8x9UEgMe7dX4Z+a795C5cc/KNtsnL5at+GJtpcteH+67 50x6ARZiBkydf8P5VkB+sJ2FTk+yTQIEE3lCExwWC09Dm5KHeXxrP9ruEWBbbDrCYb Xd5AKhveRBiwgzKs6KE/VpYJNUeG6BtPpXCnr2GIZlxZk4eCd2fBCIChhyaAKeM99g d1RbHSBEpOw+Q== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lNFHglLZSBiN; Tue, 16 May 2023 16:20:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id D537040B70; Tue, 16 May 2023 16:20:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D537040B70 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 748651BF2C0 for ; Tue, 16 May 2023 16:20:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4C87E81F2B for ; Tue, 16 May 2023 16:20:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4C87E81F2B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P1YYDPOb1nQl for ; Tue, 16 May 2023 16:20:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3684781F0F Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3684781F0F for ; Tue, 16 May 2023 16:20:00 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="340896493" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="340896493" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 09:20:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="701414028" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="701414028" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orsmga002.jf.intel.com with ESMTP; 16 May 2023 09:19:56 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Date: Tue, 16 May 2023 18:18:30 +0200 Message-Id: <20230516161841.37138-1-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684254001; x=1715790001; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Hr9PkdJvHGtuKIHhlA6m9sGNlu3p1iusY1YTwCd+hfs=; b=YNYh7ZjN6pXVWWFz26BrNIr2hQaXjGfNWdnMZolMpKbmCWoBp35+Ycn9 lxADgNP/nT1eRlcQn3ibsBYVoXUtgtAMf8e6CJkEGlG3amnSVEQvpiiGa TAdzJ+Zk1RurF01BQtU1VwkPQGyPhROPXjdesssBIQcrPQgTS8YFBjqJF weMHSDqH/2WxIdMgAIyKBO/p4dwc9lMqHRlQG6pItUtiNkHR7drBw3fx5 uRkGGV/2tcoMBhXqMI1w8S39N8tI/hIIsvDMAu4oHxJghU7qOdXsE1M4n rsNqtdu8ODlqnFBkNbNVrmU4T8Qm0FNV6+TF/XuXUR0KWwZOCfBAqAE1Z A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YNYh7ZjN Subject: [Intel-wired-lan] [PATCH net-next 00/11] net: intel: start The Great Code Dedup + Page Pool for iavf X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jesper Dangaard Brouer , Larysa Zaremba , netdev@vger.kernel.org, Ilias Apalodimas , linux-kernel@vger.kernel.org, Michal Kubiak , intel-wired-lan@lists.osuosl.org, Christoph Hellwig , Magnus Karlsson Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Here's a two-shot: introduce Intel Ethernet common library (libie) and switch iavf to Page Pool. Details in the commit messages; here's the summary: Not a secret there's a ton of code duplication between two and more Intel ethernet modules. Before introducing new changes, which would need to be copied over again, start decoupling the already existing duplicate functionality into a new module, which will be shared between several Intel Ethernet drivers. The first thing that came to my mind was "libie" -- "Intel Ethernet common library". Also this sounds like "lovelie" and can be expanded as "lib Internet Explorer" :P I'm open for anything else (but justified). The series is only the beginning. From now on, adding every new feature or doing any good driver refactoring will remove much more lines than add for quite some time. There's a basic roadmap with some deduplications planned already, not speaking of that touching every line now asks: "can I share this?". PP conversion for iavf lands within the same series as these two are tied closely. libie will support Page Pool model only, so a driver can't use much of the lib until it's converted. iavf is only the example, the rest will eventually be converted soon on a per-driver basis. That is when it will get really interesting. Stay tech. ...#6 tries to shortcut a bunch of calls and checks, Chris, please let me know if it violates DMAnything (although I'll be missing my +100 Kpps then =\ :D). Alexander Lobakin (11): net: intel: introduce Intel Ethernet common library iavf: kill "legacy-rx" for good iavf: optimize Rx buffer allocation a bunch iavf: remove page splitting/recycling iavf: always use a full order-0 page net: page_pool: avoid calling no-op externals when possible net: page_pool: add DMA-sync-for-CPU inline helpers iavf: switch to Page Pool libie: add common queue stats libie: add per-queue Page Pool stats iavf: switch queue stats to libie MAINTAINERS | 3 +- drivers/net/ethernet/intel/Kconfig | 12 +- drivers/net/ethernet/intel/Makefile | 1 + drivers/net/ethernet/intel/i40e/i40e_common.c | 253 ------- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + .../net/ethernet/intel/i40e/i40e_prototype.h | 7 - drivers/net/ethernet/intel/i40e/i40e_txrx.c | 74 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 88 --- drivers/net/ethernet/intel/iavf/iavf.h | 2 +- drivers/net/ethernet/intel/iavf/iavf_common.c | 253 ------- .../net/ethernet/intel/iavf/iavf_ethtool.c | 227 +----- drivers/net/ethernet/intel/iavf/iavf_main.c | 45 +- .../net/ethernet/intel/iavf/iavf_prototype.h | 7 - drivers/net/ethernet/intel/iavf/iavf_txrx.c | 715 +++++------------- drivers/net/ethernet/intel/iavf/iavf_txrx.h | 185 +---- drivers/net/ethernet/intel/iavf/iavf_type.h | 90 --- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 16 +- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 316 -------- drivers/net/ethernet/intel/ice/ice_main.c | 1 + drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 74 +- drivers/net/ethernet/intel/libie/Makefile | 7 + drivers/net/ethernet/intel/libie/internal.h | 23 + drivers/net/ethernet/intel/libie/rx.c | 158 ++++ drivers/net/ethernet/intel/libie/stats.c | 189 +++++ include/linux/net/intel/libie/rx.h | 170 +++++ include/linux/net/intel/libie/stats.h | 214 ++++++ include/net/page_pool.h | 62 +- net/core/page_pool.c | 10 + 28 files changed, 1125 insertions(+), 2078 deletions(-) create mode 100644 drivers/net/ethernet/intel/libie/Makefile create mode 100644 drivers/net/ethernet/intel/libie/internal.h create mode 100644 drivers/net/ethernet/intel/libie/rx.c create mode 100644 drivers/net/ethernet/intel/libie/stats.c create mode 100644 include/linux/net/intel/libie/rx.h create mode 100644 include/linux/net/intel/libie/stats.h --- Directly to net-next, has core code changes.