Selaa lähdekoodia

ixgbe: add check for supported modes

When setting advertised speed/duplex with ethtool.

Also cleaned up the comment since we also support 100/F.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Emil Tantilov 14 vuotta sitten
vanhempi
commit
abcc80d26c
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

+ 7 - 3
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

@@ -324,12 +324,16 @@ static int ixgbe_set_settings(struct net_device *netdev,
 
 
 	if ((hw->phy.media_type == ixgbe_media_type_copper) ||
 	if ((hw->phy.media_type == ixgbe_media_type_copper) ||
 	    (hw->phy.multispeed_fiber)) {
 	    (hw->phy.multispeed_fiber)) {
-		/* 10000/copper and 1000/copper must autoneg
-		 * this function does not support any duplex forcing, but can
-		 * limit the advertising of the adapter to only 10000 or 1000 */
+		/*
+		 * this function does not support duplex forcing, but can
+		 * limit the advertising of the adapter to the specified speed
+		 */
 		if (ecmd->autoneg == AUTONEG_DISABLE)
 		if (ecmd->autoneg == AUTONEG_DISABLE)
 			return -EINVAL;
 			return -EINVAL;
 
 
+		if (ecmd->advertising & ~ecmd->supported)
+			return -EINVAL;
+
 		old = hw->phy.autoneg_advertised;
 		old = hw->phy.autoneg_advertised;
 		advertised = 0;
 		advertised = 0;
 		if (ecmd->advertising & ADVERTISED_10000baseT_Full)
 		if (ecmd->advertising & ADVERTISED_10000baseT_Full)