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 681BB45501; Wed, 26 Jun 2024 14:06:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83FE3434AE; Wed, 26 Jun 2024 13:57:30 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 1AC8342E95 for ; Wed, 26 Jun 2024 13:45:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719402344; x=1750938344; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=svcYp+OFdLtPFmFBY48Ew97KwKymJ8W0C/34wbRHhUo=; b=ROlLXn/9POTTiK+zc0Naa05oX4xwtG7GKuC9g3VX9WKz0xHKJZtGkqil NLut4omwdcCq2WfrEIhA6/G+tdYWZ9+zf8aQBFSdUGutPh9ZUbfVsXm9m 7EPUae8S8ry3GufJxCOZSjllXU1OdAkcW33S4Sj3lL5CSpHruJ2APpcyI 5UYGM8KtiaYDQkIWUdH7tGOUoIhKlCR+QTCc1ANe240++oqsBVolSmJEi fvoI9IZ8Y2lzLNAMbzyOS71b5DxgNJuUXN5Pdb+aN2jituJzQAYLaQcRs reza2b/gudS8K97OKrE1xViaLPKjX2V3iIKvB1KQ0tVGYAEuL4G+pSIyK w==; X-CSE-ConnectionGUID: LLarirIbQ+CLPxvPXFp4VQ== X-CSE-MsgGUID: kstaxcSdTq61g/1bNGDLCQ== X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="38979609" X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="38979609" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2024 04:45:43 -0700 X-CSE-ConnectionGUID: qMGR5qmQRamKDP0scS0qTw== X-CSE-MsgGUID: Ho/ZX66FS36ltvFNPWJtCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="43874646" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa010.jf.intel.com with ESMTP; 26 Jun 2024 04:45:43 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: ian.stokes@intel.com, bruce.richardson@intel.com Subject: [PATCH v4 096/103] net/ice/base: make is_gps_present more generic Date: Wed, 26 Jun 2024 12:42:24 +0100 Message-ID: <911216be79c4cd096bde8a9df7346b425492c270.1719401848.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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 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 to Linux, the name was changed to use the form "ice_is__in_netlist" and removed all the device postfixes. Rename this function to match, as well as update code style. Signed-off-by: Jacob Keller Signed-off-by: Ian Stokes Signed-off-by: Anatoly Burakov --- drivers/net/ice/base/ice_common.c | 39 ++++++++++++++++++++++--------- drivers/net/ice/base/ice_common.h | 1 + drivers/net/ice/base/ice_ptp_hw.c | 15 ------------ drivers/net/ice/base/ice_ptp_hw.h | 1 - 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index 9a61c1357d..fed499f449 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 500 @@ -655,20 +656,24 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, * @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. + * 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) { - 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++) { + struct ice_aqc_get_link_topo cmd; + u8 rec_node_part_number; int status; memset(&cmd, 0, sizeof(cmd)); @@ -679,20 +684,32 @@ ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, status = ice_aq_get_netlist_node(hw, &cmd, &rec_node_part_number, - &rec_node_handle); + node_handle); if (status) return status; - if (rec_node_part_number == node_part_number) { - if (node_handle) - *node_handle = rec_node_handle; + 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_get_link_info * @pi: port information structure diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h index 51710f9c8b..684d76d9a0 100644 --- a/drivers/net/ice/base/ice_common.h +++ b/drivers/net/ice/base/ice_common.h @@ -169,6 +169,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 50ffa7b796..7d06287a2d 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -5253,21 +5253,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_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL)) - return false; - - return true; -} - /** * ice_read_pca9575_reg_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 c4a5c030f1..fb56d76e98 100644 --- a/drivers/net/ice/base/ice_ptp_hw.h +++ b/drivers/net/ice/base/ice_ptp_hw.h @@ -277,7 +277,6 @@ int ice_phy_cfg_intr_e822(struct ice_hw *hw, u8 quad, bool ena, u8 threshold); /* 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