diff options
author | David S. Miller <davem@davemloft.net> | 2013-05-23 21:54:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-23 21:54:17 -0400 |
commit | 7a9d645e132d46f2a47221434b852e038e7c53e0 (patch) | |
tree | 5105e8e6036e812eb184a0411227818663636d62 | |
parent | 340611ab7f8c95e9638bb8a181cb078e900dc5ec (diff) | |
parent | 84b6f7456e8b88507dd85f988a9d350eb5af0e46 (diff) |
Merge branch 'bnx2x'
Yuval Mintz says:
====================
This series contain several small enhancements - chief among those are
the implementation of ethtool's private flags callback to share information
about the storage offload capabilities of its network interfaces,
and the prevention of a link flap when booting from storage area networks.
Changes from V1:
- Patch 1, removed trailing whitespaces from private flag strings.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 54 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 38 |
5 files changed, 76 insertions, 32 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 3dba2a70a00e..946450d6d988 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1937,6 +1937,8 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, | |||
1937 | void bnx2x_update_coalesce(struct bnx2x *bp); | 1937 | void bnx2x_update_coalesce(struct bnx2x *bp); |
1938 | int bnx2x_get_cur_phy_idx(struct bnx2x *bp); | 1938 | int bnx2x_get_cur_phy_idx(struct bnx2x *bp); |
1939 | 1939 | ||
1940 | bool bnx2x_port_after_undi(struct bnx2x *bp); | ||
1941 | |||
1940 | static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | 1942 | static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, |
1941 | int wait) | 1943 | int wait) |
1942 | { | 1944 | { |
@@ -2137,6 +2139,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, | |||
2137 | #define ATTN_HARD_WIRED_MASK 0xff00 | 2139 | #define ATTN_HARD_WIRED_MASK 0xff00 |
2138 | #define ATTENTION_ID 4 | 2140 | #define ATTENTION_ID 4 |
2139 | 2141 | ||
2142 | #define IS_MF_STORAGE_ONLY(bp) (IS_MF_STORAGE_SD(bp) || \ | ||
2143 | IS_MF_FCOE_AFEX(bp)) | ||
2140 | 2144 | ||
2141 | /* stuff added to make the code fit 80Col */ | 2145 | /* stuff added to make the code fit 80Col */ |
2142 | 2146 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 6cc5101fa96b..f4d1c08c67d3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2183,6 +2183,8 @@ alloc_mem_err: | |||
2183 | /* send load request to mcp and analyze response */ | 2183 | /* send load request to mcp and analyze response */ |
2184 | static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code) | 2184 | static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code) |
2185 | { | 2185 | { |
2186 | u32 param; | ||
2187 | |||
2186 | /* init fw_seq */ | 2188 | /* init fw_seq */ |
2187 | bp->fw_seq = | 2189 | bp->fw_seq = |
2188 | (SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | 2190 | (SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & |
@@ -2195,9 +2197,13 @@ static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code) | |||
2195 | DRV_PULSE_SEQ_MASK); | 2197 | DRV_PULSE_SEQ_MASK); |
2196 | BNX2X_DEV_INFO("drv_pulse 0x%x\n", bp->fw_drv_pulse_wr_seq); | 2198 | BNX2X_DEV_INFO("drv_pulse 0x%x\n", bp->fw_drv_pulse_wr_seq); |
2197 | 2199 | ||
2200 | param = DRV_MSG_CODE_LOAD_REQ_WITH_LFA; | ||
2201 | |||
2202 | if (IS_MF_SD(bp) && bnx2x_port_after_undi(bp)) | ||
2203 | param |= DRV_MSG_CODE_LOAD_REQ_FORCE_LFA; | ||
2204 | |||
2198 | /* load request */ | 2205 | /* load request */ |
2199 | (*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, | 2206 | (*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, param); |
2200 | DRV_MSG_CODE_LOAD_REQ_WITH_LFA); | ||
2201 | 2207 | ||
2202 | /* if mcp fails to respond we must abort */ | 2208 | /* if mcp fails to respond we must abort */ |
2203 | if (!(*load_code)) { | 2209 | if (!(*load_code)) { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index ce1a91618677..32aa88f520dc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
@@ -1921,6 +1921,19 @@ static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = { | |||
1921 | "link_test (online) " | 1921 | "link_test (online) " |
1922 | }; | 1922 | }; |
1923 | 1923 | ||
1924 | enum { | ||
1925 | BNX2X_PRI_FLAG_ISCSI, | ||
1926 | BNX2X_PRI_FLAG_FCOE, | ||
1927 | BNX2X_PRI_FLAG_STORAGE, | ||
1928 | BNX2X_PRI_FLAG_LEN, | ||
1929 | }; | ||
1930 | |||
1931 | static const char bnx2x_private_arr[BNX2X_PRI_FLAG_LEN][ETH_GSTRING_LEN] = { | ||
1932 | "iSCSI offload support", | ||
1933 | "FCoE offload support", | ||
1934 | "Storage only interface" | ||
1935 | }; | ||
1936 | |||
1924 | static u32 bnx2x_eee_to_adv(u32 eee_adv) | 1937 | static u32 bnx2x_eee_to_adv(u32 eee_adv) |
1925 | { | 1938 | { |
1926 | u32 modes = 0; | 1939 | u32 modes = 0; |
@@ -2978,32 +2991,47 @@ static int bnx2x_num_stat_queues(struct bnx2x *bp) | |||
2978 | static int bnx2x_get_sset_count(struct net_device *dev, int stringset) | 2991 | static int bnx2x_get_sset_count(struct net_device *dev, int stringset) |
2979 | { | 2992 | { |
2980 | struct bnx2x *bp = netdev_priv(dev); | 2993 | struct bnx2x *bp = netdev_priv(dev); |
2981 | int i, num_stats; | 2994 | int i, num_strings = 0; |
2982 | 2995 | ||
2983 | switch (stringset) { | 2996 | switch (stringset) { |
2984 | case ETH_SS_STATS: | 2997 | case ETH_SS_STATS: |
2985 | if (is_multi(bp)) { | 2998 | if (is_multi(bp)) { |
2986 | num_stats = bnx2x_num_stat_queues(bp) * | 2999 | num_strings = bnx2x_num_stat_queues(bp) * |
2987 | BNX2X_NUM_Q_STATS; | 3000 | BNX2X_NUM_Q_STATS; |
2988 | } else | 3001 | } else |
2989 | num_stats = 0; | 3002 | num_strings = 0; |
2990 | if (IS_MF_MODE_STAT(bp)) { | 3003 | if (IS_MF_MODE_STAT(bp)) { |
2991 | for (i = 0; i < BNX2X_NUM_STATS; i++) | 3004 | for (i = 0; i < BNX2X_NUM_STATS; i++) |
2992 | if (IS_FUNC_STAT(i)) | 3005 | if (IS_FUNC_STAT(i)) |
2993 | num_stats++; | 3006 | num_strings++; |
2994 | } else | 3007 | } else |
2995 | num_stats += BNX2X_NUM_STATS; | 3008 | num_strings += BNX2X_NUM_STATS; |
2996 | 3009 | ||
2997 | return num_stats; | 3010 | return num_strings; |
2998 | 3011 | ||
2999 | case ETH_SS_TEST: | 3012 | case ETH_SS_TEST: |
3000 | return BNX2X_NUM_TESTS(bp); | 3013 | return BNX2X_NUM_TESTS(bp); |
3001 | 3014 | ||
3015 | case ETH_SS_PRIV_FLAGS: | ||
3016 | return BNX2X_PRI_FLAG_LEN; | ||
3017 | |||
3002 | default: | 3018 | default: |
3003 | return -EINVAL; | 3019 | return -EINVAL; |
3004 | } | 3020 | } |
3005 | } | 3021 | } |
3006 | 3022 | ||
3023 | static u32 bnx2x_get_private_flags(struct net_device *dev) | ||
3024 | { | ||
3025 | struct bnx2x *bp = netdev_priv(dev); | ||
3026 | u32 flags = 0; | ||
3027 | |||
3028 | flags |= (!(bp->flags & NO_ISCSI_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_ISCSI; | ||
3029 | flags |= (!(bp->flags & NO_FCOE_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_FCOE; | ||
3030 | flags |= (!!IS_MF_STORAGE_ONLY(bp)) << BNX2X_PRI_FLAG_STORAGE; | ||
3031 | |||
3032 | return flags; | ||
3033 | } | ||
3034 | |||
3007 | static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | 3035 | static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) |
3008 | { | 3036 | { |
3009 | struct bnx2x *bp = netdev_priv(dev); | 3037 | struct bnx2x *bp = netdev_priv(dev); |
@@ -3045,6 +3073,12 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |||
3045 | start = 4; | 3073 | start = 4; |
3046 | memcpy(buf, bnx2x_tests_str_arr + start, | 3074 | memcpy(buf, bnx2x_tests_str_arr + start, |
3047 | ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp)); | 3075 | ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp)); |
3076 | break; | ||
3077 | |||
3078 | case ETH_SS_PRIV_FLAGS: | ||
3079 | memcpy(buf, bnx2x_private_arr, | ||
3080 | ETH_GSTRING_LEN * BNX2X_PRI_FLAG_LEN); | ||
3081 | break; | ||
3048 | } | 3082 | } |
3049 | } | 3083 | } |
3050 | 3084 | ||
@@ -3112,11 +3146,6 @@ static int bnx2x_set_phys_id(struct net_device *dev, | |||
3112 | return -EAGAIN; | 3146 | return -EAGAIN; |
3113 | } | 3147 | } |
3114 | 3148 | ||
3115 | if (!bp->port.pmf) { | ||
3116 | DP(BNX2X_MSG_ETHTOOL, "Interface is not pmf\n"); | ||
3117 | return -EOPNOTSUPP; | ||
3118 | } | ||
3119 | |||
3120 | switch (state) { | 3149 | switch (state) { |
3121 | case ETHTOOL_ID_ACTIVE: | 3150 | case ETHTOOL_ID_ACTIVE: |
3122 | return 1; /* cycle on/off once per second */ | 3151 | return 1; /* cycle on/off once per second */ |
@@ -3445,6 +3474,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
3445 | .set_pauseparam = bnx2x_set_pauseparam, | 3474 | .set_pauseparam = bnx2x_set_pauseparam, |
3446 | .self_test = bnx2x_self_test, | 3475 | .self_test = bnx2x_self_test, |
3447 | .get_sset_count = bnx2x_get_sset_count, | 3476 | .get_sset_count = bnx2x_get_sset_count, |
3477 | .get_priv_flags = bnx2x_get_private_flags, | ||
3448 | .get_strings = bnx2x_get_strings, | 3478 | .get_strings = bnx2x_get_strings, |
3449 | .set_phys_id = bnx2x_set_phys_id, | 3479 | .set_phys_id = bnx2x_set_phys_id, |
3450 | .get_ethtool_stats = bnx2x_get_ethtool_stats, | 3480 | .get_ethtool_stats = bnx2x_get_ethtool_stats, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 12f00a40cdf0..5ef3f964e544 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -1323,6 +1323,8 @@ struct drv_func_mb { | |||
1323 | #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002 | 1323 | #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002 |
1324 | 1324 | ||
1325 | #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a | 1325 | #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a |
1326 | #define DRV_MSG_CODE_LOAD_REQ_FORCE_LFA 0x00002000 | ||
1327 | |||
1326 | u32 fw_mb_header; | 1328 | u32 fw_mb_header; |
1327 | #define FW_MSG_CODE_MASK 0xffff0000 | 1329 | #define FW_MSG_CODE_MASK 0xffff0000 |
1328 | #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000 | 1330 | #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index b4c9dea93a53..7ed9cdfa115e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -9780,6 +9780,21 @@ static bool bnx2x_prev_is_path_marked(struct bnx2x *bp) | |||
9780 | return rc; | 9780 | return rc; |
9781 | } | 9781 | } |
9782 | 9782 | ||
9783 | bool bnx2x_port_after_undi(struct bnx2x *bp) | ||
9784 | { | ||
9785 | struct bnx2x_prev_path_list *entry; | ||
9786 | bool val; | ||
9787 | |||
9788 | down(&bnx2x_prev_sem); | ||
9789 | |||
9790 | entry = bnx2x_prev_path_get_entry(bp); | ||
9791 | val = !!(entry && (entry->undi & (1 << BP_PORT(bp)))); | ||
9792 | |||
9793 | up(&bnx2x_prev_sem); | ||
9794 | |||
9795 | return val; | ||
9796 | } | ||
9797 | |||
9783 | static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi) | 9798 | static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi) |
9784 | { | 9799 | { |
9785 | struct bnx2x_prev_path_list *tmp_list; | 9800 | struct bnx2x_prev_path_list *tmp_list; |
@@ -10036,7 +10051,6 @@ static int bnx2x_prev_unload(struct bnx2x *bp) | |||
10036 | { | 10051 | { |
10037 | int time_counter = 10; | 10052 | int time_counter = 10; |
10038 | u32 rc, fw, hw_lock_reg, hw_lock_val; | 10053 | u32 rc, fw, hw_lock_reg, hw_lock_val; |
10039 | struct bnx2x_prev_path_list *prev_list; | ||
10040 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); | 10054 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); |
10041 | 10055 | ||
10042 | /* clear hw from errors which may have resulted from an interrupted | 10056 | /* clear hw from errors which may have resulted from an interrupted |
@@ -10107,8 +10121,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp) | |||
10107 | } | 10121 | } |
10108 | 10122 | ||
10109 | /* Mark function if its port was used to boot from SAN */ | 10123 | /* Mark function if its port was used to boot from SAN */ |
10110 | prev_list = bnx2x_prev_path_get_entry(bp); | 10124 | if (bnx2x_port_after_undi(bp)) |
10111 | if (prev_list && (prev_list->undi & (1 << BP_PORT(bp)))) | ||
10112 | bp->link_params.feature_config_flags |= | 10125 | bp->link_params.feature_config_flags |= |
10113 | FEATURE_CONFIG_BOOT_FROM_SAN; | 10126 | FEATURE_CONFIG_BOOT_FROM_SAN; |
10114 | 10127 | ||
@@ -12747,19 +12760,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) | |||
12747 | return 0; | 12760 | return 0; |
12748 | } | 12761 | } |
12749 | 12762 | ||
12750 | static void bnx2x_eeh_recover(struct bnx2x *bp) | ||
12751 | { | ||
12752 | u32 val; | ||
12753 | |||
12754 | mutex_init(&bp->port.phy_mutex); | ||
12755 | |||
12756 | |||
12757 | val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]); | ||
12758 | if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) | ||
12759 | != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) | ||
12760 | BNX2X_ERR("BAD MCP validity signature\n"); | ||
12761 | } | ||
12762 | |||
12763 | /** | 12763 | /** |
12764 | * bnx2x_io_error_detected - called when PCI error is detected | 12764 | * bnx2x_io_error_detected - called when PCI error is detected |
12765 | * @pdev: Pointer to PCI device | 12765 | * @pdev: Pointer to PCI device |
@@ -12828,6 +12828,10 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev) | |||
12828 | 12828 | ||
12829 | if (netif_running(dev)) { | 12829 | if (netif_running(dev)) { |
12830 | BNX2X_ERR("IO slot reset --> driver unload\n"); | 12830 | BNX2X_ERR("IO slot reset --> driver unload\n"); |
12831 | |||
12832 | /* MCP should have been reset; Need to wait for validity */ | ||
12833 | bnx2x_init_shmem(bp); | ||
12834 | |||
12831 | if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { | 12835 | if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { |
12832 | u32 v; | 12836 | u32 v; |
12833 | 12837 | ||
@@ -12886,8 +12890,6 @@ static void bnx2x_io_resume(struct pci_dev *pdev) | |||
12886 | 12890 | ||
12887 | rtnl_lock(); | 12891 | rtnl_lock(); |
12888 | 12892 | ||
12889 | bnx2x_eeh_recover(bp); | ||
12890 | |||
12891 | bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | 12893 | bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & |
12892 | DRV_MSG_SEQ_NUMBER_MASK; | 12894 | DRV_MSG_SEQ_NUMBER_MASK; |
12893 | 12895 | ||