From patchwork Wed Oct 2 11:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 1991989 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=Xsl7RD1O; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJY9Q47s7z1xtn for ; Wed, 2 Oct 2024 21:53:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DEBA081FD2; Wed, 2 Oct 2024 11:53:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id akRJDSiWH6d3; Wed, 2 Oct 2024 11:53:26 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0DB678128F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1727870006; bh=HF8udMa00z7v11B5CDpbAWW77Zzp7RcRYUyBboSt4G4=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Xsl7RD1Ovu02IZhqB7e7oiinLv8A04IFIYogtyi56Z+JxMhkGJEh1cw7oykuUdK3w /3SL7m025bQCy8/QnGCUDNsgrxMzU6uIt9QrKRLh998pdCfT0KF1JZe3CtjGTalY70 6nvAcYHZtkT+PkAcZZMqNXcUZEbl8fwzZuXkDOdPJRn6bUONEgO44G4XBOktikQ3UW p4nIfuW5F1CjUXy7Y9P9wUxqzsPbCR3U4m4QEva5IvlR5ENdw5i5jiMDDHo1v5WFhR gdHVROA/Y8rL7WVdpz+zWU1pJhSbPQO1oloHIEXZBi2GBzlrdvoG9p7+d3HQBZ3x3d 2+ayimV3pjeHQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 0DB678128F; Wed, 2 Oct 2024 11:53:26 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id CD7111BF293 for ; Wed, 2 Oct 2024 11:53:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C7F0C40DAB for ; Wed, 2 Oct 2024 11:53:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gtnLZ-v9Rj6R for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 8C61240D93 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8C61240D93 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8C61240D93 for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) X-CSE-ConnectionGUID: o6bBbuLKSuqqNhVhYC2bUw== X-CSE-MsgGUID: lkPKauk7SjSt8VX8uordCA== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="27183851" X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="27183851" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2024 04:53:20 -0700 X-CSE-ConnectionGUID: ZCKoxdE6RLuLh2zwd/wlIQ== X-CSE-MsgGUID: 7re44d5KTUutxli8V8QBPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="78396380" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 02 Oct 2024 04:53:17 -0700 Received: from pkitszel-desk.intel.com (unknown [10.245.246.21]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 02FF027BDE; Wed, 2 Oct 2024 12:53:15 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Date: Wed, 2 Oct 2024 13:50:21 +0200 Message-ID: <20241002115304.15127-7-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> References: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> 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=1727870001; x=1759406001; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SvXTULnSI2SizGjm07lIlC/a83Bu+y0MMMCyXo7mogM=; b=M8EDO+tY6AIoBme5a15HYWvxwldHI60Uw9QyRoupMPlbgk5kUtNyz8hh 7PZu9XtjtT4F90bcpZ8FAbVdfxFZ9GyPgJIVcOMZ72veRd7Vhrt0kBG7V KrCBRt22pKU/+zxsqqRpQ6HPgFxLHyTG8v3n7sZRdfRv8pHrArHi4gzUr bGod1J1dVY4EWunYpL9lDQtdRKqdZe+V0jAIOWqOXX1DB9I506SzPhchA pssZLrc70sJApma84NrYGDuC/a9t7Tw4LX9s8SfQnvdhMlvuR88naofIR sjGyb6c0vVXdZg/cpIxCRbPjnYLB4LzAfnKUD+TOv+j9YvlMrf1lYyOkF w==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M8EDO+tY Subject: [Intel-wired-lan] [PATCH iwl-next 1/4] ice: c827: move wait for FW to ice_init_hw() 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: netdev@vger.kernel.org, Arkadiusz Kubalewski , Marcin Szycik , Przemek Kitszel Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Move call to ice_wait_for_fw() from ice_init_dev() into ice_init_hw(), where it fits better. This requires also to move ice_wait_for_fw() to ice_common.c. ice_is_pf_c827() is now used only in ice_common.c, so it could be static. CC: Arkadiusz Kubalewski Reviewed-by: Marcin Szycik Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/ice_common.h | 1 - drivers/net/ethernet/intel/ice/ice_common.c | 110 +++++++++++++------- drivers/net/ethernet/intel/ice/ice_main.c | 37 ------- 3 files changed, 75 insertions(+), 73 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index 27208a60cece..3b739a7fe498 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -113,7 +113,6 @@ int ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, struct ice_aqc_get_phy_caps_data *caps, struct ice_sq_cd *cd); -bool ice_is_pf_c827(struct ice_hw *hw); bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw); bool ice_is_clock_mux_in_netlist(struct ice_hw *hw); bool ice_is_cgu_in_netlist(struct ice_hw *hw); diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 009716a12a26..85057eb42545 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -307,6 +307,42 @@ bool ice_is_e825c(struct ice_hw *hw) } } +/** + * ice_is_pf_c827 - check if pf contains c827 phy + * @hw: pointer to the hw struct + * + * Return: true if the device has c827 phy. + */ +static bool ice_is_pf_c827(struct ice_hw *hw) +{ + struct ice_aqc_get_link_topo cmd = {}; + u8 node_part_number; + u16 node_handle; + int status; + + if (hw->mac_type != ICE_MAC_E810) + return false; + + if (hw->device_id != ICE_DEV_ID_E810C_QSFP) + return true; + + cmd.addr.topo_params.node_type_ctx = + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY) | + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_CTX_M, ICE_AQC_LINK_TOPO_NODE_CTX_PORT); + cmd.addr.topo_params.index = 0; + + status = ice_aq_get_netlist_node(hw, &cmd, &node_part_number, + &node_handle); + + if (status || node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_C827) + return false; + + if (node_handle == E810C_QSFP_C827_0_HANDLE || node_handle == E810C_QSFP_C827_1_HANDLE) + return true; + + return false; +} + /** * ice_clear_pf_cfg - Clear PF configuration * @hw: pointer to the hardware structure @@ -1021,6 +1057,33 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) } } +/** + * ice_wait_for_fw - wait for full FW readiness + * @hw: pointer to the hardware structure + * @timeout: milliseconds that can elapse before timing out + * + * Return: 0 on success, -ETIMEDOUT on timeout. + */ +static int ice_wait_for_fw(struct ice_hw *hw, u32 timeout) +{ + int fw_loading; + u32 elapsed = 0; + + while (elapsed <= timeout) { + fw_loading = rd32(hw, GL_MNG_FWSM) & GL_MNG_FWSM_FW_LOADING_M; + + /* firmware was not yet loaded, we have to wait more */ + if (fw_loading) { + elapsed += 100; + msleep(100); + continue; + } + return 0; + } + + return -ETIMEDOUT; +} + /** * ice_init_hw - main hardware initialization routine * @hw: pointer to the hardware structure @@ -1170,8 +1233,19 @@ int ice_init_hw(struct ice_hw *hw) mutex_init(&hw->tnl_lock); ice_init_chk_recipe_reuse_support(hw); - return 0; + /* Some cards require longer initialization times + * due to necessity of loading FW from an external source. + * This can take even half a minute. + */ + if (ice_is_pf_c827(hw)) { + status = ice_wait_for_fw(hw, 30000); + if (status) { + dev_err(ice_hw_to_dev(hw), "ice_wait_for_fw timed out"); + goto err_unroll_fltr_mgmt_struct; + } + } + return 0; err_unroll_fltr_mgmt_struct: ice_cleanup_fltr_mgmt_struct(hw); err_unroll_sched: @@ -2684,40 +2758,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p, ice_recalc_port_limited_caps(hw, &dev_p->common_cap); } -/** - * ice_is_pf_c827 - check if pf contains c827 phy - * @hw: pointer to the hw struct - */ -bool ice_is_pf_c827(struct ice_hw *hw) -{ - struct ice_aqc_get_link_topo cmd = {}; - u8 node_part_number; - u16 node_handle; - int status; - - if (hw->mac_type != ICE_MAC_E810) - return false; - - if (hw->device_id != ICE_DEV_ID_E810C_QSFP) - return true; - - cmd.addr.topo_params.node_type_ctx = - FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY) | - FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_CTX_M, ICE_AQC_LINK_TOPO_NODE_CTX_PORT); - cmd.addr.topo_params.index = 0; - - status = ice_aq_get_netlist_node(hw, &cmd, &node_part_number, - &node_handle); - - if (status || node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_C827) - return false; - - if (node_handle == E810C_QSFP_C827_0_HANDLE || node_handle == E810C_QSFP_C827_1_HANDLE) - return true; - - return false; -} - /** * ice_is_phy_rclk_in_netlist * @hw: pointer to the hw struct diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 2fafb56728b2..53479b729492 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4747,31 +4747,6 @@ static void ice_decfg_netdev(struct ice_vsi *vsi) vsi->netdev = NULL; } -/** - * ice_wait_for_fw - wait for full FW readiness - * @hw: pointer to the hardware structure - * @timeout: milliseconds that can elapse before timing out - */ -static int ice_wait_for_fw(struct ice_hw *hw, u32 timeout) -{ - int fw_loading; - u32 elapsed = 0; - - while (elapsed <= timeout) { - fw_loading = rd32(hw, GL_MNG_FWSM) & GL_MNG_FWSM_FW_LOADING_M; - - /* firmware was not yet loaded, we have to wait more */ - if (fw_loading) { - elapsed += 100; - msleep(100); - continue; - } - return 0; - } - - return -ETIMEDOUT; -} - int ice_init_dev(struct ice_pf *pf) { struct device *dev = ice_pf_to_dev(pf); @@ -4784,18 +4759,6 @@ int ice_init_dev(struct ice_pf *pf) return err; } - /* Some cards require longer initialization times - * due to necessity of loading FW from an external source. - * This can take even half a minute. - */ - if (ice_is_pf_c827(hw)) { - err = ice_wait_for_fw(hw, 30000); - if (err) { - dev_err(dev, "ice_wait_for_fw timed out"); - return err; - } - } - ice_init_feature_support(pf); err = ice_init_ddp_config(hw, pf); From patchwork Wed Oct 2 11:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 1991988 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=wmSZs9yC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJY9N1bSJz1xtn for ; Wed, 2 Oct 2024 21:53:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6E5FC81F16; Wed, 2 Oct 2024 11:53:23 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id WG52YV_DGq_e; Wed, 2 Oct 2024 11:53:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B50BA81F17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1727870002; bh=sWM85XkgNZVTM0pa+m/W9X5K7vmwV3tkTLmxAzKVNBY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=wmSZs9yCDhnuR/55G7l7LPJp+kaIFo0GOCOVgC/0qzZHB9pltJVAokSjsL5nHpQxV SWkyxl/7M9WQFatB+ieZbsZX2Xke1dPr8S3MWpl6GrAmo+Rb0TK+siOz/tSI2pUNFx yi9CTk+RgZQouTrkwY0i1CLnler41VhgC784DD/w8GqsQTlUWGafz3JJ+0M2hvp8PT Y5ulKUnwwj2vR8drUc5afk39k8Hy5nQhxoZXpy5ZSj1MOA5U2w+GN+F1WNe/J7jh0A Q4s/+0mjZRTOJ/a3RCykLttxwOnHOV384DLFORwVUA4I5c9zKRezVvlvodIXR4I9Qh 9Vdk7n6wOxfNQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id B50BA81F17; Wed, 2 Oct 2024 11:53:22 +0000 (UTC) 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 18C661BF293 for ; Wed, 2 Oct 2024 11:53:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D0AC681F15 for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xAAJYDwP_A6C for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org F0B0781F0E DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F0B0781F0E Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id F0B0781F0E for ; Wed, 2 Oct 2024 11:53:19 +0000 (UTC) X-CSE-ConnectionGUID: Lk0prZsWQcuY2B8dXvBf+w== X-CSE-MsgGUID: nLzFZ/JrTYWcwAFpJp0Abg== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="27183847" X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="27183847" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2024 04:53:20 -0700 X-CSE-ConnectionGUID: 2sLrcrDSQNavHLKzQ145kg== X-CSE-MsgGUID: 2iIkKckxRpyedwn5g9zzoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="78396376" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 02 Oct 2024 04:53:18 -0700 Received: from pkitszel-desk.intel.com (unknown [10.245.246.21]) by irvmail002.ir.intel.com (Postfix) with ESMTP id DD56128167; Wed, 2 Oct 2024 12:53:16 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Date: Wed, 2 Oct 2024 13:50:22 +0200 Message-ID: <20241002115304.15127-8-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> References: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> 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=1727870000; x=1759406000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gRLCXlAAXvMxcKis8qdtfZ4PICzp51CV5Rb+XWIMM08=; b=XPeGaq+fTXv9jnAj9rk6YJTZ0Jt75HNxPZBLme8PK/wsY5//olHV/VlR akAhzLUrQ20OnUlmqTJN32CTp1FfXaJm6+LoeLKRpETwGmN54UfVSFoU/ 7bwL83qqAxLt98K4ZXzVAd3GXQAvSxGwWQoj2w2VjXgSgmyOiUuRLAqL+ dTESD0skR3WppdGpCQW/FGD2kF/kQr5qzdMZyzhdDzd8XyUuO3f0kdxm1 0xBwkDcR+1+gC8xoY3ovmLY2QcMTx7073w+VhpzxInCRuDshS12MMXxoa JZzgMSwg4Ro4pqphDX6Di7OZR4wAUL5JthzE5mvapBozYlUaRZvV9cMwA Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=XPeGaq+f Subject: [Intel-wired-lan] [PATCH iwl-next 2/4] ice: split ice_init_hw() out from ice_init_dev() 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: netdev@vger.kernel.org, Marcin Szycik , Przemek Kitszel Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Split ice_init_hw() call out from ice_init_dev(). Such move enables pulling the former to be even earlier on call path, what would enable moving ice_adapter init to be between the two (in subsequent commit). Such move enables ice_adapter to know about number of PFs. Do the same for ice_deinit_hw(), so the init and deinit calls could be easily mirrored. Next commit will rename unrelated goto labels to unroll prefix. Reviewed-by: Marcin Szycik Signed-off-by: Przemek Kitszel Reviewed-by: Kalesh AP Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- .../net/ethernet/intel/ice/devlink/devlink.c | 10 ++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 22 +++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c index 415445cefdb2..24bb85dbfa86 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c @@ -1207,9 +1207,15 @@ static int ice_devlink_reinit_up(struct ice_pf *pf) struct ice_vsi *vsi = ice_get_main_vsi(pf); int err; + err = ice_init_hw(&pf->hw); + if (err) { + dev_err(ice_pf_to_dev(pf), "ice_init_hw failed: %d\n", err); + return err; + } + err = ice_init_dev(pf); if (err) - return err; + goto unroll_hw_init; vsi->flags = ICE_VSI_FLAG_INIT; @@ -1232,6 +1238,8 @@ static int ice_devlink_reinit_up(struct ice_pf *pf) rtnl_unlock(); err_vsi_cfg: ice_deinit_dev(pf); +unroll_hw_init: + ice_deinit_hw(&pf->hw); return err; } diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 53479b729492..f0903dddcb16 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4753,12 +4753,6 @@ int ice_init_dev(struct ice_pf *pf) struct ice_hw *hw = &pf->hw; int err; - err = ice_init_hw(hw); - if (err) { - dev_err(dev, "ice_init_hw failed: %d\n", err); - return err; - } - ice_init_feature_support(pf); err = ice_init_ddp_config(hw, pf); @@ -4779,7 +4773,7 @@ int ice_init_dev(struct ice_pf *pf) err = ice_init_pf(pf); if (err) { dev_err(dev, "ice_init_pf failed: %d\n", err); - goto err_init_pf; + return err; } pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port; @@ -4823,8 +4817,6 @@ int ice_init_dev(struct ice_pf *pf) ice_clear_interrupt_scheme(pf); err_init_interrupt_scheme: ice_deinit_pf(pf); -err_init_pf: - ice_deinit_hw(hw); return err; } @@ -5315,9 +5307,15 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) hw->debug_mask = debug; #endif + err = ice_init_hw(hw); + if (err) { + dev_err(dev, "ice_init_hw failed: %d\n", err); + goto unroll_adapter; + } + err = ice_init(pf); if (err) - goto err_init; + goto unroll_hw_init; devl_lock(priv_to_devlink(pf)); err = ice_load(pf); @@ -5336,7 +5334,9 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) err_load: devl_unlock(priv_to_devlink(pf)); ice_deinit(pf); -err_init: +unroll_hw_init: + ice_deinit_hw(hw); +unroll_adapter: ice_adapter_put(pdev); return err; } From patchwork Wed Oct 2 11:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 1991990 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=vk4Ke78I; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJY9S3Lvnz1xtn for ; Wed, 2 Oct 2024 21:53:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EF11D82036; Wed, 2 Oct 2024 11:53:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id e8diTRIlHHqZ; Wed, 2 Oct 2024 11:53:27 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 27C758128F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1727870007; bh=zkfRN1Rv/y6qbCsDr7VkvM12FEmgvMTZkAVnB/ciSsY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=vk4Ke78IguhrqLha0Xm5XKla6M4U0bFlF1s2HnsD6c0sFvT6qEiis6qB077ldQw+e Qo26zJ25c7M+XtyYZT74uVJkjsMnc40ZP9nFCEVzd9OwSecSNhzgfwl3aDVV9u5EAC N4IR/wtpe6ls9MdCAk1Pe95XKrQ/cXEqtNOCNpZ5OyAUcuvQG8Hn+7CYV2vy76vZQC mRNIfJx6MrBbX8ex95cmYWZDqh8pKCtas6JCVya6/D0fssITlLI0HSGQcCI4zvuyAs Zeslh3sQg2n3jEBasEicZxu/LzWRuSXmuiRtVIcYg6S3Mna8BPBM5wAOLcNkQ+yRAE /t1/bCTWf93cg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 27C758128F; Wed, 2 Oct 2024 11:53:27 +0000 (UTC) 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 29D1B1BF293 for ; Wed, 2 Oct 2024 11:53:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 23CE581F0E for ; Wed, 2 Oct 2024 11:53:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id nprxNFJnD3lA for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6A0908128A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6A0908128A Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6A0908128A for ; Wed, 2 Oct 2024 11:53:20 +0000 (UTC) X-CSE-ConnectionGUID: L6rr32g/RSm/UQ+JScq31w== X-CSE-MsgGUID: Vj2F8xSYRzWRXX4cSSiJDA== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="27183849" X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="27183849" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2024 04:53:20 -0700 X-CSE-ConnectionGUID: bvAv0O+2QdGaGgneUFgp5g== X-CSE-MsgGUID: eses7engRIu4gk5Hvao7yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="78396378" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 02 Oct 2024 04:53:19 -0700 Received: from pkitszel-desk.intel.com (unknown [10.245.246.21]) by irvmail002.ir.intel.com (Postfix) with ESMTP id ADDB428169; Wed, 2 Oct 2024 12:53:17 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Date: Wed, 2 Oct 2024 13:50:23 +0200 Message-ID: <20241002115304.15127-9-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> References: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> 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=1727870000; x=1759406000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q1yTIsduVqIOGDDgsfBNfMeoNAlnl+VRtH7v9641Hd0=; b=n4c4HoYbot4zOGhwSGemryRcwNltPK5WL5mwihZuOHcz5EKuTsnMbBfQ 05b3vLyTSEMzNqG7PNk5PH8ALLMz8jWUFTtuowlJmmUecqcV/QLHmvoUY HcqsWAvVnwvrYzdH1gIa6cizq91cKlvK4hQB9O+VaxRqbNOSsXg+9MSqe j1/Lg5InvsBjN4E8P9snXPcPWFQs7CUc2Ced8RxDFFxOrmygJFO0BJqwZ Gn5+Kz750uv2EOjl7eZaiphp2Rag9EtFztcW/6j3g78Nuhfxw58kdlfUe SVJWkA4nJrXlesf7pj9u2vlmSyvd+HX2be8MetnW9cqoC8KqcbpyZfwoE Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=n4c4HoYb Subject: [Intel-wired-lan] [PATCH iwl-next 3/4] ice: minor: rename goto labels from err to unroll 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: netdev@vger.kernel.org, Marcin Szycik , Przemek Kitszel Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Clean up goto labels after previous commit, to conform to single naming scheme in ice_probe() and ice_init_dev(). Reviewed-by: Marcin Szycik Signed-off-by: Przemek Kitszel Reviewed-by: Kalesh AP Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index f0903dddcb16..a043deccf038 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4797,7 +4797,7 @@ int ice_init_dev(struct ice_pf *pf) if (err) { dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err); err = -EIO; - goto err_init_interrupt_scheme; + goto unroll_pf_init; } /* In case of MSIX we are going to setup the misc vector right here @@ -4808,14 +4808,14 @@ int ice_init_dev(struct ice_pf *pf) err = ice_req_irq_msix_misc(pf); if (err) { dev_err(dev, "setup of misc vector failed: %d\n", err); - goto err_req_irq_msix_misc; + goto unroll_irq_scheme_init; } return 0; -err_req_irq_msix_misc: +unroll_irq_scheme_init: ice_clear_interrupt_scheme(pf); -err_init_interrupt_scheme: +unroll_pf_init: ice_deinit_pf(pf); return err; } @@ -5320,18 +5320,18 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) devl_lock(priv_to_devlink(pf)); err = ice_load(pf); if (err) - goto err_load; + goto unroll_init; err = ice_init_devlink(pf); if (err) - goto err_init_devlink; + goto unroll_load; devl_unlock(priv_to_devlink(pf)); return 0; -err_init_devlink: +unroll_load: ice_unload(pf); -err_load: +unroll_init: devl_unlock(priv_to_devlink(pf)); ice_deinit(pf); unroll_hw_init: From patchwork Wed Oct 2 11:50:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 1991991 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=h5F7JaoU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJY9V4n0Xz1xtn for ; Wed, 2 Oct 2024 21:53:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DACF38203E; Wed, 2 Oct 2024 11:53:28 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ZAwk0GAThVxE; Wed, 2 Oct 2024 11:53:28 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2EB3681FF0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1727870008; bh=/po4UHg6+FVc+bDGnzDTD+pU24IOhcJce0hf8snhtgY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=h5F7JaoUG6wRjTwtOIfyFDUeJIfCJgjasfPl8JCNExaZUafHfixDTQNxdRhOjbFSs I+CluLVHDpkGP10RI2tUShS41k+x0GwKWEtxwyT5rRJblAHqeH7Xg2bNsxhzdaBNNr ejNoHQoQAGCpozU0ZUz/HQ0tvwLyW92IFPjr8yEBOqHD+AvhQVmJK9+Rumdo/QJxM3 mYQqWq3REMYACRqwSCqqJ29SrEXKtPhKfpMvS4M9a2zIc6yVlYc6WZEENTJBwi0QLx SxNp8gv16JGAmNO34Qq3ZSHDHCQ9sspTsMFVvE4IhZByKG89PtYmurwoBrktjF8S5t gT929KQh0UCkA== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 2EB3681FF0; Wed, 2 Oct 2024 11:53:28 +0000 (UTC) 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 0964C1BF293 for ; Wed, 2 Oct 2024 11:53:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 95CFA81F23 for ; Wed, 2 Oct 2024 11:53:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UhxrrC9VEVD6 for ; Wed, 2 Oct 2024 11:53:22 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org E9AE681F17 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E9AE681F17 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id E9AE681F17 for ; Wed, 2 Oct 2024 11:53:21 +0000 (UTC) X-CSE-ConnectionGUID: BlEXGTuhQeWwbSxlcBjOxg== X-CSE-MsgGUID: JL44VaYyR32NAvFzVfPzfA== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="27183855" X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="27183855" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2024 04:53:21 -0700 X-CSE-ConnectionGUID: K4Q5q0PxQGiBWcdA7X5ymg== X-CSE-MsgGUID: TuvBr/TeSCeEf1bqV11oNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,171,1725346800"; d="scan'208";a="78396383" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 02 Oct 2024 04:53:20 -0700 Received: from pkitszel-desk.intel.com (unknown [10.245.246.21]) by irvmail002.ir.intel.com (Postfix) with ESMTP id CE5E628195; Wed, 2 Oct 2024 12:53:18 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Date: Wed, 2 Oct 2024 13:50:24 +0200 Message-ID: <20241002115304.15127-10-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> References: <20241002115304.15127-6-przemyslaw.kitszel@intel.com> 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=1727870002; x=1759406002; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lBVtk9x2YLfOlUE3TMNMHn5v07L1WswRQRfR62EXUtI=; b=ciUImlDIb7iMN3lyq10gf3/yELhzo0gMUjrjZ+O5e1WdJm/1cK4fzUmq vvoO7yS121BrLU+dnskRRQSn8ae9U7+sOOKOE9SO1/zlCDQiRR/vQRt0F JOxH/CpP3XchhvLLLQdFFl8apaN35JCF/iN62jBR87TGm+flgYafQecAr maCFxQMA6/deLK8NcoBAWhAjmpSc7cThwEdDOFrjo+C+1rRKE9ZEwh5iz zFZHT00BMFYxfci1KxNKC3RAWFcRWSP3vWJdMLhS502pdP1LrNSrSMjMW emBGpQCGh/BWXCcnITXZxZ1w1IissBrczmmX+fPgFgOM/bgWHOJJNSGCi A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=ciUImlDI Subject: [Intel-wired-lan] [PATCH iwl-next 4/4] ice: ice_probe: init ice_adapter after HW init 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: netdev@vger.kernel.org, Marcin Szycik , Przemek Kitszel Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Move ice_adapter initialization to be after HW init, so it could use HW capabilities, like number of PFs. This is needed for devlink-resource based RSS LUT size management for PF/VF (not in this series). Reviewed-by: Marcin Szycik Signed-off-by: Przemek Kitszel Reviewed-by: Kalesh AP Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/ice_main.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index a043deccf038..2b8db14d99f3 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5273,13 +5273,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) } pci_set_master(pdev); - - adapter = ice_adapter_get(pdev); - if (IS_ERR(adapter)) - return PTR_ERR(adapter); - pf->pdev = pdev; - pf->adapter = adapter; pci_set_drvdata(pdev, pf); set_bit(ICE_DOWN, pf->state); /* Disable service task until DOWN bit is cleared */ @@ -5310,12 +5304,19 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) err = ice_init_hw(hw); if (err) { dev_err(dev, "ice_init_hw failed: %d\n", err); - goto unroll_adapter; + return err; } + adapter = ice_adapter_get(pdev); + if (IS_ERR(adapter)) { + err = PTR_ERR(adapter); + goto unroll_hw_init; + } + pf->adapter = adapter; + err = ice_init(pf); if (err) - goto unroll_hw_init; + goto unroll_adapter; devl_lock(priv_to_devlink(pf)); err = ice_load(pf); @@ -5334,10 +5335,10 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) unroll_init: devl_unlock(priv_to_devlink(pf)); ice_deinit(pf); -unroll_hw_init: - ice_deinit_hw(hw); unroll_adapter: ice_adapter_put(pdev); +unroll_hw_init: + ice_deinit_hw(hw); return err; }