* [Intel-wired-lan] [PATCH net-next v1] ice: Allow 100M speeds for some devices
@ 2022-07-27 10:42 Mikael Barsehyan
2022-07-27 18:54 ` Tony Nguyen
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Barsehyan @ 2022-07-27 10:42 UTC (permalink / raw)
To: intel-wired-lan; +Cc: Chinh T Cao, Mikael Barsehyan
From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
For certain devices, 100M speeds are supported. Do not mask off
100M speed for these devices.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Signed-off-by: Mikael Barsehyan <mikael.barsehyan@intel.com>
---
drivers/net/ethernet/intel/ice/ice_common.c | 20 ++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_common.h | 1 +
drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 ++++++---
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 05a4acfbdd1d..010385e67665 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -2775,6 +2775,26 @@ ice_aq_set_port_params(struct ice_port_info *pi, bool double_vlan,
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}
+/**
+ * ice_is_100m_speed_supported
+ * @hw: pointer to the HW struct
+ *
+ * returns true if 100M speeds are supported by the device,
+ * false otherwise.
+ */
+bool ice_is_100m_speed_supported(struct ice_hw *hw)
+{
+ switch (hw->device_id) {
+ case ICE_DEV_ID_E822C_SGMII:
+ case ICE_DEV_ID_E822L_SGMII:
+ case ICE_DEV_ID_E823L_1GBE:
+ case ICE_DEV_ID_E823C_SGMII:
+ return true;
+ default:
+ return false;
+ }
+}
+
/**
* ice_get_link_speed_based_on_phy_type - returns link speed
* @phy_type_low: 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 a74df1d3a002..2734296bdd3b 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.h
+++ b/drivers/net/ethernet/intel/ice/ice_common.h
@@ -205,6 +205,7 @@ ice_aq_set_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx, bool value,
int
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);
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_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 46d8ac7906ea..4d3d0072e432 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1503,6 +1503,7 @@ ice_get_ethtool_stats(struct net_device *netdev,
/**
* ice_mask_min_supported_speeds
+ * @hw: pointer to the HW structure
* @phy_types_high: PHY type high
* @phy_types_low: PHY type low to apply minimum supported speeds mask
*
@@ -1510,13 +1511,14 @@ ice_get_ethtool_stats(struct net_device *netdev,
* for ethtool supported link mode.
*/
static
-void ice_mask_min_supported_speeds(u64 phy_types_high, u64 *phy_types_low)
+void ice_mask_min_supported_speeds(struct ice_hw *hw,
+ u64 phy_types_high, u64 *phy_types_low)
{
/* if QSFP connection with 100G speed, minimum supported speed is 25G */
if (*phy_types_low & ICE_PHY_TYPE_LOW_MASK_100G ||
phy_types_high & ICE_PHY_TYPE_HIGH_MASK_100G)
*phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_25G;
- else
+ else if (!ice_is_100m_speed_supported(hw))
*phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_1G;
}
@@ -1566,7 +1568,8 @@ ice_phy_type_to_ethtool(struct net_device *netdev,
phy_types_low = le64_to_cpu(pf->nvm_phy_type_lo);
phy_types_high = le64_to_cpu(pf->nvm_phy_type_hi);
- ice_mask_min_supported_speeds(phy_types_high, &phy_types_low);
+ ice_mask_min_supported_speeds(&pf->hw, phy_types_high,
+ &phy_types_low);
/* determine advertised modes based on link override only
* if it's supported and if the FW doesn't abstract the
* driver from having to account for link overrides
--
2.35.3
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Intel-wired-lan] [PATCH net-next v1] ice: Allow 100M speeds for some devices
2022-07-27 10:42 [Intel-wired-lan] [PATCH net-next v1] ice: Allow 100M speeds for some devices Mikael Barsehyan
@ 2022-07-27 18:54 ` Tony Nguyen
0 siblings, 0 replies; 2+ messages in thread
From: Tony Nguyen @ 2022-07-27 18:54 UTC (permalink / raw)
To: Mikael Barsehyan, intel-wired-lan; +Cc: Chinh T Cao
On 7/27/2022 3:42 AM, Mikael Barsehyan wrote:
> From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
>
> For certain devices, 100M speeds are supported. Do not mask off
> 100M speed for these devices.
>
> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
I believe Chinh is a co-developer? If so, this should also have:
Co-developed-by: Chinh T Cao <chinh.t.cao@intel.com> above his sign-off.
> Signed-off-by: Mikael Barsehyan <mikael.barsehyan@intel.com>
> ---
<snip>
> @@ -1503,6 +1503,7 @@ ice_get_ethtool_stats(struct net_device *netdev,
>
> /**
> * ice_mask_min_supported_speeds
> + * @hw: pointer to the HW structure
> * @phy_types_high: PHY type high
> * @phy_types_low: PHY type low to apply minimum supported speeds mask
> *
> @@ -1510,13 +1511,14 @@ ice_get_ethtool_stats(struct net_device *netdev,
> * for ethtool supported link mode.
> */
> static
> -void ice_mask_min_supported_speeds(u64 phy_types_high, u64 *phy_types_low)
> +void ice_mask_min_supported_speeds(struct ice_hw *hw,
> + u64 phy_types_high, u64 *phy_types_low)
Not from this patch, but it would be nice to fix this format instead of
continuing with it.
static void
ice_mask_min_supported_speeds(...)
> {
> /* if QSFP connection with 100G speed, minimum supported speed is 25G */
> if (*phy_types_low & ICE_PHY_TYPE_LOW_MASK_100G ||
> phy_types_high & ICE_PHY_TYPE_HIGH_MASK_100G)
> *phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_25G;
> - else
> + else if (!ice_is_100m_speed_supported(hw))
> *phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_1G;
> }
>
> @@ -1566,7 +1568,8 @@ ice_phy_type_to_ethtool(struct net_device *netdev,
> phy_types_low = le64_to_cpu(pf->nvm_phy_type_lo);
> phy_types_high = le64_to_cpu(pf->nvm_phy_type_hi);
>
> - ice_mask_min_supported_speeds(phy_types_high, &phy_types_low);
> + ice_mask_min_supported_speeds(&pf->hw, phy_types_high,
> + &phy_types_low);
> /* determine advertised modes based on link override only
> * if it's supported and if the FW doesn't abstract the
> * driver from having to account for link overrides
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-27 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 10:42 [Intel-wired-lan] [PATCH net-next v1] ice: Allow 100M speeds for some devices Mikael Barsehyan
2022-07-27 18:54 ` Tony Nguyen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.