From patchwork Tue May 30 15:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 10045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2254442vqr; Tue, 30 May 2023 08:13:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54asS3nv4vrbNxNJEla9pE3h+SmBL8p1eZSJaGjLQNimCEwl9VNJe3pziy7/diKe3G5uae X-Received: by 2002:a05:6a00:134e:b0:646:5041:9729 with SMTP id k14-20020a056a00134e00b0064650419729mr3382636pfu.0.1685459581137; Tue, 30 May 2023 08:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685459581; cv=none; d=google.com; s=arc-20160816; b=EbkKqHf/iJCcdg/IR8AUKOe+wkuOZqFyA6NKa726sVQqtT+1bFX7ENAf0S5UVTGO7t tjn6Hc0v8441EsvSoggbQ5wN3/oFCIMGjyxRhcyySKIRgnakbAggALoSi176i3n+/sMS BlLfAOPFNdoiuVr8dKE+lxyhbM0CpxijO41WJy//ZDPLEu+uEs4j/cpoG0PfTOxi4euZ kgFjyIQnprtaEC2N8aWhiqp/RyEoMc+dlAPLyv2OCrR06wXPbdfvxTpoItPPm8C8aVE1 vuNMxSYihpg9+ikICrcUMeO+zkj9kD21GguGvFaJsxhcM45no2uu9Nsav9in5JTSNsij hUGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XiaS646LixRZhIsCNB9uu4PgeX4MiAMgjYVZP1TnvcI=; b=hkoldwhuRzVBj96hbw2gc3COxmpEiD7KCb1NNgwKMlBP11ovHpWhE5kso5AGbC5W+U 7e9X0+98/oZjjTCMosXMNC2L6LX0qHKPmQICzuLbiEh9iKIHnHZam/cqgJqM3t9ppDeP Babv2Uw8UBp1/HJJP8UH+HF85ROiwqpRZD3tkVreoPXt0gx4zXGtj37/+QBNNxc5I+5w joecYHJ5lxR9r9RroMJScHAUPYy2ANq/kd+gW10MTWPXrE7dngYjj4OhcQ0Zv4VL0Hlh pMhnEE3UUwTC//ZMGn+MiY3Ob71Mt70V74S18gGhn2ueEheI2Zy3yX8nBCJcJYjJiorn YDfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EI4le25i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 188-20020a6206c5000000b00645e8c9e27esi1794803pfg.386.2023.05.30.08.12.46; Tue, 30 May 2023 08:13:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EI4le25i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbjE3PEI (ORCPT + 99 others); Tue, 30 May 2023 11:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232999AbjE3PEG (ORCPT ); Tue, 30 May 2023 11:04:06 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304B9BE; Tue, 30 May 2023 08:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685459045; x=1716995045; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fUAq4wbgsz1SejWCkHqlnI+GpKDj8KfUTf02IkbfZbk=; b=EI4le25izOHpA3lHzhx8PQCmpkkM107Y+CAAjKD5wiMrbzxS9GQlDWDm ONOuDjTlFsGZkxSk5HnzG2bgV2OU/EoBrsPJ6CJA2anSIg2/a1qO3ojUA W5YXnXxZbnPxwULC7vwks4y/VwEsmugdgZZzlkqjj4vmMhad+zY42P3hi Bjx3Ca1/BbvrYoRWfstKYNbC9AGPDDkpqoAvKxbss0KeBIBr6Qy3ZpWJL LUd/9UkOMyQsT3d3XPb3215tk7gbwQO+LsWETw/yJ3zv3tud8ts3WQ51P SN0RXK+kwdNavA7Mwe6qRk2VdGtvLSa99kH77kX2vZ6hg1raQOcQDv7vd g==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="358192160" X-IronPort-AV: E=Sophos;i="6.00,204,1681196400"; d="scan'208";a="358192160" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 08:03:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="796304135" X-IronPort-AV: E=Sophos;i="6.00,204,1681196400"; d="scan'208";a="796304135" Received: from newjersey.igk.intel.com ([10.102.20.203]) by FMSMGA003.fm.intel.com with ESMTP; 30 May 2023 08:03:05 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Maciej Fijalkowski , Magnus Karlsson , Michal Kubiak , Larysa Zaremba , Jesper Dangaard Brouer , Ilias Apalodimas , Christoph Hellwig , Paul Menzel , netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 00/12] net: intel: start The Great Code Dedup + Page Pool for iavf Date: Tue, 30 May 2023 17:00:23 +0200 Message-Id: <20230530150035.1943669-1-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767332465562216446?= X-GMAIL-MSGID: =?utf-8?q?1767332465562216446?= Here's a two-shot: introduce Intel Ethernet common library (libie) and switch iavf to Page Pool. Details in the commit messages; here's 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 gets really interesting. Stay tech. Alexander Lobakin (12): 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: skbuff: don't include into 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/engleder/tsnep_main.c | 1 + drivers/net/ethernet/freescale/fec_main.c | 1 + 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 | 190 +++++ .../marvell/octeontx2/nic/otx2_common.c | 1 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 1 + .../ethernet/mellanox/mlx5/core/en/params.c | 1 + .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 1 + drivers/net/wireless/mediatek/mt76/mt76.h | 1 + include/linux/net/intel/libie/rx.h | 170 +++++ include/linux/net/intel/libie/stats.h | 214 ++++++ include/linux/skbuff.h | 4 +- include/net/page_pool.h | 69 +- net/core/page_pool.c | 10 + 36 files changed, 1141 insertions(+), 2081 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 non-Intel code changes (0006-0008). From v2[0]: * 0006: fix page_pool.h include in OcteonTX2 files (Jakub, Patchwork); * no functional changes. From v1[1]: * 0006: new (me, Jakub); * 0008: give the helpers more intuitive names (Jakub, Ilias); * -^-: also expand their kdoc a bit for the same reason; * -^-: fix kdoc copy-paste issue (Patchwork, Jakub); * 0011: drop `inline` from C file (Patchwork, Jakub). [0] https://lore.kernel.org/netdev/20230525125746.553874-1-aleksander.lobakin@intel.com [1] https://lore.kernel.org/netdev/20230516161841.37138-1-aleksander.lobakin@intel.com