Commit c156f856 authored by Matt Jared's avatar Matt Jared Committed by Jeff Kirsher

i40e: Fix multiple link up messages

This patch addresses an issue where multiple link up messages can be logged
resulting from aq link status timing when link properties are changed (fc,
speed, etc.); solved by using a single function to handle status printing
and adding a mechanism to track whether link state (up or down) has
actually changed.

Change-ID: Ied6ed6e49dc397c77d992adc0bc9ed3767152b9d
Signed-off-by: default avatarMatt Jared <matthew.a.jared@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 3487b6c3
...@@ -537,6 +537,7 @@ struct i40e_vsi { ...@@ -537,6 +537,7 @@ struct i40e_vsi {
u16 idx; /* index in pf->vsi[] */ u16 idx; /* index in pf->vsi[] */
u16 veb_idx; /* index of VEB parent */ u16 veb_idx; /* index of VEB parent */
struct kobject *kobj; /* sysfs object */ struct kobject *kobj; /* sysfs object */
bool current_isup; /* Sync 'link up' logging */
/* VSI specific handlers */ /* VSI specific handlers */
irqreturn_t (*irq_handler)(int irq, void *data); irqreturn_t (*irq_handler)(int irq, void *data);
...@@ -791,4 +792,5 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi); ...@@ -791,4 +792,5 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);
#endif /* _I40E_H_ */ #endif /* _I40E_H_ */
...@@ -690,7 +690,7 @@ static int i40e_set_settings(struct net_device *netdev, ...@@ -690,7 +690,7 @@ static int i40e_set_settings(struct net_device *netdev,
/* Tell the OS link is going down, the link will go /* Tell the OS link is going down, the link will go
* back up when fw says it is ready asynchronously * back up when fw says it is ready asynchronously
*/ */
netdev_info(netdev, "PHY settings change requested, NIC Link is going down.\n"); i40e_print_link_message(vsi, false);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
} }
...@@ -834,7 +834,7 @@ static int i40e_set_pauseparam(struct net_device *netdev, ...@@ -834,7 +834,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,
/* Tell the OS link is going down, the link will go back up when fw /* Tell the OS link is going down, the link will go back up when fw
* says it is ready asynchronously * says it is ready asynchronously
*/ */
netdev_info(netdev, "Flow control settings change requested, NIC Link is going down.\n"); i40e_print_link_message(vsi, false);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
......
...@@ -4837,11 +4837,14 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) ...@@ -4837,11 +4837,14 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
* i40e_print_link_message - print link up or down * i40e_print_link_message - print link up or down
* @vsi: the VSI for which link needs a message * @vsi: the VSI for which link needs a message
*/ */
static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup) void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
{ {
char speed[SPEED_SIZE] = "Unknown"; char speed[SPEED_SIZE] = "Unknown";
char fc[FC_SIZE] = "RX/TX"; char fc[FC_SIZE] = "RX/TX";
if (vsi->current_isup == isup)
return;
vsi->current_isup = isup;
if (!isup) { if (!isup) {
netdev_info(vsi->netdev, "NIC Link is Down\n"); netdev_info(vsi->netdev, "NIC Link is Down\n");
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment