aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_main.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index e9cd9bb16f39..484ada9758bb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4135,6 +4135,54 @@ out:
4135 return err; 4135 return err;
4136} 4136}
4137#endif /* CONFIG_I40E_DCB */ 4137#endif /* CONFIG_I40E_DCB */
4138#define SPEED_SIZE 14
4139#define FC_SIZE 8
4140/**
4141 * i40e_print_link_message - print link up or down
4142 * @vsi: the VSI for which link needs a message
4143 */
4144static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
4145{
4146 char speed[SPEED_SIZE] = "Unknown";
4147 char fc[FC_SIZE] = "RX/TX";
4148
4149 if (!isup) {
4150 netdev_info(vsi->netdev, "NIC Link is Down\n");
4151 return;
4152 }
4153
4154 switch (vsi->back->hw.phy.link_info.link_speed) {
4155 case I40E_LINK_SPEED_40GB:
4156 strncpy(speed, "40 Gbps", SPEED_SIZE);
4157 break;
4158 case I40E_LINK_SPEED_10GB:
4159 strncpy(speed, "10 Gbps", SPEED_SIZE);
4160 break;
4161 case I40E_LINK_SPEED_1GB:
4162 strncpy(speed, "1000 Mbps", SPEED_SIZE);
4163 break;
4164 default:
4165 break;
4166 }
4167
4168 switch (vsi->back->hw.fc.current_mode) {
4169 case I40E_FC_FULL:
4170 strncpy(fc, "RX/TX", FC_SIZE);
4171 break;
4172 case I40E_FC_TX_PAUSE:
4173 strncpy(fc, "TX", FC_SIZE);
4174 break;
4175 case I40E_FC_RX_PAUSE:
4176 strncpy(fc, "RX", FC_SIZE);
4177 break;
4178 default:
4179 strncpy(fc, "None", FC_SIZE);
4180 break;
4181 }
4182
4183 netdev_info(vsi->netdev, "NIC Link is Up %s Full Duplex, Flow Control: %s\n",
4184 speed, fc);
4185}
4138 4186
4139/** 4187/**
4140 * i40e_up_complete - Finish the last steps of bringing up a connection 4188 * i40e_up_complete - Finish the last steps of bringing up a connection
@@ -4161,11 +4209,11 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
4161 4209
4162 if ((pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP) && 4210 if ((pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP) &&
4163 (vsi->netdev)) { 4211 (vsi->netdev)) {
4164 netdev_info(vsi->netdev, "NIC Link is Up\n"); 4212 i40e_print_link_message(vsi, true);
4165 netif_tx_start_all_queues(vsi->netdev); 4213 netif_tx_start_all_queues(vsi->netdev);
4166 netif_carrier_on(vsi->netdev); 4214 netif_carrier_on(vsi->netdev);
4167 } else if (vsi->netdev) { 4215 } else if (vsi->netdev) {
4168 netdev_info(vsi->netdev, "NIC Link is Down\n"); 4216 i40e_print_link_message(vsi, false);
4169 } 4217 }
4170 4218
4171 /* replay FDIR SB filters */ 4219 /* replay FDIR SB filters */
@@ -4886,10 +4934,8 @@ static void i40e_link_event(struct i40e_pf *pf)
4886 4934
4887 if (new_link == old_link) 4935 if (new_link == old_link)
4888 return; 4936 return;
4889
4890 if (!test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state)) 4937 if (!test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state))
4891 netdev_info(pf->vsi[pf->lan_vsi]->netdev, 4938 i40e_print_link_message(pf->vsi[pf->lan_vsi], new_link);
4892 "NIC Link is %s\n", (new_link ? "Up" : "Down"));
4893 4939
4894 /* Notify the base of the switch tree connected to 4940 /* Notify the base of the switch tree connected to
4895 * the link. Floating VEBs are not notified. 4941 * the link. Floating VEBs are not notified.