Skip to content

Commit 124ed15

Browse files
Catherine SullivanJeff Kirsher
authored andcommitted
i40e: Add dual speed module support
Now that fw has implemented dual speed module support, we can add ours. Also, add the phy type for 1G LR/SR and set its media type to fiber. Lastly, instead of a WARN_ON if the phy type is not recognized just print a warning. Change-ID: I2e5227d4a8c2907b0ed423038e5dbce774e466b0 Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent b89df95 commit 124ed15

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

‎drivers/net/ethernet/intel/i40e/i40e_common.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)
752752
switch (hw->phy.link_info.phy_type) {
753753
case I40E_PHY_TYPE_10GBASE_SR:
754754
case I40E_PHY_TYPE_10GBASE_LR:
755+
case I40E_PHY_TYPE_1000BASE_SX:
756+
case I40E_PHY_TYPE_1000BASE_LX:
755757
case I40E_PHY_TYPE_40GBASE_SR4:
756758
case I40E_PHY_TYPE_40GBASE_LR4:
757759
media = I40E_MEDIA_TYPE_FIBER;

‎drivers/net/ethernet/intel/i40e/i40e_ethtool.c‎

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ static int i40e_get_settings(struct net_device *netdev,
313313
break;
314314
case I40E_PHY_TYPE_10GBASE_SR:
315315
case I40E_PHY_TYPE_10GBASE_LR:
316+
case I40E_PHY_TYPE_1000BASE_SX:
317+
case I40E_PHY_TYPE_1000BASE_LX:
316318
ecmd->supported = SUPPORTED_10000baseT_Full;
319+
ecmd->supported |= SUPPORTED_1000baseT_Full;
317320
break;
318321
case I40E_PHY_TYPE_10GBASE_CR1_CU:
319322
case I40E_PHY_TYPE_10GBASE_CR1:
@@ -352,7 +355,8 @@ static int i40e_get_settings(struct net_device *netdev,
352355
break;
353356
default:
354357
/* if we got here and link is up something bad is afoot */
355-
WARN_ON(link_up);
358+
netdev_info(netdev, "WARNING: Link is up but PHY type 0x%x is not recognized.\n",
359+
hw_link_info->phy_type);
356360
}
357361

358362
no_valid_phy_type:
@@ -493,11 +497,10 @@ static int i40e_set_settings(struct net_device *netdev,
493497
if (status)
494498
return -EAGAIN;
495499

496-
/* Copy link_speed and abilities to config in case they are not
500+
/* Copy abilities to config in case autoneg is not
497501
* set below
498502
*/
499503
memset(&config, 0, sizeof(struct i40e_aq_set_phy_config));
500-
config.link_speed = abilities.link_speed;
501504
config.abilities = abilities.abilities;
502505

503506
/* Check autoneg */
@@ -534,33 +537,21 @@ static int i40e_set_settings(struct net_device *netdev,
534537
return -EINVAL;
535538

536539
if (advertise & ADVERTISED_100baseT_Full)
537-
if (!(abilities.link_speed & I40E_LINK_SPEED_100MB)) {
538-
config.link_speed |= I40E_LINK_SPEED_100MB;
539-
change = true;
540-
}
540+
config.link_speed |= I40E_LINK_SPEED_100MB;
541541
if (advertise & ADVERTISED_1000baseT_Full ||
542542
advertise & ADVERTISED_1000baseKX_Full)
543-
if (!(abilities.link_speed & I40E_LINK_SPEED_1GB)) {
544-
config.link_speed |= I40E_LINK_SPEED_1GB;
545-
change = true;
546-
}
543+
config.link_speed |= I40E_LINK_SPEED_1GB;
547544
if (advertise & ADVERTISED_10000baseT_Full ||
548545
advertise & ADVERTISED_10000baseKX4_Full ||
549546
advertise & ADVERTISED_10000baseKR_Full)
550-
if (!(abilities.link_speed & I40E_LINK_SPEED_10GB)) {
551-
config.link_speed |= I40E_LINK_SPEED_10GB;
552-
change = true;
553-
}
547+
config.link_speed |= I40E_LINK_SPEED_10GB;
554548
if (advertise & ADVERTISED_40000baseKR4_Full ||
555549
advertise & ADVERTISED_40000baseCR4_Full ||
556550
advertise & ADVERTISED_40000baseSR4_Full ||
557551
advertise & ADVERTISED_40000baseLR4_Full)
558-
if (!(abilities.link_speed & I40E_LINK_SPEED_40GB)) {
559-
config.link_speed |= I40E_LINK_SPEED_40GB;
560-
change = true;
561-
}
552+
config.link_speed |= I40E_LINK_SPEED_40GB;
562553

563-
if (change) {
554+
if (change || (abilities.link_speed != config.link_speed)) {
564555
/* copy over the rest of the abilities */
565556
config.phy_type = abilities.phy_type;
566557
config.eee_capability = abilities.eee_capability;

0 commit comments

Comments
 (0)