ixgbevf: Add support to recognize 100mb link speed
authorGreg Rose <gregory.v.rose@intel.com>
Tue, 10 Apr 2012 01:56:37 +0000 (01:56 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 3 May 2012 09:36:07 +0000 (02:36 -0700)
The X540 10Gig controller is capable of linking at 100Mbits - add
support for reporting that link speed.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbevf/defines.h
drivers/net/ethernet/intel/ixgbevf/ethtool.c
drivers/net/ethernet/intel/ixgbevf/vf.c

index 947b5c830735f6a26057d585a5042d31e20ccbcb..e09a6cc633bb883e520bb4216fa78de3ba9e04d4 100644 (file)
@@ -40,6 +40,7 @@
 typedef u32 ixgbe_link_speed;
 #define IXGBE_LINK_SPEED_1GB_FULL       0x0020
 #define IXGBE_LINK_SPEED_10GB_FULL      0x0080
+#define IXGBE_LINK_SPEED_100_FULL      0x0008
 
 #define IXGBE_CTRL_RST              0x04000000 /* Reset (SW) */
 #define IXGBE_RXDCTL_ENABLE         0x02000000 /* Enable specific Rx Queue */
@@ -48,6 +49,7 @@ typedef u32 ixgbe_link_speed;
 #define IXGBE_LINKS_SPEED_82599     0x30000000
 #define IXGBE_LINKS_SPEED_10G_82599 0x30000000
 #define IXGBE_LINKS_SPEED_1G_82599  0x20000000
+#define IXGBE_LINKS_SPEED_100_82599 0x10000000
 
 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
 #define IXGBE_REQ_TX_DESCRIPTOR_MULTIPLE  8
index 2bfe0d1d7958cba80d5396aa3a64178ed5e028ae..e8dddf572d3824330b75c105db97a36f5940f86c 100644 (file)
@@ -107,10 +107,20 @@ static int ixgbevf_get_settings(struct net_device *netdev,
        hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
 
        if (link_up) {
-               ethtool_cmd_speed_set(
-                       ecmd,
-                       (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
-                       SPEED_10000 : SPEED_1000);
+               __u32 speed = SPEED_10000;
+               switch (link_speed) {
+               case IXGBE_LINK_SPEED_10GB_FULL:
+                       speed = SPEED_10000;
+                       break;
+               case IXGBE_LINK_SPEED_1GB_FULL:
+                       speed = SPEED_1000;
+                       break;
+               case IXGBE_LINK_SPEED_100_FULL:
+                       speed = SPEED_100;
+                       break;
+               }
+
+               ethtool_cmd_speed_set(ecmd, speed);
                ecmd->duplex = DUPLEX_FULL;
        } else {
                ethtool_cmd_speed_set(ecmd, -1);
index 74be7411242a25de2662e84756fa8656e411465e..ec89b86f7ca4a66603c7128b3353d762928faf9c 100644 (file)
@@ -404,11 +404,17 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw,
        else
                *link_up = false;
 
-       if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
-           IXGBE_LINKS_SPEED_10G_82599)
+       switch (links_reg & IXGBE_LINKS_SPEED_82599) {
+       case IXGBE_LINKS_SPEED_10G_82599:
                *speed = IXGBE_LINK_SPEED_10GB_FULL;
-       else
+               break;
+       case IXGBE_LINKS_SPEED_1G_82599:
                *speed = IXGBE_LINK_SPEED_1GB_FULL;
+               break;
+       case IXGBE_LINKS_SPEED_100_82599:
+               *speed = IXGBE_LINK_SPEED_100_FULL;
+               break;
+       }
 
        return 0;
 }