From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 394834404F; Wed, 12 Jun 2024 17:14:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 470E642E8B; Wed, 12 Jun 2024 17:05:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 6855942E56 for ; Wed, 12 Jun 2024 17:05:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204712; x=1749740712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=myVKg+01EL+53umm6vBegBrSDq8HKQ5DdoL01sEB8jg=; b=LDYq4q9j0v/mEXKiG7SHf5wifg7lVQgkLcghEvP2jO0co2eSe2Ir9liz 3rBXGV2G1ZsMeWt30TiMG9ek5IrXJcRXZad+OtCxRiR27ORFwrhUMUFTw NdniztmLwk+ZwWGsCs4HrUwOSWoABrkMVPQWrXw/zg7XsQW2a/3vxmh3X xSkzrXzlsfZpOJ8v5AUQBXoFcOjhDUxtmp+av+EcQF0W+JkoZIeGOFP7O +iZOSfPozlYMkPIuq46WZmggvG9B7PXdrkiXusfRledxIIsGPtjdKkSea xqEZkuXjbXD8IcCWgUeDY04DgymUMKlYJBaVK/P2afAAcqzEGucfhzim9 Q==; X-CSE-ConnectionGUID: NglKyqgCQtS8zfbWy9K4qw== X-CSE-MsgGUID: Dp3z8XudSzKJQL5ni+765g== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459587" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459587" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:05:07 -0700 X-CSE-ConnectionGUID: mNb8QXQ7QbS0eAfb2hNZrQ== X-CSE-MsgGUID: EK/McVOTR86TvmMJnWJaIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925456" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:05:05 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Jacob Keller Subject: [PATCH v2 065/148] net/ice/base: rename netlist check functions to match upstream Date: Wed, 12 Jun 2024 16:00:59 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ian Stokes The driver checks the netlist for nodes indicating hardware support using functions named "ice_is__present" sometimes with an additional _e810t postfix. These functions check the contents of the netlist, and don't make any direct device ID check. When upstreaming the functions, the names were changed to use the form "ice_is__in_netlist" and removed all the device postfixes. Rename these functions to match. Signed-off-by: Jacob Keller Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_adminq_cmd.h | 4 +- drivers/net/ice/base/ice_common.c | 220 ++++++++++++++------------ drivers/net/ice/base/ice_common.h | 1 + drivers/net/ice/base/ice_ptp_hw.c | 17 +- drivers/net/ice/base/ice_ptp_hw.h | 1 - 5 files changed, 124 insertions(+), 119 deletions(-) diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h index 04a0b1cf9b..8c62683731 100644 --- a/drivers/net/ice/base/ice_adminq_cmd.h +++ b/drivers/net/ice/base/ice_adminq_cmd.h @@ -1731,8 +1731,8 @@ struct ice_aqc_link_topo_addr { struct ice_aqc_get_link_topo { struct ice_aqc_link_topo_addr addr; u8 node_part_num; -#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575 0x21 -#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_GPS 0x48 +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21 +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS 0x48 u8 rsvd[9]; }; diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index e48085106c..82783cfecd 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -7,6 +7,7 @@ #include "ice_adminq_cmd.h" #include "ice_flow.h" +#include "ice_ptp_hw.h" #include "ice_switch.h" #define ICE_PF_RESET_WAIT_COUNT 300 @@ -565,106 +566,6 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, return status; } -/** - * ice_aq_get_netlist_node_pin - * @hw: pointer to the hw struct - * @cmd: get_link_topo_pin AQ structure - * @node_handle: output node handle parameter if node found - */ -int -ice_aq_get_netlist_node_pin(struct ice_hw *hw, - struct ice_aqc_get_link_topo_pin *cmd, - u16 *node_handle) -{ - struct ice_aq_desc desc; - - ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo_pin); - desc.params.get_link_topo_pin = *cmd; - - if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL)) - return ICE_ERR_NOT_SUPPORTED; - - if (node_handle) - *node_handle = - LE16_TO_CPU(desc.params.get_link_topo_pin.addr.handle); - - return 0; -} - -/** - * ice_aq_get_netlist_node - * @hw: pointer to the hw struct - * @cmd: get_link_topo AQ structure - * @node_part_number: output node part number if node found - * @node_handle: output node handle parameter if node found - */ -int -ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, - u8 *node_part_number, u16 *node_handle) -{ - struct ice_aq_desc desc; - - ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo); - desc.params.get_link_topo = *cmd; - - if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL)) - return ICE_ERR_NOT_SUPPORTED; - - if (node_handle) - *node_handle = - LE16_TO_CPU(desc.params.get_link_topo.addr.handle); - if (node_part_number) - *node_part_number = desc.params.get_link_topo.node_part_num; - - return 0; -} - -#define MAX_NETLIST_SIZE 10 -/** - * ice_find_netlist_node - * @hw: pointer to the hw struct - * @node_type_ctx: type of netlist node to look for - * @node_part_number: node part number to look for - * @node_handle: output parameter if node found - optional - * - * Find and return the node handle for a given node type and part number in the - * netlist. When found 0 is returned, ICE_ERR_DOES_NOT_EXIST - * otherwise. If node_handle provided, it would be set to found node handle. - */ -int -ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, - u16 *node_handle) -{ - struct ice_aqc_get_link_topo cmd; - u8 rec_node_part_number; - u16 rec_node_handle; - u8 idx; - - for (idx = 0; idx < MAX_NETLIST_SIZE; idx++) { - int status; - - memset(&cmd, 0, sizeof(cmd)); - - cmd.addr.topo_params.node_type_ctx = - (node_type_ctx << ICE_AQC_LINK_TOPO_NODE_TYPE_S); - cmd.addr.topo_params.index = idx; - - status = ice_aq_get_netlist_node(hw, &cmd, - &rec_node_part_number, - &rec_node_handle); - if (status) - return status; - - if (rec_node_part_number == node_part_number) { - if (node_handle) - *node_handle = rec_node_handle; - return 0; - } - } - - return ICE_ERR_DOES_NOT_EXIST; -} - /** * ice_aq_get_link_info * @pi: port information structure @@ -2960,6 +2861,125 @@ 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_aq_get_netlist_node_pin + * @hw: pointer to the hw struct + * @cmd: get_link_topo_pin AQ structure + * @node_handle: output node handle parameter if node found + */ +int +ice_aq_get_netlist_node_pin(struct ice_hw *hw, + struct ice_aqc_get_link_topo_pin *cmd, + u16 *node_handle) +{ + struct ice_aq_desc desc; + + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo_pin); + desc.params.get_link_topo_pin = *cmd; + + if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL)) + return ICE_ERR_NOT_SUPPORTED; + + if (node_handle) + *node_handle = + LE16_TO_CPU(desc.params.get_link_topo_pin.addr.handle); + + cmd->output_io_params = desc.params.get_link_topo_pin.output_io_params; + cmd->output_io_flags = desc.params.get_link_topo_pin.output_io_flags; + + return 0; +} + +/** + * ice_aq_get_netlist_node + * @hw: pointer to the hw struct + * @cmd: get_link_topo AQ structure + * @node_part_number: output node part number if node found + * @node_handle: output node handle parameter if node found + */ +int +ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, + u8 *node_part_number, u16 *node_handle) +{ + struct ice_aq_desc desc; + + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo); + desc.params.get_link_topo = *cmd; + + if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL)) + return ICE_ERR_NOT_SUPPORTED; + + if (node_handle) + *node_handle = + LE16_TO_CPU(desc.params.get_link_topo.addr.handle); + if (node_part_number) + *node_part_number = desc.params.get_link_topo.node_part_num; + + return 0; +} + +#define MAX_NETLIST_SIZE 10 +/** + * ice_find_netlist_node + * @hw: pointer to the hw struct + * @node_type_ctx: type of netlist node to look for + * @node_part_number: node part number to look for + * @node_handle: output parameter if node found - optional + * + * Scan the netlist for a node handle of the given node type and part number. + * + * If node_handle is non-NULL it will be modified on function exit. It is only + * valid if the function returns zero, and should be ignored on any non-zero + * return value. + * + * Returns: 0 if the node is found, ICE_ERR_DOES_NOT_EXIST if no handle was + * found, and an error code on failure to access the AQ. + */ +int +ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, + u16 *node_handle) +{ + u8 idx; + + for (idx = 0; idx < MAX_NETLIST_SIZE; idx++) { + struct ice_aqc_get_link_topo cmd; + u8 rec_node_part_number; + int status; + + memset(&cmd, 0, sizeof(cmd)); + + cmd.addr.topo_params.node_type_ctx = + (node_type_ctx << ICE_AQC_LINK_TOPO_NODE_TYPE_S); + cmd.addr.topo_params.index = idx; + + status = ice_aq_get_netlist_node(hw, &cmd, + &rec_node_part_number, + node_handle); + if (status) + return status; + + if (rec_node_part_number == node_part_number) + return 0; + } + + return ICE_ERR_DOES_NOT_EXIST; +} + +/** + * ice_is_gps_in_netlist + * @hw: pointer to the hw struct + * + * Check if the GPS generic device is present in the netlist + */ +bool ice_is_gps_in_netlist(struct ice_hw *hw) +{ + if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_GPS, + ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL)) + return false; + + return true; +} + /** * ice_aq_list_caps - query function/device capabilities * @hw: pointer to the HW struct diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h index 14620d05b4..882359f5e3 100644 --- a/drivers/net/ice/base/ice_common.h +++ b/drivers/net/ice/base/ice_common.h @@ -159,6 +159,7 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, u16 *node_handle); +bool ice_is_gps_in_netlist(struct ice_hw *hw); void ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high, u16 link_speeds_bitmap); diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index 237c9ffa94..ab18169529 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -4979,7 +4979,7 @@ ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle) return ICE_ERR_NOT_SUPPORTED; /* Verify if we found the right IO expander type */ - if (node_part_number != ICE_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575) + if (node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575) return ICE_ERR_NOT_SUPPORTED; /* If present save the handle and return it */ @@ -4989,21 +4989,6 @@ ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle) return 0; } -/** - * ice_is_gps_present_e810t - * @hw: pointer to the hw struct - * - * Check if the GPS generic device is present in the netlist - */ -bool ice_is_gps_present_e810t(struct ice_hw *hw) -{ - if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_GPS, - ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL)) - return false; - - return true; -} - /** * ice_read_sma_ctrl_e810t * @hw: pointer to the hw struct diff --git a/drivers/net/ice/base/ice_ptp_hw.h b/drivers/net/ice/base/ice_ptp_hw.h index be62e594bc..7fe250c541 100644 --- a/drivers/net/ice/base/ice_ptp_hw.h +++ b/drivers/net/ice/base/ice_ptp_hw.h @@ -255,7 +255,6 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port); int ice_phy_exit_bypass_e822(struct ice_hw *hw, u8 port); /* E810 family functions */ -bool ice_is_gps_present_e810t(struct ice_hw *hw); int ice_ptp_init_phy_e810(struct ice_hw *hw); int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data); -- 2.43.0