@@ -3411,18 +3411,15 @@ static u32 sky2_supported_modes(const struct sky2_hw *hw)
3411
3411
u32 modes = SUPPORTED_10baseT_Half
3412
3412
| SUPPORTED_10baseT_Full
3413
3413
| SUPPORTED_100baseT_Half
3414
- | SUPPORTED_100baseT_Full
3415
- | SUPPORTED_Autoneg | SUPPORTED_TP ;
3414
+ | SUPPORTED_100baseT_Full ;
3416
3415
3417
3416
if (hw -> flags & SKY2_HW_GIGABIT )
3418
3417
modes |= SUPPORTED_1000baseT_Half
3419
3418
| SUPPORTED_1000baseT_Full ;
3420
3419
return modes ;
3421
3420
} else
3422
- return SUPPORTED_1000baseT_Half
3423
- | SUPPORTED_1000baseT_Full
3424
- | SUPPORTED_Autoneg
3425
- | SUPPORTED_FIBRE ;
3421
+ return SUPPORTED_1000baseT_Half
3422
+ | SUPPORTED_1000baseT_Full ;
3426
3423
}
3427
3424
3428
3425
static int sky2_get_settings (struct net_device * dev , struct ethtool_cmd * ecmd )
@@ -3436,9 +3433,11 @@ static int sky2_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
3436
3433
if (sky2_is_copper (hw )) {
3437
3434
ecmd -> port = PORT_TP ;
3438
3435
ecmd -> speed = sky2 -> speed ;
3436
+ ecmd -> supported |= SUPPORTED_Autoneg | SUPPORTED_TP ;
3439
3437
} else {
3440
3438
ecmd -> speed = SPEED_1000 ;
3441
3439
ecmd -> port = PORT_FIBRE ;
3440
+ ecmd -> supported |= SUPPORTED_Autoneg | SUPPORTED_FIBRE ;
3442
3441
}
3443
3442
3444
3443
ecmd -> advertising = sky2 -> advertising ;
@@ -3455,8 +3454,19 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
3455
3454
u32 supported = sky2_supported_modes (hw );
3456
3455
3457
3456
if (ecmd -> autoneg == AUTONEG_ENABLE ) {
3457
+ if (ecmd -> advertising & ~supported )
3458
+ return - EINVAL ;
3459
+
3460
+ if (sky2_is_copper (hw ))
3461
+ sky2 -> advertising = ecmd -> advertising |
3462
+ ADVERTISED_TP |
3463
+ ADVERTISED_Autoneg ;
3464
+ else
3465
+ sky2 -> advertising = ecmd -> advertising |
3466
+ ADVERTISED_FIBRE |
3467
+ ADVERTISED_Autoneg ;
3468
+
3458
3469
sky2 -> flags |= SKY2_FLAG_AUTO_SPEED ;
3459
- ecmd -> advertising = supported ;
3460
3470
sky2 -> duplex = -1 ;
3461
3471
sky2 -> speed = -1 ;
3462
3472
} else {
@@ -3500,8 +3510,6 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
3500
3510
sky2 -> flags &= ~SKY2_FLAG_AUTO_SPEED ;
3501
3511
}
3502
3512
3503
- sky2 -> advertising = ecmd -> advertising ;
3504
-
3505
3513
if (netif_running (dev )) {
3506
3514
sky2_phy_reinit (sky2 );
3507
3515
sky2_set_multicast (dev );
0 commit comments