i40e: Save link FEC info from link up event
authorHenry Tieman <henry.w.tieman@intel.com>
Fri, 2 Dec 2016 20:32:57 +0000 (12:32 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sun, 12 Feb 2017 04:39:01 +0000 (20:39 -0800)
Store the FEC status bits from the link up event into the
hw_link_info structure.

Change-ID: I9a7b256f6dfb0dce89c2f503075d0d383526832e
Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_type.h
drivers/net/ethernet/intel/i40evf/i40e_type.h

index 128735975caa2472cd93a4f9162f857e459f16cd..fc73e4ef27aca7568ae65af20425b7bcaf416f07 100644 (file)
@@ -1838,6 +1838,8 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
        hw_link_info->link_speed = (enum i40e_aq_link_speed)resp->link_speed;
        hw_link_info->link_info = resp->link_info;
        hw_link_info->an_info = resp->an_info;
+       hw_link_info->fec_info = resp->config & (I40E_AQ_CONFIG_FEC_KR_ENA |
+                                                I40E_AQ_CONFIG_FEC_RS_ENA);
        hw_link_info->ext_info = resp->ext_info;
        hw_link_info->loopback = resp->loopback;
        hw_link_info->max_frame_size = le16_to_cpu(resp->max_frame_size);
index 0f00b1aa370d9c17bddc47f8b51a3622d820942d..fa4a04da47b74b373df58cb0c4043ce0c062c4da 100644 (file)
@@ -5272,6 +5272,8 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
        enum i40e_aq_link_speed new_speed;
        char *speed = "Unknown";
        char *fc = "Unknown";
+       char *fec = "";
+       char *an = "";
 
        new_speed = vsi->back->hw.phy.link_info.link_speed;
 
@@ -5331,8 +5333,23 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
                break;
        }
 
-       netdev_info(vsi->netdev, "NIC Link is Up %sbps Full Duplex, Flow Control: %s\n",
-                   speed, fc);
+       if (vsi->back->hw.phy.link_info.link_speed == I40E_LINK_SPEED_25GB) {
+               fec = ", FEC: None";
+               an = ", Autoneg: False";
+
+               if (vsi->back->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED)
+                       an = ", Autoneg: True";
+
+               if (vsi->back->hw.phy.link_info.fec_info &
+                   I40E_AQ_CONFIG_FEC_KR_ENA)
+                       fec = ", FEC: CL74 FC-FEC/BASE-R";
+               else if (vsi->back->hw.phy.link_info.fec_info &
+                        I40E_AQ_CONFIG_FEC_RS_ENA)
+                       fec = ", FEC: CL108 RS-FEC";
+       }
+
+       netdev_info(vsi->netdev, "NIC Link is Up, %sbps Full Duplex%s%s, Flow Control: %s\n",
+                   speed, fec, an, fc);
 }
 
 /**
index 9e9ae9f840167d88822a5735f59d834ff18d4a8b..939f9fdc8f8573fa35554d6917e1722348d2da29 100644 (file)
@@ -184,6 +184,7 @@ struct i40e_link_status {
        enum i40e_aq_link_speed link_speed;
        u8 link_info;
        u8 an_info;
+       u8 fec_info;
        u8 ext_info;
        u8 loopback;
        /* is Link Status Event notification to SW enabled */
index 3f19dff964ea65411f94ba8db1a3cb0111e32858..16bb88084bb977f900e91dcbce154e0e6ef447c8 100644 (file)
@@ -158,6 +158,7 @@ struct i40e_link_status {
        enum i40e_aq_link_speed link_speed;
        u8 link_info;
        u8 an_info;
+       u8 fec_info;
        u8 ext_info;
        u8 loopback;
        /* is Link Status Event notification to SW enabled */