From patchwork Tue May 23 00:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Linga, Pavan Kumar" X-Patchwork-Id: 13251275 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0B64EA1 for ; Tue, 23 May 2023 00:28:41 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A3F3A96 for ; Mon, 22 May 2023 17:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684801669; x=1716337669; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AxkJYOIhBWGbOUXROaSgIA7RoOiNpxjrZhWRBptV37k=; b=R63A9DkVdhb/p/K7dYFQWVWdlOpQbdfhL+4PRQcemzHKPI9WnCb161T3 Bwp+KSc3bpCy+qL4FlGSn4coId+p9LozMlrhZyv/M8eG90spf3J1+LnEl T/UL/QJu0rFMFlrOpNVdTrqUYqlwemUUMK3uoJ+PTgDCS+/Ed+lOrJY+d 9Sd8VLWboB3QqYruf1hzIWtDN6QnkU7QuXPptdqVzEOyCCZuB0K2hFXqC YPC91ip/qdX4HFdEET4RLMxkTTqn44DHLBu0CmEfExGu1+Czb4ryA7iK7 q+g/U+qcNGJZdaQ7GovWXXQDcW6SnO+fNJevNQOgimbC+8UOiFFdYJneg g==; X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="337670661" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="337670661" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 17:26:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="827885480" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="827885480" Received: from unknown (HELO AMR-CMP1.ger.corp.intel.com) ([10.166.80.24]) by orsmga004.jf.intel.com with ESMTP; 22 May 2023 17:26:01 -0700 From: Pavan Kumar Linga To: intel-wired-lan@lists.osuosl.org Cc: shannon.nelson@amd.com, simon.horman@corigine.com, leon@kernel.org, decot@google.com, willemb@google.com, stephen@networkplumber.org, mst@redhat.com, Pavan Kumar Linga , jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Subject: [PATCH iwl-next v6 00/15] Introduce Intel IDPF driver Date: Mon, 22 May 2023 17:22:37 -0700 Message-Id: <20230523002252.26124-1-pavan.kumar.linga@intel.com> X-Mailer: git-send-email 2.37.3 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, 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 This patch series introduces the Intel Infrastructure Data Path Function (IDPF) driver. It is used for both physical and virtual functions. Except for some of the device operations the rest of the functionality is the same for both PF and VF. IDPF uses virtchnl version2 opcodes and structures defined in the virtchnl2 header file which helps the driver to learn the capabilities and register offsets from the device Control Plane (CP) instead of assuming the default values. The format of the series follows the driver init flow to interface open. To start with, probe gets called and kicks off the driver initialization by spawning the 'vc_event_task' work queue which in turn calls the 'hard reset' function. As part of that, the mailbox is initialized which is used to send/receive the virtchnl messages to/from the CP. Once that is done, 'core init' kicks in which requests all the required global resources from the CP and spawns the 'init_task' work queue to create the vports. Based on the capability information received, the driver creates the said number of vports (one or many) where each vport is associated to a netdev. Also, each vport has its own resources such as queues, vectors etc. From there, rest of the netdev_ops and data path are added. IDPF implements both single queue which is traditional queueing model as well as split queue model. In split queue model, it uses separate queue for both completion descriptors and buffers which helps to implement out-of-order completions. It also helps to implement asymmetric queues, for example multiple RX completion queues can be processed by a single RX buffer queue and multiple TX buffer queues can be processed by a single TX completion queue. In single queue model, same queue is used for both descriptor completions as well as buffer completions. It also supports features such as generic checksum offload, generic receive offload (hardware GRO) etc. v5 --> v6: link [5] (patch 1): * removed miss completion capability bit and feature flag to defer this optional feature to a later follow-on patch (patch 2): * use typed back pointer in idpf_hw struct (patch 3): * fix incorrect mask in reset test (patch 4): * removed setting miss completion capability in 'get caps' (patch 7): * don't set miss completion in the queue context * removed __IDPF_Q_MISS_TAG_EN flag and capability check for miss completion tag (patch 8): * convert to const vport parameter in idpf_is_feature_ena() (patch 11): * removed support for miss and reinject completion * fixed the check to restart the TX queue if enough buffers are available to avoid TX timeouts (patch 14): * removed 'tx_reinjection_timeouts' counter (patch 15): * updated the 'help' section in Kconfig file to use Infrastructure Data Path Function instead of Infrastructure Processing Unit [5] https://lore.kernel.org/netdev/20230513225710.3898-1-emil.s.tantilov@intel.com/ v4 --> v5: link [4] (patch 4): * improved error handling in the init path (patch 5): * added check for adapter->vports before de-allocating vport resources in the service task * added check for adapter->netdevs and removed redundant msleep in idpf_remove() * corrected s/simulatenously/simultaneously/ in comment (patch 10): * removed inline from idpf_tx_splitq_bump_ntu() * renamed s/parms/params/ to be consistent with rest of naming in code (patch 12): * corrected s/specifcally/specifically/ in comment (patch 13): * removed inline from idpf_rx_singleq_extract_base_fields() and idpf_rx_singleq_extract_flex_fields() (patch 14): * removed "port-" prefix from some stats * fixed setting adaptive coalescing (patch 15): * added toctree entry * fixed formatting, table of contents, notes and some wording in the docs [4] https://lore.kernel.org/netdev/20230508194326.482-1-emil.s.tantilov@intel.com/ v3 --> v4: link [3] (patch 1): * cleanups in virtchnl2 including redundant error codes, naming and whitespace (patch 3): * removed "__" prefix from names of adapter and vport flags, converted comments to kernel-doc style * renamed error code variable names in controlq to be more consistent with rest of the code * removed Control Plane specific opcodes and changed "peer" type comments to CP * replaced managed dma calls with their non-managed equivalent (patch 4): * added additional info to some error messages on init to aid in debug * removed unnecessary zero-init before loop and zeroing memcpy after kzalloc() * corrected wording of comment in idpf_wait_for_event() s/wake up/woken/ * replaced managed dma calls with their non-managed equivalent [3] https://lore.kernel.org/netdev/20230427020917.12029-1-emil.s.tantilov@intel.com/ v2 --> v3: link [2] * converted virtchnl2 defines to enums * fixed comment style in virtchnl2 to follow kernel-doc format * removed empty lines between end of structs and size check macro checkpatch will mark these instances as CHECK * cleaned up unused Rx descriptor structs and related bits in virtchnl2 * converted Rx descriptor bit offsets into bitmasks to better align with the use of GENMASK and FIELD_GET * added device ids to pci_tbl from the start * consolidated common probe and remove functions into idpf_probe() and idpf_remove() respectively * removed needless adapter NULL checks * removed devm_kzalloc() in favor of kzalloc(), including kfree in error and exit code path * replaced instances of kcalloc() calls where either size parameter was 1 with kzalloc(), reported by smatch * used kmemdup() in some instances reported by coccicheck * added explicit error code and comment explaining the condition for the exit to address warning by smatch * moved build support to the last patch [2] https://lore.kernel.org/netdev/20230411011354.2619359-1-pavan.kumar.linga@intel.com/ v1 --> v2: link [1] * removed the OASIS reference in the commit message to make it clear that this is an Intel vendor specific driver * fixed misspells * used comment starter "/**" for struct and definition headers in virtchnl header files * removed AVF reference * renamed APF reference to IDPF * added a comment to explain the reason for 'no flex field' at the end of virtchnl2_get_ptype_info struct * removed 'key[1]' in virtchnl2_rss_key struct as it is not used * set VIRTCHNL2_RXDID_2_FLEX_SQ_NIC to VIRTCHNL2_RXDID_2_FLEX_SPLITQ instead of assigning the same value * cleanup unnecessary NULL assignment to the rx_buf skb pointer since it is not used in splitq model * added comments to clarify the generation bit usage in splitq model * introduced 'reuse_bias' in the page_info structure and make use of it in the hot path * fixed RCT format in idpf_rx_construct_skb * report SPEED_UNKNOWN and DUPLEX_UNKNOWN when the link is down * fixed -Wframe-larger-than warning reported by lkp bot in idpf_vport_queue_ids_init * updated the documentation in idpf.rst to fix LKP bot warning [1] https://lore.kernel.org/netdev/20230329140404.1647925-1-pavan.kumar.linga@intel.com/ Alan Brady (4): idpf: configure resources for TX queues idpf: configure resources for RX queues idpf: add RX splitq napi poll support idpf: add ethtool callbacks Joshua Hay (5): idpf: add controlq init and reset checks idpf: add splitq start_xmit idpf: add TX splitq napi poll support idpf: add singleq start_xmit and napi poll idpf: configure SRIOV and add other ndo_ops Pavan Kumar Linga (5): virtchnl: add virtchnl version 2 ops idpf: add core init and interrupt request idpf: add create vport and netdev configuration idpf: continue expanding init task idpf: initialize interrupts and enable vport Phani Burra (1): idpf: add module register and probe functionality .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/intel/idpf.rst | 160 + drivers/net/ethernet/intel/Kconfig | 10 + drivers/net/ethernet/intel/Makefile | 1 + drivers/net/ethernet/intel/idpf/Makefile | 18 + drivers/net/ethernet/intel/idpf/idpf.h | 751 +++ .../net/ethernet/intel/idpf/idpf_controlq.c | 641 +++ .../net/ethernet/intel/idpf/idpf_controlq.h | 131 + .../ethernet/intel/idpf/idpf_controlq_api.h | 169 + .../ethernet/intel/idpf/idpf_controlq_setup.c | 175 + drivers/net/ethernet/intel/idpf/idpf_dev.c | 165 + drivers/net/ethernet/intel/idpf/idpf_devids.h | 10 + .../net/ethernet/intel/idpf/idpf_ethtool.c | 1331 +++++ .../ethernet/intel/idpf/idpf_lan_pf_regs.h | 124 + .../net/ethernet/intel/idpf/idpf_lan_txrx.h | 293 ++ .../ethernet/intel/idpf/idpf_lan_vf_regs.h | 128 + drivers/net/ethernet/intel/idpf/idpf_lib.c | 2354 +++++++++ drivers/net/ethernet/intel/idpf/idpf_main.c | 269 + drivers/net/ethernet/intel/idpf/idpf_mem.h | 20 + .../ethernet/intel/idpf/idpf_singleq_txrx.c | 1251 +++++ drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4604 +++++++++++++++++ drivers/net/ethernet/intel/idpf/idpf_txrx.h | 844 +++ drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 164 + .../net/ethernet/intel/idpf/idpf_virtchnl.c | 3825 ++++++++++++++ drivers/net/ethernet/intel/idpf/virtchnl2.h | 1289 +++++ .../ethernet/intel/idpf/virtchnl2_lan_desc.h | 448 ++ 26 files changed, 19176 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/intel/idpf.rst create mode 100644 drivers/net/ethernet/intel/idpf/Makefile create mode 100644 drivers/net/ethernet/intel/idpf/idpf.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_api.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_setup.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_dev.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_devids.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_ethtool.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_lan_pf_regs.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_lan_vf_regs.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_lib.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_main.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_mem.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_txrx.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_txrx.h create mode 100644 drivers/net/ethernet/intel/idpf/idpf_vf_dev.c create mode 100644 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c create mode 100644 drivers/net/ethernet/intel/idpf/virtchnl2.h create mode 100644 drivers/net/ethernet/intel/idpf/virtchnl2_lan_desc.h