From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
To: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
aleksandr.loktionov@intel.com
Cc: netdev@vger.kernel.org
Subject: [PATCH iwl-next 8/10] ice: move ice_phy_get_speed_eth56g() from ice_ptp_hw.c to ice_common.c
Date: Fri, 10 Apr 2026 09:49:19 +0200 [thread overview]
Message-ID: <20260410074921.1254213-9-aleksandr.loktionov@intel.com> (raw)
In-Reply-To: <20260410074921.1254213-1-aleksandr.loktionov@intel.com>
ice_phy_get_speed_eth56g() is currently a file-local (static)
helper in ice_ptp_hw.c. Future users outside that compilation
unit require access to it.
Move the function to ice_common.c, add a declaration in
ice_common.h, and relocate the enum ice_eth56g_link_spd from
ice_ptp_hw.h to ice_type.h so it is visible to callers of the
new exported function.
Suggested-by: Karol Kolacinski <karol.kolacinski@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
drivers/net/ethernet/intel/ice/ice_common.c | 45 +++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_common.h | 1 +
drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 45 ---------------------
drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 13 ------
drivers/net/ethernet/intel/ice/ice_type.h | 13 ++++++
5 files changed, 59 insertions(+), 58 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index ce11fea..2cebe4e 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -3513,6 +3513,51 @@ u16 ice_get_link_speed_based_on_phy_type(u64 phy_type_low, u64 phy_type_high)
return speed_phy_type_high;
}
+/**
+ * ice_phy_get_speed_eth56g - Get link speed based on PHY link type
+ * @li: pointer to link information struct
+ *
+ * Return: simplified ETH56G PHY speed
+ */
+enum ice_eth56g_link_spd ice_phy_get_speed_eth56g(struct ice_link_status *li)
+{
+ u16 speed = ice_get_link_speed_based_on_phy_type(li->phy_type_low,
+ li->phy_type_high);
+
+ switch (speed) {
+ case ICE_AQ_LINK_SPEED_1000MB:
+ return ICE_ETH56G_LNK_SPD_1G;
+ case ICE_AQ_LINK_SPEED_2500MB:
+ return ICE_ETH56G_LNK_SPD_2_5G;
+ case ICE_AQ_LINK_SPEED_10GB:
+ return ICE_ETH56G_LNK_SPD_10G;
+ case ICE_AQ_LINK_SPEED_25GB:
+ return ICE_ETH56G_LNK_SPD_25G;
+ case ICE_AQ_LINK_SPEED_40GB:
+ return ICE_ETH56G_LNK_SPD_40G;
+ case ICE_AQ_LINK_SPEED_50GB:
+ switch (li->phy_type_low) {
+ case ICE_PHY_TYPE_LOW_50GBASE_SR:
+ case ICE_PHY_TYPE_LOW_50GBASE_FR:
+ case ICE_PHY_TYPE_LOW_50GBASE_LR:
+ case ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4:
+ case ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC:
+ case ICE_PHY_TYPE_LOW_50G_AUI1:
+ return ICE_ETH56G_LNK_SPD_50G;
+ default:
+ return ICE_ETH56G_LNK_SPD_50G2;
+ }
+ case ICE_AQ_LINK_SPEED_100GB:
+ if (li->phy_type_high ||
+ li->phy_type_low == ICE_PHY_TYPE_LOW_100GBASE_SR2)
+ return ICE_ETH56G_LNK_SPD_100G2;
+ else
+ return ICE_ETH56G_LNK_SPD_100G;
+ default:
+ return ICE_ETH56G_LNK_SPD_1G;
+ }
+}
+
/**
* ice_update_phy_type
* @phy_type_low: pointer to the lower part of phy_type
diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h
index e700ac0..cc5cee8 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.h
+++ b/drivers/net/ethernet/intel/ice/ice_common.h
@@ -342,6 +342,7 @@ ice_aq_get_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,
bool *value, struct ice_sq_cd *cd);
bool ice_is_100m_speed_supported(struct ice_hw *hw);
u16 ice_get_link_speed_based_on_phy_type(u64 phy_type_low, u64 phy_type_high);
+enum ice_eth56g_link_spd ice_phy_get_speed_eth56g(struct ice_link_status *li);
int
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
struct ice_sq_cd *cd);
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
index 61c0a0d..54a8afa 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
@@ -1401,51 +1401,6 @@ static int ice_ptp_write_port_cmd_eth56g(struct ice_hw *hw, u8 port,
return 0;
}
-/**
- * ice_phy_get_speed_eth56g - Get link speed based on PHY link type
- * @li: pointer to link information struct
- *
- * Return: simplified ETH56G PHY speed
- */
-static enum ice_eth56g_link_spd
-ice_phy_get_speed_eth56g(struct ice_link_status *li)
-{
- u16 speed = ice_get_link_speed_based_on_phy_type(li->phy_type_low,
- li->phy_type_high);
-
- switch (speed) {
- case ICE_AQ_LINK_SPEED_1000MB:
- return ICE_ETH56G_LNK_SPD_1G;
- case ICE_AQ_LINK_SPEED_2500MB:
- return ICE_ETH56G_LNK_SPD_2_5G;
- case ICE_AQ_LINK_SPEED_10GB:
- return ICE_ETH56G_LNK_SPD_10G;
- case ICE_AQ_LINK_SPEED_25GB:
- return ICE_ETH56G_LNK_SPD_25G;
- case ICE_AQ_LINK_SPEED_40GB:
- return ICE_ETH56G_LNK_SPD_40G;
- case ICE_AQ_LINK_SPEED_50GB:
- switch (li->phy_type_low) {
- case ICE_PHY_TYPE_LOW_50GBASE_SR:
- case ICE_PHY_TYPE_LOW_50GBASE_FR:
- case ICE_PHY_TYPE_LOW_50GBASE_LR:
- case ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4:
- case ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC:
- case ICE_PHY_TYPE_LOW_50G_AUI1:
- return ICE_ETH56G_LNK_SPD_50G;
- default:
- return ICE_ETH56G_LNK_SPD_50G2;
- }
- case ICE_AQ_LINK_SPEED_100GB:
- if (li->phy_type_high ||
- li->phy_type_low == ICE_PHY_TYPE_LOW_100GBASE_SR2)
- return ICE_ETH56G_LNK_SPD_100G2;
- else
- return ICE_ETH56G_LNK_SPD_100G;
- default:
- return ICE_ETH56G_LNK_SPD_1G;
- }
-}
/**
* ice_phy_cfg_parpcs_eth56g - Configure TUs per PAR/PCS clock cycle
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
index 9bfd3e7..a13256a 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
@@ -50,19 +50,6 @@ enum eth56g_res_type {
NUM_ETH56G_PHY_RES
};
-enum ice_eth56g_link_spd {
- ICE_ETH56G_LNK_SPD_1G,
- ICE_ETH56G_LNK_SPD_2_5G,
- ICE_ETH56G_LNK_SPD_10G,
- ICE_ETH56G_LNK_SPD_25G,
- ICE_ETH56G_LNK_SPD_40G,
- ICE_ETH56G_LNK_SPD_50G,
- ICE_ETH56G_LNK_SPD_50G2,
- ICE_ETH56G_LNK_SPD_100G,
- ICE_ETH56G_LNK_SPD_100G2,
- NUM_ICE_ETH56G_LNK_SPD /* Must be last */
-};
-
/**
* struct ice_phy_reg_info_eth56g - ETH56G PHY register parameters
* @base_addr: base address for each PHY block
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index 1e82f4c..4db235a 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -859,6 +859,19 @@ struct ice_mbx_data {
#define ICE_PORTS_PER_QUAD 4
#define ICE_GET_QUAD_NUM(port) ((port) / ICE_PORTS_PER_QUAD)
+enum ice_eth56g_link_spd {
+ ICE_ETH56G_LNK_SPD_1G,
+ ICE_ETH56G_LNK_SPD_2_5G,
+ ICE_ETH56G_LNK_SPD_10G,
+ ICE_ETH56G_LNK_SPD_25G,
+ ICE_ETH56G_LNK_SPD_40G,
+ ICE_ETH56G_LNK_SPD_50G,
+ ICE_ETH56G_LNK_SPD_50G2,
+ ICE_ETH56G_LNK_SPD_100G,
+ ICE_ETH56G_LNK_SPD_100G2,
+ NUM_ICE_ETH56G_LNK_SPD /* Must be last */
+};
+
#define ATQBAL_FLAGS_INTR_IN_PROGRESS BIT(0)
struct ice_e810_params {
--
2.52.0
next prev parent reply other threads:[~2026-04-10 7:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 7:49 [PATCH iwl-next 0/10] ice: misc cleanups and improvements Aleksandr Loktionov
2026-04-10 7:49 ` [PATCH iwl-next 1/10] ice: translate FW to SW for max num TCs encoding Aleksandr Loktionov
2026-04-14 8:44 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 2/10] ice: allow setting advertised speed and duplex for all media types Aleksandr Loktionov
2026-04-14 9:04 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 3/10] ice: add PORT_AUI and PORT_NONE ethtool port type reporting Aleksandr Loktionov
2026-04-10 7:49 ` [PATCH iwl-next 4/10] ice: reorder ice_flash_info fields to eliminate padding Aleksandr Loktionov
2026-04-14 9:16 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 5/10] ice: improve Add/Update VSI error messages in ice_vsi_init() Aleksandr Loktionov
2026-04-14 9:30 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 6/10] ice: increase OICR interrupt moderation rate to 20K interrupts/sec Aleksandr Loktionov
2026-04-14 9:33 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 7/10] ice: emit user-visible info message for non-contiguous ETS TC config Aleksandr Loktionov
2026-04-14 9:35 ` Simon Horman
2026-04-10 7:49 ` Aleksandr Loktionov [this message]
2026-04-14 9:38 ` [PATCH iwl-next 8/10] ice: move ice_phy_get_speed_eth56g() from ice_ptp_hw.c to ice_common.c Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 9/10] ice: use inline helpers instead of memcmp() for IPv6 mask checks in ice_ethtool_fdir Aleksandr Loktionov
2026-04-14 9:39 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 10/10] ice: promote Tx FIFO drain timeout message from dev_dbg to dev_warn Aleksandr Loktionov
2026-04-14 9:39 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260410074921.1254213-9-aleksandr.loktionov@intel.com \
--to=aleksandr.loktionov@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox