All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly
@ 2022-06-06  7:07 Anatolii Gerasymenko
  2022-06-06  7:13 ` Anatolii Gerasymenko
  2022-06-06 18:24 ` Tony Nguyen
  0 siblings, 2 replies; 4+ messages in thread
From: Anatolii Gerasymenko @ 2022-06-06  7:07 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Anatolii Gerasymenko

In current implementation ice_update_phy_type enables all link modes
for selected speed. This approach doesn't work for 1000M speeds,
because both copper (1000baseT) and optical (1000baseX) standards
cannot be enabled at once.

Add a special treatment for 1000M speeds.

Fixes: 48cb27f2fd18 ("ice: Implement handlers for ethtool PHY/link operations")
Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 39 +++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 1e71b70f0e52..e3080c564432 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2189,6 +2189,42 @@ ice_setup_autoneg(struct ice_port_info *p, struct ethtool_link_ksettings *ks,
 	return err;
 }
 
+/**
+ * ice_set_phy_type_from_speed - set phy_types based on speeds
+ * and advertised modes
+ * @ks: ethtool link ksettings struct
+ * @phy_type_low: pointer to the lower part of phy_type
+ * @phy_type_high: pointer to the higher part of phy_type
+ * @adv_link_speed: targeted link speeds bitmap
+ */
+static void
+ice_set_phy_type_from_speed(const struct ethtool_link_ksettings *ks,
+			    u64 *phy_type_low, u64 *phy_type_high,
+			    u16 adv_link_speed)
+{
+	/* Handle 1000M speed in a special way because ice_update_phy_type
+	 * enables all link modes, but having mixed copper and optic standards
+	 * is not supported
+	 */
+	adv_link_speed &= ~ICE_AQ_LINK_SPEED_1000MB;
+
+	if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+						  1000baseT_Full))
+		*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_T |
+				 ICE_PHY_TYPE_LOW_1G_SGMII;
+
+	if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+						  1000baseKX_Full))
+		*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_KX;
+
+	if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+						  1000baseX_Full))
+		*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_SX |
+				 ICE_PHY_TYPE_LOW_1000BASE_LX;
+
+	ice_update_phy_type(phy_type_low, phy_type_high, adv_link_speed);
+}
+
 /**
  * ice_set_link_ksettings - Set Speed and Duplex
  * @netdev: network interface device structure
@@ -2320,7 +2356,8 @@ ice_set_link_ksettings(struct net_device *netdev,
 		adv_link_speed = curr_link_speed;
 
 	/* Convert the advertise link speeds to their corresponded PHY_TYPE */
-	ice_update_phy_type(&phy_type_low, &phy_type_high, adv_link_speed);
+	ice_set_phy_type_from_speed(ks, &phy_type_low, &phy_type_high,
+				    adv_link_speed);
 
 	if (!autoneg_changed && adv_link_speed == curr_link_speed) {
 		netdev_info(netdev, "Nothing changed, exiting without setting anything.\n");
-- 
2.25.1

_______________________________________________
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] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly
  2022-06-06  7:07 [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly Anatolii Gerasymenko
@ 2022-06-06  7:13 ` Anatolii Gerasymenko
  2022-06-06 18:24 ` Tony Nguyen
  1 sibling, 0 replies; 4+ messages in thread
From: Anatolii Gerasymenko @ 2022-06-06  7:13 UTC (permalink / raw)
  To: intel-wired-lan

Wrongly v2 in the title. It should be v1.

Best regards,
Anatolii Gerasymenko
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly
  2022-06-06  7:07 [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly Anatolii Gerasymenko
  2022-06-06  7:13 ` Anatolii Gerasymenko
@ 2022-06-06 18:24 ` Tony Nguyen
  2022-06-07  6:01   ` Anatolii Gerasymenko
  1 sibling, 1 reply; 4+ messages in thread
From: Tony Nguyen @ 2022-06-06 18:24 UTC (permalink / raw)
  To: Anatolii Gerasymenko, intel-wired-lan



On 6/6/2022 12:07 AM, Anatolii Gerasymenko wrote:
> In current implementation ice_update_phy_type enables all link modes
> for selected speed. This approach doesn't work for 1000M speeds,
> because both copper (1000baseT) and optical (1000baseX) standards
> cannot be enabled at once.
> 
> Add a special treatment for 1000M speeds.
> 
> Fixes: 48cb27f2fd18 ("ice: Implement handlers for ethtool PHY/link operations")

This has a Fixes, but is targeted for "net-next", why is that?

> Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly
  2022-06-06 18:24 ` Tony Nguyen
@ 2022-06-07  6:01   ` Anatolii Gerasymenko
  0 siblings, 0 replies; 4+ messages in thread
From: Anatolii Gerasymenko @ 2022-06-07  6:01 UTC (permalink / raw)
  To: Tony Nguyen, intel-wired-lan

On 06.06.2022 20:24, Tony Nguyen wrote:
> 
> 
> On 6/6/2022 12:07 AM, Anatolii Gerasymenko wrote:
>> In current implementation ice_update_phy_type enables all link modes
>> for selected speed. This approach doesn't work for 1000M speeds,
>> because both copper (1000baseT) and optical (1000baseX) standards
>> cannot be enabled at once.
>>
>> Add a special treatment for 1000M speeds.
>>
>> Fixes: 48cb27f2fd18 ("ice: Implement handlers for ethtool PHY/link operations")
> 
> This has a Fixes, but is targeted for "net-next", why is that?
> 

This bug doesn't have a high priority.
But if I can send it to "net", it would be better.
I'll send a new patch.

>> Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
> 

Thank you,
Anatolii Gerasymenko
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-07  6:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  7:07 [Intel-wired-lan] [PATCH net-next v2] ice: ethtool: advertise 1000M speeds properly Anatolii Gerasymenko
2022-06-06  7:13 ` Anatolii Gerasymenko
2022-06-06 18:24 ` Tony Nguyen
2022-06-07  6:01   ` Anatolii Gerasymenko

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.