From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EC36C76195 for ; Thu, 23 Mar 2023 12:24:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DF13784056; Thu, 23 Mar 2023 12:24:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org DF13784056 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1679574282; bh=zsc68Dx3TqexMqs5G4Hb3f0WglccTDeioSPeYxI3t9Y=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=PI9ta/eTgO4CGqYyQINgFm9iXasZ4kSbzAJ5HVTth2lkAXH+YKkDqX7oP7Xv2ZZCH D3KhN01xhQrcYEii23oi72xsX8+C2f6fZGa6sbJlwteEk3MIUYJP2d3CAnT7WJRNPx 8tPToEr2AM7yfimgNAFelslJRWEy0yTFybQUVGfTipv7qow1W8YyH91yXuawz8+FjI OU9ymHfnlpbbxtZEoK7oEpLdUaxZY8vmdurOWjc9LUzk7LbMGy+Xy8ln8zvXR5oSgU A5fvQjBs3LUQMe6ovOuWJmYZp697kt+TFOwR3xBJxStecFREexNQ671y28985Eb2w4 yhePgcy36hsIQ== 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 Q304laWMSPe3; Thu, 23 Mar 2023 12:24:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id D0F3E8401D; Thu, 23 Mar 2023 12:24:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D0F3E8401D Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 6A36E1BF31C for ; Thu, 23 Mar 2023 12:24:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3F44C61513 for ; Thu, 23 Mar 2023 12:24:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3F44C61513 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8SLFaOw4Ws_a for ; Thu, 23 Mar 2023 12:24:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 71D9760BA1 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by smtp3.osuosl.org (Postfix) with ESMTPS id 71D9760BA1 for ; Thu, 23 Mar 2023 12:24:39 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="319125404" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="319125404" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 05:24:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="751473403" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="751473403" Received: from nimitz.igk.intel.com ([10.102.21.231]) by fmsmga004.fm.intel.com with ESMTP; 23 Mar 2023 05:24:36 -0700 From: Piotr Raczynski To: intel-wired-lan@lists.osuosl.org Date: Thu, 23 Mar 2023 13:24:32 +0100 Message-Id: <20230323122440.3419214-1-piotr.raczynski@intel.com> X-Mailer: git-send-email 2.38.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=1679574279; x=1711110279; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KzypomFxL15apBBXD/5Xa0boiHfrwj2pW771cVjftAQ=; b=VInrxzG8U8zxHI7kvcfd8X4jjacjwzGkq8cCn6RBykR0Iu5XNRcRa2wB iMXJD1pWY3KfjtVrcf+YXXbHdH88VRWiQLT/xHzx0FNEQuYhOWIrB/Dpl lGknlHi9pzfqRY8vV0EzseuJAjnNuL+upXqrqdDPaL6kDvd3LSeiAEkbt EEOtB5lpEbMKr3nDOfvm29vMx5jVIRLbBBYSAQLhxx/O7ZuYAhrlupMkC TBmpSn43TRakzF2cDwapCgajFkGdBzLRSalSKftJvN07Xz5k9Kvntb+Vu XV8TuVxKkLLJhbhjdy+ILG4OewRH/E7pFKi18BRbWB77X6BGmMrVjMk9Z A==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VInrxzG8 Subject: [Intel-wired-lan] [PATCH net-next v3 0/8] ice: support dynamic interrupt allocation 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: michal.swiatkowski@intel.com, netdev@vger.kernel.org, jesse.brandeburg@intel.com, shiraz.saleem@intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This patchset reimplements MSIX interrupt allocation logic to allow dynamic interrupt allocation after MSIX has been initially enabled. This allows current and future features to allocate and free interrupts as needed and will help to drastically decrease number of initially preallocated interrupts (even down to the API hard limit of 1). Although this patchset does not change behavior in terms of actual number of allocated interrupts during probe, it will be subject to change. First few patches prepares to introduce dynamic allocation by moving interrupt allocation code to separate file and update allocation API used in the driver to the currently preferred one. Due to the current contract between ice and irdma driver which is directly accessing msix entries allocated by ice driver, even after moving away from older pci_enable_msix_range function, still keep msix_entries array for irdma use. Next patches refactors and removes redundant code from SRIOV related logic as it also make it easier to move away from static allocation scheme. Last patches actually enables dynamic allocation of MSIX interrupts. First, introduce functions to allocate and free interrupts individually. This sets ground for the rest of the changes even if that patch still allocates the interrupts from the preallocated pool. Since this patch starts to keep interrupt details in ice_q_vector structure we can get rid of functions that calculates base vector number and register offset for the interrupt as it is equal to the interrupt index. Only keep separate register offset functions for the VF VSIs. Next, replace homegrown interrupt tracker with much simpler xarray based approach. As new API always allocate interrupts one by one, also track interrupts in the same manner. Lastly, extend the interrupt tracker to deal both with preallocated and dynamically allocated vectors and use pci_msix_alloc_irq_at and pci_msix_free_irq functions. Since not all architecture supports dynamic allocation, check it before trying to allocate a new interrupt. As previously mentioned, this patchset does not change number of initially allocated interrupts during init phase but now it can and will likely be changed. Patch 1-3 -> move code around and use newer API Patch 4-5 -> refactor and remove redundant SRIOV code Patch 6 -> allocate every interrupt individually Patch 7 -> replace homegrown interrupt tracker with xarray Patch 8 -> allow dynamic interrupt allocation Change history: v1 -> v2: - ice: refactor VF control VSI interrupt handling - move ice_get_vf_ctrl_vsi to ice_lib.c (ice_vf_lib.c depends on CONFIG_PCI_IOV) v2 -> v3: - ice: refactor VF control VSI interrupt handling - revert v2 change and add no-op function in case of CONFIG_PCI_IOV=n - ice: add dynamic interrupt allocation - fix commit message Piotr Raczynski (8): ice: move interrupt related code to separate file ice: use pci_irq_vector helper function ice: use preferred MSIX allocation api ice: refactor VF control VSI interrupt handling ice: remove redundant SRIOV code ice: add individual interrupt allocation ice: track interrupt vectors with xarray ice: add dynamic interrupt allocation drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 24 +- drivers/net/ethernet/intel/ice/ice_arfs.c | 5 +- drivers/net/ethernet/intel/ice/ice_base.c | 36 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_idc.c | 54 ++- drivers/net/ethernet/intel/ice/ice_irq.c | 377 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_irq.h | 25 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 288 +------------- drivers/net/ethernet/intel/ice/ice_lib.h | 5 - drivers/net/ethernet/intel/ice/ice_main.c | 268 ++----------- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 43 +-- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 32 ++ drivers/net/ethernet/intel/ice/ice_vf_lib.h | 7 + drivers/net/ethernet/intel/ice/ice_xsk.c | 5 +- 16 files changed, 557 insertions(+), 617 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_irq.c create mode 100644 drivers/net/ethernet/intel/ice/ice_irq.h -- 2.38.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2CEFC6FD1D for ; Thu, 23 Mar 2023 12:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231158AbjCWMYm (ORCPT ); Thu, 23 Mar 2023 08:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjCWMYk (ORCPT ); Thu, 23 Mar 2023 08:24:40 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0807C3C23 for ; Thu, 23 Mar 2023 05:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679574279; x=1711110279; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KzypomFxL15apBBXD/5Xa0boiHfrwj2pW771cVjftAQ=; b=VInrxzG8U8zxHI7kvcfd8X4jjacjwzGkq8cCn6RBykR0Iu5XNRcRa2wB iMXJD1pWY3KfjtVrcf+YXXbHdH88VRWiQLT/xHzx0FNEQuYhOWIrB/Dpl lGknlHi9pzfqRY8vV0EzseuJAjnNuL+upXqrqdDPaL6kDvd3LSeiAEkbt EEOtB5lpEbMKr3nDOfvm29vMx5jVIRLbBBYSAQLhxx/O7ZuYAhrlupMkC TBmpSn43TRakzF2cDwapCgajFkGdBzLRSalSKftJvN07Xz5k9Kvntb+Vu XV8TuVxKkLLJhbhjdy+ILG4OewRH/E7pFKi18BRbWB77X6BGmMrVjMk9Z A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="319125403" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="319125403" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 05:24:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="751473403" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="751473403" Received: from nimitz.igk.intel.com ([10.102.21.231]) by fmsmga004.fm.intel.com with ESMTP; 23 Mar 2023 05:24:36 -0700 From: Piotr Raczynski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, michal.swiatkowski@intel.com, shiraz.saleem@intel.com, jacob.e.keller@intel.com, sridhar.samudrala@intel.com, jesse.brandeburg@intel.com, aleksander.lobakin@intel.com, lukasz.czapnik@intel.com, Piotr Raczynski Subject: [PATCH net-next v3 0/8] ice: support dynamic interrupt allocation Date: Thu, 23 Mar 2023 13:24:32 +0100 Message-Id: <20230323122440.3419214-1-piotr.raczynski@intel.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patchset reimplements MSIX interrupt allocation logic to allow dynamic interrupt allocation after MSIX has been initially enabled. This allows current and future features to allocate and free interrupts as needed and will help to drastically decrease number of initially preallocated interrupts (even down to the API hard limit of 1). Although this patchset does not change behavior in terms of actual number of allocated interrupts during probe, it will be subject to change. First few patches prepares to introduce dynamic allocation by moving interrupt allocation code to separate file and update allocation API used in the driver to the currently preferred one. Due to the current contract between ice and irdma driver which is directly accessing msix entries allocated by ice driver, even after moving away from older pci_enable_msix_range function, still keep msix_entries array for irdma use. Next patches refactors and removes redundant code from SRIOV related logic as it also make it easier to move away from static allocation scheme. Last patches actually enables dynamic allocation of MSIX interrupts. First, introduce functions to allocate and free interrupts individually. This sets ground for the rest of the changes even if that patch still allocates the interrupts from the preallocated pool. Since this patch starts to keep interrupt details in ice_q_vector structure we can get rid of functions that calculates base vector number and register offset for the interrupt as it is equal to the interrupt index. Only keep separate register offset functions for the VF VSIs. Next, replace homegrown interrupt tracker with much simpler xarray based approach. As new API always allocate interrupts one by one, also track interrupts in the same manner. Lastly, extend the interrupt tracker to deal both with preallocated and dynamically allocated vectors and use pci_msix_alloc_irq_at and pci_msix_free_irq functions. Since not all architecture supports dynamic allocation, check it before trying to allocate a new interrupt. As previously mentioned, this patchset does not change number of initially allocated interrupts during init phase but now it can and will likely be changed. Patch 1-3 -> move code around and use newer API Patch 4-5 -> refactor and remove redundant SRIOV code Patch 6 -> allocate every interrupt individually Patch 7 -> replace homegrown interrupt tracker with xarray Patch 8 -> allow dynamic interrupt allocation Change history: v1 -> v2: - ice: refactor VF control VSI interrupt handling - move ice_get_vf_ctrl_vsi to ice_lib.c (ice_vf_lib.c depends on CONFIG_PCI_IOV) v2 -> v3: - ice: refactor VF control VSI interrupt handling - revert v2 change and add no-op function in case of CONFIG_PCI_IOV=n - ice: add dynamic interrupt allocation - fix commit message Piotr Raczynski (8): ice: move interrupt related code to separate file ice: use pci_irq_vector helper function ice: use preferred MSIX allocation api ice: refactor VF control VSI interrupt handling ice: remove redundant SRIOV code ice: add individual interrupt allocation ice: track interrupt vectors with xarray ice: add dynamic interrupt allocation drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 24 +- drivers/net/ethernet/intel/ice/ice_arfs.c | 5 +- drivers/net/ethernet/intel/ice/ice_base.c | 36 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_idc.c | 54 ++- drivers/net/ethernet/intel/ice/ice_irq.c | 377 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_irq.h | 25 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 288 +------------- drivers/net/ethernet/intel/ice/ice_lib.h | 5 - drivers/net/ethernet/intel/ice/ice_main.c | 268 ++----------- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 43 +-- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 32 ++ drivers/net/ethernet/intel/ice/ice_vf_lib.h | 7 + drivers/net/ethernet/intel/ice/ice_xsk.c | 5 +- 16 files changed, 557 insertions(+), 617 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_irq.c create mode 100644 drivers/net/ethernet/intel/ice/ice_irq.h -- 2.38.1