aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorYaniv Rosner <Yaniv.Rosner@qlogic.com>2015-03-29 03:05:00 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-31 13:34:10 -0400
commitfcd02d27b5c543f2d4538d2ac402fed1154c6dfb (patch)
treebb40e0247bdaa28be0558108c156e7ae7f27a485 /drivers/net/ethernet/broadcom
parent30fd9ff0d9e0d1f83e0ae59cbef3b78648f42b46 (diff)
bnx2x: Count number of link changes
Number of link changes are now being stored in shared memory [by all possible link owners], for management use [as well as possible debug information for dumps]. Signed-off-by: Yaniv Rosner <Yaniv.Rosner@qlogic.com> Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com> Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c25
2 files changed, 27 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 06df560e1ade..058bc7328220 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -2258,8 +2258,8 @@ struct shmem2_region {
2258 #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000 2258 #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000
2259 2259
2260 u32 reserved5[2]; 2260 u32 reserved5[2];
2261 u32 reserved6[PORT_MAX]; 2261 u32 link_change_count[PORT_MAX]; /* Offset 0x160-0x164 */
2262 2262 #define LINK_CHANGE_COUNT_MASK 0xff /* Offset 0x168 */
2263 /* driver version for each personality */ 2263 /* driver version for each personality */
2264 struct os_drv_ver func_os_drv_ver[E2_FUNC_MAX]; /* Offset 0x16c */ 2264 struct os_drv_ver func_os_drv_ver[E2_FUNC_MAX]; /* Offset 0x16c */
2265 2265
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index a5b174345ce4..21a0d6afca4a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -6758,6 +6758,25 @@ static int bnx2x_update_link_up(struct link_params *params,
6758 msleep(20); 6758 msleep(20);
6759 return rc; 6759 return rc;
6760} 6760}
6761
6762static void bnx2x_chng_link_count(struct link_params *params, bool clear)
6763{
6764 struct bnx2x *bp = params->bp;
6765 u32 addr, val;
6766
6767 /* Verify the link_change_count is supported by the MFW */
6768 if (!(SHMEM2_HAS(bp, link_change_count)))
6769 return;
6770
6771 addr = params->shmem2_base +
6772 offsetof(struct shmem2_region, link_change_count[params->port]);
6773 if (clear)
6774 val = 0;
6775 else
6776 val = REG_RD(bp, addr) + 1;
6777 REG_WR(bp, addr, val);
6778}
6779
6761/* The bnx2x_link_update function should be called upon link 6780/* The bnx2x_link_update function should be called upon link
6762 * interrupt. 6781 * interrupt.
6763 * Link is considered up as follows: 6782 * Link is considered up as follows:
@@ -6776,6 +6795,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
6776 struct link_vars phy_vars[MAX_PHYS]; 6795 struct link_vars phy_vars[MAX_PHYS];
6777 u8 port = params->port; 6796 u8 port = params->port;
6778 u8 link_10g_plus, phy_index; 6797 u8 link_10g_plus, phy_index;
6798 u32 prev_link_status = vars->link_status;
6779 u8 ext_phy_link_up = 0, cur_link_up; 6799 u8 ext_phy_link_up = 0, cur_link_up;
6780 int rc = 0; 6800 int rc = 0;
6781 u8 is_mi_int = 0; 6801 u8 is_mi_int = 0;
@@ -7015,6 +7035,9 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
7015 else 7035 else
7016 rc = bnx2x_update_link_down(params, vars); 7036 rc = bnx2x_update_link_down(params, vars);
7017 7037
7038 if ((prev_link_status ^ vars->link_status) & LINK_STATUS_LINK_UP)
7039 bnx2x_chng_link_count(params, false);
7040
7018 /* Update MCP link status was changed */ 7041 /* Update MCP link status was changed */
7019 if (params->feature_config_flags & FEATURE_CONFIG_BC_SUPPORTS_AFEX) 7042 if (params->feature_config_flags & FEATURE_CONFIG_BC_SUPPORTS_AFEX)
7020 bnx2x_fw_command(bp, DRV_MSG_CODE_LINK_STATUS_CHANGED, 0); 7043 bnx2x_fw_command(bp, DRV_MSG_CODE_LINK_STATUS_CHANGED, 0);
@@ -12658,6 +12681,7 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
12658 params->link_flags = PHY_INITIALIZED; 12681 params->link_flags = PHY_INITIALIZED;
12659 /* Driver opens NIG-BRB filters */ 12682 /* Driver opens NIG-BRB filters */
12660 bnx2x_set_rx_filter(params, 1); 12683 bnx2x_set_rx_filter(params, 1);
12684 bnx2x_chng_link_count(params, true);
12661 /* Check if link flap can be avoided */ 12685 /* Check if link flap can be avoided */
12662 lfa_status = bnx2x_check_lfa(params); 12686 lfa_status = bnx2x_check_lfa(params);
12663 12687
@@ -12732,6 +12756,7 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
12732 DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port); 12756 DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port);
12733 /* Disable attentions */ 12757 /* Disable attentions */
12734 vars->link_status = 0; 12758 vars->link_status = 0;
12759 bnx2x_chng_link_count(params, true);
12735 bnx2x_update_mng(params, vars->link_status); 12760 bnx2x_update_mng(params, vars->link_status);
12736 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK | 12761 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK |
12737 SHMEM_EEE_ACTIVE_BIT); 12762 SHMEM_EEE_ACTIVE_BIT);