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 5B5FE454EF; Tue, 25 Jun 2024 13:25:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B729742FC9; Tue, 25 Jun 2024 13:18:41 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id CC5C342DA3 for ; Tue, 25 Jun 2024 13:17:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314239; x=1750850239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o0mA/4k0BaHenGeov9nokQPgaJnSJWZl8DSTUtvDbSE=; b=lvwYfZ/g75KDp4ocEKEVy/+5A9sqBIhXLf9lvDk2GnuiHtDgbep50bZT CIt4+kjaVR/C74KEP9lYOI1Kla6ACCZC2+K+ZSPZEpzsJezTmB+4mvsp/ sPJEwfRvwDmNFzhjeUZb3DO7iOHpl3N8oMI/FwGdNxysoxpILJF/0pe7x tp0jeJWFF+W0eJnZGUJO7cUGXJKmKZOD7vsTYhJTbNjtX6J7N6J3l0Hkz dqEs5NWjcXX53Jyei6WFDulMBd+wCEvWImx0aVgkni6d12JzjjkfnU3v3 aAIf4PGotcfEcHDeQPVMpzlojFS+CHVPRji8U4aGPKgJ6XohoNGyDttR8 g==; X-CSE-ConnectionGUID: KkBleelSQ3mFFKpB0gcMLg== X-CSE-MsgGUID: 2ZFsNXx5Rz293cpEotjlIQ== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080426" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080426" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:17:18 -0700 X-CSE-ConnectionGUID: paPH8jQJQFeqfBKDjJ1t5g== X-CSE-MsgGUID: sGuqFIqORPCfViGRjVzdHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719540" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:17:18 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Jacob Keller , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 087/129] net/ice/base: return high address for multi-read eth56g registers Date: Tue, 25 Jun 2024 12:13:32 +0100 Message-ID: <6b9df418a49b0441d14e9ace90da4007b9d374e7.1719313663.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 From: Jacob Keller The eth56g register checks for 40b and 64b registers do not return the high address offset. Instead it is expected that all offsets are exactly 4 bytes apart in the expected order. The e822 implementations explicitly return the address in the lookup function. This form is better because it allows for the potential of registers which may not have a static offset. Match the e822 style by refactoring these functions to return the high address in a function parameter. Signed-off-by: Jacob Keller Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_ptp_hw.c | 43 ++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index d3ad51f3ef..1f7a8b593f 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -1209,19 +1209,35 @@ ice_phy_port_mem_write_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 val) /** * ice_is_64b_phy_reg_eth56g - Check if this is a 64bit PHY register * @low_addr: the low address to check + * @high_addr: on return, contains the high address of the 64bit register * * Checks if the provided low address is one of the known 64bit PHY values - * represented as two 32bit registers. + * represented as two 32bit registers. If it is, return the appropriate high + * register offset to use. */ -static bool ice_is_64b_phy_reg_eth56g(u16 low_addr) +static bool ice_is_64b_phy_reg_eth56g(u16 low_addr, u16 *high_addr) { switch (low_addr) { case PHY_REG_TX_TIMER_INC_PRE_L: + *high_addr = PHY_REG_TX_TIMER_INC_PRE_U; + return true; case PHY_REG_RX_TIMER_INC_PRE_L: + *high_addr = PHY_REG_RX_TIMER_INC_PRE_U; + return true; case PHY_REG_TX_CAPTURE_L: + *high_addr = PHY_REG_TX_CAPTURE_U; + return true; case PHY_REG_RX_CAPTURE_L: + *high_addr = PHY_REG_RX_CAPTURE_U; + return true; case PHY_REG_TOTAL_TX_OFFSET_L: + *high_addr = PHY_REG_TOTAL_TX_OFFSET_U; + return true; case PHY_REG_TOTAL_RX_OFFSET_L: + *high_addr = PHY_REG_TOTAL_RX_OFFSET_U; + return true; + case PHY_REG_TX_MEMORY_STATUS_L: + *high_addr = PHY_REG_TX_MEMORY_STATUS_U; return true; default: return false; @@ -1231,15 +1247,18 @@ static bool ice_is_64b_phy_reg_eth56g(u16 low_addr) /** * ice_is_40b_phy_reg_eth56g - Check if this is a 40bit PHY register * @low_addr: the low address to check + * @high_addr: on return, contains the high address of the 40bit value * * Checks if the provided low address is one of the known 40bit PHY values * split into two registers with the lower 8 bits in the low register and the - * upper 32 bits in the high register. + * upper 32 bits in the high register. If it is, return the high register + * offset to use. */ -static bool ice_is_40b_phy_reg_eth56g(u16 low_addr) +static bool ice_is_40b_phy_reg_eth56g(u16 low_addr, u16 *high_addr) { switch (low_addr) { case PHY_REG_TIMETUS_L: + *high_addr = PHY_REG_TIMETUS_U; return true; default: return false; @@ -1261,11 +1280,11 @@ static bool ice_is_40b_phy_reg_eth56g(u16 low_addr) static int ice_read_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val) { - u16 high_addr = low_addr + sizeof(u32); int err; + u16 high_addr; u32 lo, hi; - if (!ice_is_40b_phy_reg_eth56g(low_addr)) + if (!ice_is_40b_phy_reg_eth56g(low_addr, &high_addr)) return ICE_ERR_PARAM; err = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo); @@ -1302,11 +1321,11 @@ ice_read_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val) static int ice_read_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val) { - u16 high_addr = low_addr + sizeof(u32); int err; + u16 high_addr; u32 lo, hi; - if (!ice_is_64b_phy_reg_eth56g(low_addr)) + if (!ice_is_64b_phy_reg_eth56g(low_addr, &high_addr)) return ICE_ERR_PARAM; err = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo); @@ -1343,11 +1362,11 @@ ice_read_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val) static int ice_write_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val) { - u16 high_addr = low_addr + sizeof(u32); int err; + u16 high_addr; u32 lo, hi; - if (!ice_is_40b_phy_reg_eth56g(low_addr)) + if (!ice_is_40b_phy_reg_eth56g(low_addr, &high_addr)) return ICE_ERR_PARAM; lo = (u32)(val & P_REG_40B_LOW_M); @@ -1384,11 +1403,11 @@ ice_write_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val) static int ice_write_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val) { - u16 high_addr = low_addr + sizeof(u32); int err; + u16 high_addr; u32 lo, hi; - if (!ice_is_64b_phy_reg_eth56g(low_addr)) + if (!ice_is_64b_phy_reg_eth56g(low_addr, &high_addr)) return ICE_ERR_PARAM; lo = ICE_LO_DWORD(val); -- 2.43.0