From patchwork Tue Sep 19 23:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 1836919 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=XFuJ2MQG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4Rqyh616Q7z1ynF for ; Wed, 20 Sep 2023 09:35:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9AD90417A0; Tue, 19 Sep 2023 23:35:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9AD90417A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1695166515; bh=dFphuWQoRNp0tYt7SOYJoBnJvTjjlrY0aPk1DmJeeVM=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=XFuJ2MQG+VDp6lH50uGa/e5ZS9eqaO7+XNuosBSvjDDOTRxtGNmf2Bd5nRyd2KW9X ipk5PzidZkaM60U/QKJON+YQcG8vTSHq4+pbh/PW0WdOZl3nixJ1nD0lMOQQReMaMt DNIoSLXrwPPtHgY8G6FAGBmMtlz9WLsfvtGhaA9q5RCNRwb5gFJdYnmT+TOmq+1Rww /IlM0jKBCCGT2cAR0wkavNi4WcMlxsJXY6JUWCi0GwefjgX0ieMRC+hrM1ixfTArFd d3FMULRfUbxsXFf2sOW+MoE8DN10niazMbSeGP73wea7vniJbn49+VPYE1n8H+a0ws GOeHcQStTTHLw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oyCHOBZp9Ydj; Tue, 19 Sep 2023 23:35:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id A462D417B5; Tue, 19 Sep 2023 23:35:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A462D417B5 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 4AC061BF407 for ; Tue, 19 Sep 2023 23:35:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 43C43417D0 for ; Tue, 19 Sep 2023 23:35:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 43C43417D0 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c9RJ26R8er0T for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2A85C41BEC for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2A85C41BEC X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="444172125" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="444172125" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="749668100" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="749668100" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.1]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 From: Jacob Keller To: Intel Wired LAN Date: Tue, 19 Sep 2023 16:34:32 -0700 Message-ID: <20230919233435.518620-2-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.41.0.1.g9857a21e0017.dirty In-Reply-To: <20230919233435.518620-1-jacob.e.keller@intel.com> References: <20230919233435.518620-1-jacob.e.keller@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=1695166507; x=1726702507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xAlOe+g4wO6nofCRjyGgERyqDGu9wObFLaLZI1c5P5M=; b=OaUrKgThtJWD5UNWaPfZZVnUptTV+9N1xe+1A0xD73ik/AEnIW1euA2H 2goBFTbh4ap5Ljst3ltFA08YtbPLLxvJFZA9DN6j7xkJuWNl1/wTx0lNo k9nKohGWWFRUCkCCou2wP0lgGY78w9bOyFOeE29QNluYtEhj7im1RWySL F7FQflqP82DsqxPOLPAGIffKySOhZMBwDPktY49yaBtHCapyxK3oHAOUj ipmoQMmgEZuvCYeuJpL5UV8o9WBLSXxJvxBH1rwkRAXiKwzhw8AxOQ4cL xpDMSrRdDRJwy/ryUDvpf4nn6PJUns/nn7dHVkhSL79TyGEE877Kr7C0W w==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=OaUrKgTh Subject: [Intel-wired-lan] [PATCH iwl-next 1/4] ice: don't compile ice_dpll.c if CONFIG_PTP_1588_CLOCK is disabled 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: Jacob Keller , Anthony Nguyen Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The ice_dpll.c file was recently merged with support for the DPLL interface. This feature as currently written in the ice driver depends on the PTP infrastructure and causes compilation failures if CONFIG_PTP_1588_CLOCK is disabled: ld: vmlinux.o: in function `ice_dpll_init_info_direct_pins': ice_dpll.c:(.text+0x894167): undefined reference to `ice_cgu_get_pin_freq_supp' ld: ice_dpll.c:(.text+0x894197): undefined reference to `ice_cgu_get_pin_name' ld: ice_dpll.c:(.text+0x8941a8): undefined reference to `ice_cgu_get_pin_type' ld: vmlinux.o: in function `ice_dpll_update_state': ice_dpll.c:(.text+0x894494): undefined reference to `ice_get_cgu_state' ld: vmlinux.o: in function `ice_dpll_init': (.text+0x8953d5): undefined reference to `ice_get_cgu_rclk_pin_info' This occurs because the ice_dpll.c file is compiled unconditionally, but it depends on functions in ice_ptp_hw.c which is only compiled with CONFIG_PTP_1588_CLOCK. It might be possible to break this dependency and expose those functions without CONFIG_PTP_1588_CLOCK, but that is not clear to me. For now, simply fix the Makefile to compile ice_dpll.c only when we have PTP support enabled. Also update the ice_dpll.h header to provide no-op fallbacks for enabling and disabling the DPLL feature in this case. Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ice/Makefile | 3 +-- drivers/net/ethernet/intel/ice/ice_dpll.h | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile index 2bdd020b7939..8757bec23fb3 100644 --- a/drivers/net/ethernet/intel/ice/Makefile +++ b/drivers/net/ethernet/intel/ice/Makefile @@ -35,7 +35,6 @@ ice-y := ice_main.o \ ice_ethtool.o \ ice_repr.o \ ice_tc_lib.o \ - ice_dpll.o \ ice_fwlog.o \ ice_debugfs.o ice-$(CONFIG_PCI_IOV) += \ @@ -46,7 +45,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o +ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.h b/drivers/net/ethernet/intel/ice/ice_dpll.h index 9c524c4bdfd7..2dfe764b81e1 100644 --- a/drivers/net/ethernet/intel/ice/ice_dpll.h +++ b/drivers/net/ethernet/intel/ice/ice_dpll.h @@ -97,8 +97,12 @@ struct ice_dplls { s32 output_phase_adj_max; }; +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK) void ice_dpll_init(struct ice_pf *pf); - void ice_dpll_deinit(struct ice_pf *pf); +#else +static inline void ice_dpll_init(struct ice_pf *pf) { } +static inline void ice_dpll_deinit(struct ice_pf *pf) { } +#endif #endif From patchwork Tue Sep 19 23:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 1836922 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=tlF7wHFX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4RqyhK0RjXz1ynF for ; Wed, 20 Sep 2023 09:35:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6B536417C4; Tue, 19 Sep 2023 23:35:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6B536417C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1695166527; bh=NYvOZSdLaNtkpLa9FWb47d2sTAAA+T1/N8bQZfjaimY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=tlF7wHFX3Y1jMNGgxARmHz9r2Z/aKNI0aY73a7vQRs7HNyqsUk6lAIPDINFl375GG ZFZnh5lWlVwexLbbkoT5wuK4I6fyYLAFdoZSIZpS0d0ZqAv6iohxNAMX51mapUEXZS +SiY9j0DYbZTTQwvEBh7L+dLg+Vnb4RHHxB3X4nnvQwav+N2uWAODKjjvw4BOWsJnf m5HJJJT3bY9gqxDzCwKi+5JwdI6qUWNaFcNd5hHM8uvJMho5oOtHcrvN58O4YkswN9 8eVwTHBUdToy2qqNE/cNp6kJ4C23gErywIO/sv5lyajE0tyeit8gp0lpRaYRZuW/qC SR2pgzlgLOP5w== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XnpoYPAmEXtW; Tue, 19 Sep 2023 23:35:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 04B64417C3; Tue, 19 Sep 2023 23:35:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 04B64417C3 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 071AD1BF407 for ; Tue, 19 Sep 2023 23:35:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 222FF41E3D for ; Tue, 19 Sep 2023 23:35:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 222FF41E3D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Rw3UOVUR9Rm for ; Tue, 19 Sep 2023 23:35:06 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by smtp4.osuosl.org (Postfix) with ESMTPS id C88DB41D86 for ; Tue, 19 Sep 2023 23:35:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C88DB41D86 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="444172127" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="444172127" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="749668103" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="749668103" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.1]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 From: Jacob Keller To: Intel Wired LAN Date: Tue, 19 Sep 2023 16:34:33 -0700 Message-ID: <20230919233435.518620-3-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.41.0.1.g9857a21e0017.dirty In-Reply-To: <20230919233435.518620-1-jacob.e.keller@intel.com> References: <20230919233435.518620-1-jacob.e.keller@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=1695166506; x=1726702506; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kgY6Y0OvAcaNtevWc5N5c6CsqK0ZEtQLAWlhFUhDucQ=; b=Hxp5DGqQ4NHFZ7/1oecVf8LFBn0aHNkdn2njEl/0fSY5Xo4Ue1NUvDYF /yV1sc5cSVodtBVrvIHqFR/KEkWGLAy5OxykxyDhY21pd9BGv5Iok+IqK h0dTdON0pTlnl9i6V8bEi3+wusR5qgYCwCIPus/CIlM3JspbaX54wnXWN sWyy3qmB0e1Xj+gr0ZfcamyaolNmYeWslxvUIWcda1uDiL61RTtM1T7IL wnB7KICyfCb0fxM/aB/KZRdUKgCzIEe1KbejfCTcpDvh5fggwMhId0oXC KqCltpxEi6uJuL+WwY3Xfm7eJu6AEfoHtH6OpqG+yolfmkaPdvzHPmitM g==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Hxp5DGqQ Subject: [Intel-wired-lan] [PATCH iwl-next 2/4] ice: move netlist check functions to ice_common.c 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: Jacob Keller , Anthony Nguyen Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The ice_ptp_hw.c file has a few functions which check for whether the device netlist has a node indicating hardware support for certain features. These checks don't really make sense to be in ice_ptp_hw.c. In addition, their names could be confusing as they just say "is_present" but really are checking the netlist. Additionally, these functions are only compiled into the ice module if CONFIG_PTP_1588_CLOCK is enabled. They are used in ice_lib.c which is unconditionally compiled, so this can result in build errors if the PTP support is disabled: ld: vmlinux.o: in function `ice_init_feature_support': (.text+0x8702b8): undefined reference to `ice_is_phy_rclk_present' ld: (.text+0x8702cd): undefined reference to `ice_is_cgu_present' ld: (.text+0x8702d9): undefined reference to `ice_is_clock_mux_present_e810t' To fix this, we need to define these functions outside of ice_ptp.c or ice_ptp_hw.c. The ice_common.c already hace ice_is_gps_in_netlist. Move the similar functions in ice_ptp_hw.c into ice_common.c, renaming them to use the postfix "_in_netlist" to match the GPS check. Where appropriate, also drop the _e810t postfix as well. This also makes the ice_find_netlist_node only called from within ice_common.c, so its safe to mark it static and stop declaring it in the ice_common.h header. Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_common.c | 66 ++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_common.h | 6 +- drivers/net/ethernet/intel/ice/ice_lib.c | 6 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 66 --------------------- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 - 5 files changed, 69 insertions(+), 78 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index bcf7d9c56248..12c09374c2be 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -477,9 +477,8 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, * netlist. When found ICE_SUCCESS 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) +static 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; @@ -2552,6 +2551,67 @@ bool ice_is_pf_c827(struct ice_hw *hw) return false; } +/** + * ice_is_phy_rclk_in_netlist + * @hw: pointer to the hw struct + * + * Check if the PHY Recovered Clock device is present in the netlist + */ +bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw) +{ + if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) && + ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL)) + return false; + + return true; +} + +/** + * ice_is_clock_mux_in_netlist + * @hw: pointer to the hw struct + * + * Check if the Clock Multiplexer device is present in the netlist + */ +bool ice_is_clock_mux_in_netlist(struct ice_hw *hw) +{ + if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX, + ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX, + NULL)) + return false; + + return true; +} + +/** + * ice_is_cgu_in_netlist - check for CGU presence + * @hw: pointer to the hw struct + * + * Check if the Clock Generation Unit (CGU) device is present in the netlist. + * Save the CGU part number in the hw structure for later use. + * Return: + * * true - cgu is present + * * false - cgu is not present + */ +bool ice_is_cgu_in_netlist(struct ice_hw *hw) +{ + if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032, + NULL)) { + hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032; + return true; + } else if (!ice_find_netlist_node(hw, + ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384, + NULL)) { + hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384; + return true; + } + + return false; +} + /** * ice_is_gps_in_netlist * @hw: pointer to the hw struct diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index 59969f702dae..4a75c0c89301 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -93,11 +93,11 @@ 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); bool ice_is_gps_in_netlist(struct ice_hw *hw); int -ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, - u16 *node_handle); -int ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, u8 *node_part_number, u16 *node_handle); int diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index b96fbf76ca6d..6e70d678f323 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -3995,14 +3995,14 @@ void ice_init_feature_support(struct ice_pf *pf) case ICE_DEV_ID_E810_XXV_QSFP: case ICE_DEV_ID_E810_XXV_SFP: ice_set_feature_support(pf, ICE_F_DSCP); - if (ice_is_phy_rclk_present(&pf->hw)) + if (ice_is_phy_rclk_in_netlist(&pf->hw)) ice_set_feature_support(pf, ICE_F_PHY_RCLK); /* If we don't own the timer - don't enable other caps */ if (!ice_pf_src_tmr_owned(pf)) break; - if (ice_is_cgu_present(&pf->hw)) + if (ice_is_cgu_in_netlist(&pf->hw)) ice_set_feature_support(pf, ICE_F_CGU); - if (ice_is_clock_mux_present_e810t(&pf->hw)) + if (ice_is_clock_mux_in_netlist(&pf->hw)) ice_set_feature_support(pf, ICE_F_SMA_CTRL); if (ice_gnss_is_gps_present(&pf->hw)) ice_set_feature_support(pf, ICE_F_GNSS); diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c index 5619644d5da7..882dfdad0021 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c @@ -3556,45 +3556,6 @@ int ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx) } } -/** - * ice_is_phy_rclk_present - check recovered clk presence - * @hw: pointer to the hw struct - * - * Check if the PHY Recovered Clock device is present in the netlist - * Return: - * * true - device found in netlist - * * false - device not found - */ -bool ice_is_phy_rclk_present(struct ice_hw *hw) -{ - if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, - ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) && - ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, - ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL)) - return false; - - return true; -} - -/** - * ice_is_clock_mux_present_e810t - * @hw: pointer to the hw struct - * - * Check if the Clock Multiplexer device is present in the netlist - * Return: - * * true - device found in netlist - * * false - device not found - */ -bool ice_is_clock_mux_present_e810t(struct ice_hw *hw) -{ - if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX, - ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX, - NULL)) - return false; - - return true; -} - /** * ice_get_pf_c827_idx - find and return the C827 index for the current pf * @hw: pointer to the hw struct @@ -3708,33 +3669,6 @@ int ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready) } } -/** - * ice_is_cgu_present - check for CGU presence - * @hw: pointer to the hw struct - * - * Check if the Clock Generation Unit (CGU) device is present in the netlist - * Return: - * * true - cgu is present - * * false - cgu is not present - */ -bool ice_is_cgu_present(struct ice_hw *hw) -{ - if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, - ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032, - NULL)) { - hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032; - return true; - } else if (!ice_find_netlist_node(hw, - ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, - ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384, - NULL)) { - hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384; - return true; - } - - return false; -} - /** * ice_cgu_get_pin_desc_e823 - get pin description array * @hw: pointer to the hw struct diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h index 6f277e7b06b9..18a993134826 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h @@ -271,10 +271,7 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data); int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data); int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data); bool ice_is_pca9575_present(struct ice_hw *hw); -bool ice_is_phy_rclk_present(struct ice_hw *hw); -bool ice_is_clock_mux_present_e810t(struct ice_hw *hw); int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx); -bool ice_is_cgu_present(struct ice_hw *hw); enum dpll_pin_type ice_cgu_get_pin_type(struct ice_hw *hw, u8 pin, bool input); struct dpll_pin_frequency * ice_cgu_get_pin_freq_supp(struct ice_hw *hw, u8 pin, bool input, u8 *num); From patchwork Tue Sep 19 23:34:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 1836920 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=NvxxaSOK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4Rqyh846FPz1ynF for ; Wed, 20 Sep 2023 09:35:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D7B3040191; Tue, 19 Sep 2023 23:35:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D7B3040191 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1695166518; bh=0GGySOzZB4vSb+Y25BkanT+OLkbznWDJNyX1Q2xFiuU=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=NvxxaSOK39dmmF/UVjloABN96+hRot6CPK36D4ri+PP+VRvBDsFmgyG4PGvfLwZ5o wPJObom6xYdCsqJzfc3HqNvbk6ZYDbcsob+MrAP5PfI+HlQXipp277Ml4LIGEcm2lC xfYq+dipXllmAozXVPINhpx+qfsIxhqfvA/QPpJKYOfA+43owcn8Ao+aVkbK2ftIpW KWvm78HNZBNnOaHu4/Y3MMXXoCV+Rsrts35AosQkoZja8/vnt8XlZajAlheLQ9ysI3 SA/BqHA1wAXrusb7eo1svglaT/7fmf7XcgNsxVzgfvkd+NiLq0NOF0SXaM3kJnN5Z1 MKrd1n+Gg2luw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8f-jSi6w3noP; Tue, 19 Sep 2023 23:35:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id D4A7C417BD; Tue, 19 Sep 2023 23:35:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D4A7C417BD 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 5BAA91BF407 for ; Tue, 19 Sep 2023 23:35:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6786141BEC for ; Tue, 19 Sep 2023 23:35:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6786141BEC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lxMOts26VnHh for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by smtp4.osuosl.org (Postfix) with ESMTPS id 73E3641E41 for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 73E3641E41 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="444172128" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="444172128" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="749668106" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="749668106" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.1]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 From: Jacob Keller To: Intel Wired LAN Date: Tue, 19 Sep 2023 16:34:34 -0700 Message-ID: <20230919233435.518620-4-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.41.0.1.g9857a21e0017.dirty In-Reply-To: <20230919233435.518620-1-jacob.e.keller@intel.com> References: <20230919233435.518620-1-jacob.e.keller@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=1695166507; x=1726702507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3P1aL1El3c+MVu82DVtYZvXNKOHxbpvRIsseTK+EBNE=; b=DRXthYCP+S+7wQayrRjk7epEx1umsowtGC0FJrosDmwSkQX+tph6AZGR Ji7B4oZsb9/OTySeBJq+T3E7kl6ydJJTaub/9Smmj29OdDH09+wJX64Dd XTFurcDL+hb/YaEUoNjk36d4DvSRsZ26xtvjhLdPEGINAPkD+FahneHtL vQEO6Iin5YnUdw46aN2DenW9qtL63oODReCmgeuzcNjAZfSX4NSvOk9bX zpoXLGxwDOsuiTT11N4OKM8AbQK2EJ3mvA/z6cOMrnxN6wgD1V67y87H4 vg2jiQjqNISti+leub8RzDc3axtJNJJ0wfuM3Imk3ZcftY4m9V9+TM/c4 w==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DRXthYCP Subject: [Intel-wired-lan] [PATCH iwl-next 3/4] ice: make ice_get_pf_c827_idx static 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: Jacob Keller , Anthony Nguyen Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The ice_get_pf_c827_idx function is only called inside of ice_ptp_hw.c, so there is no reason to export it. Mark it static and remove the declaration from ice_ptp_hw.h Signed-off-by: Jacob Keller Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 2 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c index 882dfdad0021..0167e0577a55 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c @@ -3564,7 +3564,7 @@ int ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx) * * 0 - success * * negative - failure */ -int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx) +static int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx) { struct ice_aqc_get_link_topo cmd; u8 node_part_number; diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h index 18a993134826..36aeeef99ec0 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h @@ -271,7 +271,6 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data); int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data); int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data); bool ice_is_pca9575_present(struct ice_hw *hw); -int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx); enum dpll_pin_type ice_cgu_get_pin_type(struct ice_hw *hw, u8 pin, bool input); struct dpll_pin_frequency * ice_cgu_get_pin_freq_supp(struct ice_hw *hw, u8 pin, bool input, u8 *num); From patchwork Tue Sep 19 23:34:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 1836921 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=vTnrYiRv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4RqyhD4rWnz1ynF for ; Wed, 20 Sep 2023 09:35:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EC442417CE; Tue, 19 Sep 2023 23:35:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EC442417CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1695166523; bh=g1qYrSy7XKUvf8j0n6NpRyM8OEo2Gx5ZkntIxIACYDA=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=vTnrYiRvMd0xT6T0HSclLOibXsbVwYowhvWcWwVbrKbPu5+1i4Bd3NYryXnQ68saP Fc7Rx7m+zymMzAPjMOUOXeZJ3KMf5Vrqex1XQ/IQ5IZlA0OLyH9sllR0UjA251nw39 +cFWkSYb047LYOvSm9nFAlCSkAkEqOM8lpGdPkWhOH7FSxdw5Vi7cL2ZEqYYKkboGL ZLX7LgcJaepYHaTjq6nAn8rhy+U1YTrv41b8ofC0cWzQicUj8pPi/9v8q8yK+tDnlf nND9O8v/3hhUk4ApGFaTFpxMOSAa9oCnOXLSXW7BNJQrDelodlti366epLr8RxhXha We5K9jRba4rnA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zBd3AXyGoLYf; Tue, 19 Sep 2023 23:35:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id E8B3C417B5; Tue, 19 Sep 2023 23:35:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E8B3C417B5 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 E97291BF407 for ; Tue, 19 Sep 2023 23:35:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8E29141E41 for ; Tue, 19 Sep 2023 23:35:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8E29141E41 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dRrchxVwIsnv for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by smtp4.osuosl.org (Postfix) with ESMTPS id 3B5BD41E3D for ; Tue, 19 Sep 2023 23:35:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3B5BD41E3D X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="444172129" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="444172129" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="749668109" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="749668109" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.1]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 16:34:50 -0700 From: Jacob Keller To: Intel Wired LAN Date: Tue, 19 Sep 2023 16:34:35 -0700 Message-ID: <20230919233435.518620-5-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.41.0.1.g9857a21e0017.dirty In-Reply-To: <20230919233435.518620-1-jacob.e.keller@intel.com> References: <20230919233435.518620-1-jacob.e.keller@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=1695166507; x=1726702507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EFMz6veJ9D+gC/S6rZwPQjM26t/fhHOzhx0qGpUDEPo=; b=WZHt/clMAlPrxrnUD7OpK9Gfwp/A5Q5tRnu13x0zKME8rNcP5QZvpLdD qM/EARWZKZBPX1GWeii/dasPQ7t535nIfzDAla/YyqHsLYhbm4hMdr1Wv wdO3JbYZsWWWUjx1T+vwLe5MMa5c5ZtCIyNmP+U5vb9554YIi/WemUVnt iyfQXZUtaxbyuBlpe0iKnNn7xviJv9ySsWi0kN19+xc8MEiAElpFuJ94b +STlVzfnjgWRwDvpztp64u0h465ep8MNYGoGxTvgn5sox8FDvA8TZB1w6 TykeAgAYFBuluRsgzxguAMV7wlE4y/uJdGOr9FO1phnRchB/gWyElcK3P Q==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WZHt/clM Subject: [Intel-wired-lan] [PATCH iwl-next 4/4] ice: cleanup ice_find_netlist_node 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: Jacob Keller , Anthony Nguyen Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The ice_find_netlist_node function was introduced in commit 8a3a565ff210 ("ice: add admin commands to access cgu configuration"). Variations of this function were reviewed concurrently on both intel-wired-lan[1][2], and netdev [3][4] [1]: https://lore.kernel.org/intel-wired-lan/20230913204943.1051233-7-vadim.fedorenko@linux.dev/ [2]: https://lore.kernel.org/intel-wired-lan/20230817000058.2433236-5-jacob.e.keller@intel.com/ [3]: https://lore.kernel.org/netdev/20230918212814.435688-1-anthony.l.nguyen@intel.com/ [4]: https://lore.kernel.org/netdev/20230913204943.1051233-7-vadim.fedorenko@linux.dev/ The variant I posted had a few changes due to review feedback which were never incorporated into the DPLL series: * Replace the references to ancient and long removed ICE_SUCCESS and ICE_ERR_DOES_NOT_EXIST status codes in the function comment. * Return -ENOENT instead of -ENOTBLK, as a more common way to indicate that an entry doesn't exist. * Avoid the use of memset() and use simple static initialization for the cmd variable. * Use FIELD_PREP to assign the node_type_ctx. * Remove an unnecessary local variable to keep track of rec_node_handle, just pass the node_handle pointer directly into ice_aq_get_netlist_node. Signed-off-by: Jacob Keller Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Reviewed-by: Paul Menzel --- drivers/net/ethernet/intel/ice/ice_common.c | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 12c09374c2be..d4e259b816b9 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -473,41 +473,41 @@ 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 ICE_SUCCESS 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, -ENOENT if no handle was found, and + * a negative error code on failure to access the AQ. */ static 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 < ICE_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); + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, + node_type_ctx); cmd.addr.topo_params.index = idx; 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 -ENOTBLK; + return -ENOENT; } /**