aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic/qlcnic
diff options
context:
space:
mode:
authorSony Chacko <sony.chacko@qlogic.com>2012-12-03 22:33:53 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-04 13:00:11 -0500
commit797884509d1f7dffa4fd1028a1f62a19705a518b (patch)
tree2ccf6985999662d36165d24319a0a487db5b2952 /drivers/net/ethernet/qlogic/qlcnic
parent97ee45eb099a9a0f1dc992f98e9476cc159ee5e0 (diff)
qlcnic: move HW specific data to seperate structure
Move HW specific data to a seperate structure as part of refactoring 82xx adapter driver. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: Sony Chacko <sony.chacko@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h67
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c29
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c70
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c30
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c24
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c104
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c24
8 files changed, 177 insertions, 173 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index ebc5b069dddd..352a1e42cc36 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -365,11 +365,41 @@ struct qlcnic_hardware_context {
365 u8 pci_func; 365 u8 pci_func;
366 u8 linkup; 366 u8 linkup;
367 u8 loopback_state; 367 u8 loopback_state;
368 u8 beacon_state;
369 u8 has_link_events;
370 u8 fw_type;
371 u8 physical_port;
372 u8 reset_context;
373 u8 msix_supported;
374 u8 max_mac_filters;
375 u8 mc_enabled;
376 u8 max_mc_count;
377 u8 diag_test;
378 u8 num_msix;
379 u8 nic_mode;
380 char diag_cnt;
381
368 u16 port_type; 382 u16 port_type;
369 u16 board_type; 383 u16 board_type;
370 384
371 u8 beacon_state; 385 u16 link_speed;
386 u16 link_duplex;
387 u16 link_autoneg;
388 u16 module_type;
389
390 u16 op_mode;
391 u16 switch_mode;
392 u16 max_tx_ques;
393 u16 max_rx_ques;
394 u16 max_mtu;
395 u32 msg_enable;
396 u16 act_pci_func;
372 397
398 u32 capabilities;
399 u32 temp;
400 u32 int_vec_bit;
401 u32 fw_hal_version;
402 struct qlcnic_hardware_ops *hw_ops;
373 struct qlcnic_nic_intr_coalesce coal; 403 struct qlcnic_nic_intr_coalesce coal;
374 struct qlcnic_fw_dump fw_dump; 404 struct qlcnic_fw_dump fw_dump;
375}; 405};
@@ -430,6 +460,7 @@ struct qlcnic_host_sds_ring {
430} ____cacheline_internodealigned_in_smp; 460} ____cacheline_internodealigned_in_smp;
431 461
432struct qlcnic_host_tx_ring { 462struct qlcnic_host_tx_ring {
463 u16 ctx_id;
433 u32 producer; 464 u32 producer;
434 u32 sw_consumer; 465 u32 sw_consumer;
435 u32 num_desc; 466 u32 num_desc;
@@ -894,6 +925,7 @@ struct qlcnic_adapter {
894 unsigned long state; 925 unsigned long state;
895 u32 flags; 926 u32 flags;
896 927
928 int max_drv_tx_rings;
897 u16 num_txd; 929 u16 num_txd;
898 u16 num_rxd; 930 u16 num_rxd;
899 u16 num_jumbo_rxd; 931 u16 num_jumbo_rxd;
@@ -902,57 +934,28 @@ struct qlcnic_adapter {
902 934
903 u8 max_rds_rings; 935 u8 max_rds_rings;
904 u8 max_sds_rings; 936 u8 max_sds_rings;
905 u8 msix_supported;
906 u8 portnum; 937 u8 portnum;
907 u8 physical_port;
908 u8 reset_context;
909 938
910 u8 mc_enabled;
911 u8 max_mc_count;
912 u8 fw_wait_cnt; 939 u8 fw_wait_cnt;
913 u8 fw_fail_cnt; 940 u8 fw_fail_cnt;
914 u8 tx_timeo_cnt; 941 u8 tx_timeo_cnt;
915 u8 need_fw_reset; 942 u8 need_fw_reset;
916 943
917 u8 has_link_events;
918 u8 fw_type;
919 u16 tx_context_id;
920 u16 is_up; 944 u16 is_up;
921
922 u16 link_speed;
923 u16 link_duplex;
924 u16 link_autoneg;
925 u16 module_type;
926
927 u16 op_mode;
928 u16 switch_mode;
929 u16 max_tx_ques;
930 u16 max_rx_ques;
931 u16 max_mtu;
932 u16 pvid; 945 u16 pvid;
933 946
934 u32 fw_hal_version;
935 u32 capabilities;
936 u32 irq; 947 u32 irq;
937 u32 temp;
938
939 u32 int_vec_bit;
940 u32 heartbeat; 948 u32 heartbeat;
941 949
942 u8 max_mac_filters;
943 u8 dev_state; 950 u8 dev_state;
944 u8 diag_test;
945 char diag_cnt;
946 u8 reset_ack_timeo; 951 u8 reset_ack_timeo;
947 u8 dev_init_timeo; 952 u8 dev_init_timeo;
948 u16 msg_enable;
949 953
950 u8 mac_addr[ETH_ALEN]; 954 u8 mac_addr[ETH_ALEN];
951 955
952 u64 dev_rst_time; 956 u64 dev_rst_time;
953 u8 mac_learn; 957 u8 mac_learn;
954 unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)]; 958 unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)];
955
956 struct qlcnic_npar_info *npars; 959 struct qlcnic_npar_info *npars;
957 struct qlcnic_eswitch *eswitch; 960 struct qlcnic_eswitch *eswitch;
958 struct qlcnic_nic_template *nic_ops; 961 struct qlcnic_nic_template *nic_ops;
@@ -966,10 +969,8 @@ struct qlcnic_adapter {
966 void __iomem *isr_int_vec; 969 void __iomem *isr_int_vec;
967 970
968 struct msix_entry *msix_entries; 971 struct msix_entry *msix_entries;
969
970 struct delayed_work fw_work; 972 struct delayed_work fw_work;
971 973
972
973 struct qlcnic_filter_hash fhash; 974 struct qlcnic_filter_hash fhash;
974 975
975 spinlock_t tx_clean_lock; 976 spinlock_t tx_clean_lock;
@@ -1509,7 +1510,7 @@ struct qlcnic_nic_template {
1509}; 1510};
1510 1511
1511#define QLCDB(adapter, lvl, _fmt, _args...) do { \ 1512#define QLCDB(adapter, lvl, _fmt, _args...) do { \
1512 if (NETIF_MSG_##lvl & adapter->msg_enable) \ 1513 if (NETIF_MSG_##lvl & adapter->ahw->msg_enable) \
1513 printk(KERN_INFO "%s: %s: " _fmt, \ 1514 printk(KERN_INFO "%s: %s: " _fmt, \
1514 dev_name(&adapter->pdev->dev), \ 1515 dev_name(&adapter->pdev->dev), \
1515 __func__, ##_args); \ 1516 __func__, ##_args); \
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index bd31104557b4..c5cfbaa832a8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -35,7 +35,7 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd)
35 struct qlcnic_hardware_context *ahw = adapter->ahw; 35 struct qlcnic_hardware_context *ahw = adapter->ahw;
36 36
37 signature = QLCNIC_CDRP_SIGNATURE_MAKE(ahw->pci_func, 37 signature = QLCNIC_CDRP_SIGNATURE_MAKE(ahw->pci_func,
38 adapter->fw_hal_version); 38 adapter->ahw->fw_hal_version);
39 39
40 /* Acquire semaphore before accessing CRB */ 40 /* Acquire semaphore before accessing CRB */
41 if (qlcnic_api_lock(adapter)) { 41 if (qlcnic_api_lock(adapter)) {
@@ -455,8 +455,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter)
455 temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); 455 temp = le32_to_cpu(prsp->cds_ring.host_producer_crb);
456 tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp; 456 tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp;
457 457
458 adapter->tx_context_id = 458 adapter->tx_ring->ctx_id = le16_to_cpu(prsp->context_id);
459 le16_to_cpu(prsp->context_id);
460 } else { 459 } else {
461 dev_err(&adapter->pdev->dev, 460 dev_err(&adapter->pdev->dev,
462 "Failed to create tx ctx in firmware%d\n", err); 461 "Failed to create tx ctx in firmware%d\n", err);
@@ -478,7 +477,7 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
478 struct qlcnic_cmd_args cmd; 477 struct qlcnic_cmd_args cmd;
479 478
480 memset(&cmd, 0, sizeof(cmd)); 479 memset(&cmd, 0, sizeof(cmd));
481 cmd.req.arg1 = adapter->tx_context_id; 480 cmd.req.arg1 = adapter->tx_ring->ctx_id;
482 cmd.req.arg2 = QLCNIC_DESTROY_CTX_RESET; 481 cmd.req.arg2 = QLCNIC_DESTROY_CTX_RESET;
483 cmd.req.arg3 = 0; 482 cmd.req.arg3 = 0;
484 cmd.req.cmd = QLCNIC_CDRP_CMD_DESTROY_TX_CTX; 483 cmd.req.cmd = QLCNIC_CDRP_CMD_DESTROY_TX_CTX;
@@ -750,7 +749,7 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic)
750 struct qlcnic_info_le *nic_info; 749 struct qlcnic_info_le *nic_info;
751 size_t nic_size = sizeof(struct qlcnic_info_le); 750 size_t nic_size = sizeof(struct qlcnic_info_le);
752 751
753 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 752 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
754 return err; 753 return err;
755 754
756 nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, 755 nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
@@ -850,8 +849,8 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
850 u32 arg1; 849 u32 arg1;
851 struct qlcnic_cmd_args cmd; 850 struct qlcnic_cmd_args cmd;
852 851
853 if (adapter->op_mode != QLCNIC_MGMT_FUNC || 852 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC ||
854 !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) 853 !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE))
855 return err; 854 return err;
856 855
857 arg1 = id | (enable_mirroring ? BIT_4 : 0); 856 arg1 = id | (enable_mirroring ? BIT_4 : 0);
@@ -890,8 +889,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
890 if (esw_stats == NULL) 889 if (esw_stats == NULL)
891 return -ENOMEM; 890 return -ENOMEM;
892 891
893 if (adapter->op_mode != QLCNIC_MGMT_FUNC && 892 if ((adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) &&
894 func != adapter->ahw->pci_func) { 893 (func != adapter->ahw->pci_func)) {
895 dev_err(&adapter->pdev->dev, 894 dev_err(&adapter->pdev->dev,
896 "Not privilege to query stats for func=%d", func); 895 "Not privilege to query stats for func=%d", func);
897 return -EIO; 896 return -EIO;
@@ -1002,7 +1001,7 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
1002 1001
1003 if (esw_stats == NULL) 1002 if (esw_stats == NULL)
1004 return -ENOMEM; 1003 return -ENOMEM;
1005 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 1004 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
1006 return -EIO; 1005 return -EIO;
1007 if (adapter->npars == NULL) 1006 if (adapter->npars == NULL)
1008 return -EIO; 1007 return -EIO;
@@ -1053,7 +1052,7 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw,
1053 u32 arg1; 1052 u32 arg1;
1054 struct qlcnic_cmd_args cmd; 1053 struct qlcnic_cmd_args cmd;
1055 1054
1056 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 1055 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
1057 return -EIO; 1056 return -EIO;
1058 1057
1059 if (func_esw == QLCNIC_STATS_PORT) { 1058 if (func_esw == QLCNIC_STATS_PORT) {
@@ -1126,7 +1125,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter,
1126 struct qlcnic_cmd_args cmd; 1125 struct qlcnic_cmd_args cmd;
1127 u8 pci_func; 1126 u8 pci_func;
1128 1127
1129 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 1128 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
1130 return err; 1129 return err;
1131 pci_func = esw_cfg->pci_func; 1130 pci_func = esw_cfg->pci_func;
1132 arg1 = (adapter->npars[pci_func].phy_port & BIT_0); 1131 arg1 = (adapter->npars[pci_func].phy_port & BIT_0);
@@ -1141,7 +1140,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter,
1141 case QLCNIC_PORT_DEFAULTS: 1140 case QLCNIC_PORT_DEFAULTS:
1142 arg1 |= (BIT_4 | BIT_6 | BIT_7); 1141 arg1 |= (BIT_4 | BIT_6 | BIT_7);
1143 arg2 |= (BIT_0 | BIT_1); 1142 arg2 |= (BIT_0 | BIT_1);
1144 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) 1143 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
1145 arg2 |= (BIT_2 | BIT_3); 1144 arg2 |= (BIT_2 | BIT_3);
1146 if (!(esw_cfg->discard_tagged)) 1145 if (!(esw_cfg->discard_tagged))
1147 arg1 &= ~BIT_4; 1146 arg1 &= ~BIT_4;
@@ -1194,10 +1193,10 @@ qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter,
1194{ 1193{
1195 u32 arg1, arg2; 1194 u32 arg1, arg2;
1196 u8 phy_port; 1195 u8 phy_port;
1197 if (adapter->op_mode == QLCNIC_MGMT_FUNC) 1196 if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC)
1198 phy_port = adapter->npars[esw_cfg->pci_func].phy_port; 1197 phy_port = adapter->npars[esw_cfg->pci_func].phy_port;
1199 else 1198 else
1200 phy_port = adapter->physical_port; 1199 phy_port = adapter->ahw->physical_port;
1201 arg1 = phy_port; 1200 arg1 = phy_port;
1202 arg1 |= (esw_cfg->pci_func << 8); 1201 arg1 |= (esw_cfg->pci_func << 8);
1203 if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2)) 1202 if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2))
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 4a9425b56edc..74b98110c5b4 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -208,9 +208,9 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
208 ADVERTISED_1000baseT_Half | 208 ADVERTISED_1000baseT_Half |
209 ADVERTISED_1000baseT_Full); 209 ADVERTISED_1000baseT_Full);
210 210
211 ethtool_cmd_speed_set(ecmd, adapter->link_speed); 211 ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed);
212 ecmd->duplex = adapter->link_duplex; 212 ecmd->duplex = adapter->ahw->link_duplex;
213 ecmd->autoneg = adapter->link_autoneg; 213 ecmd->autoneg = adapter->ahw->link_autoneg;
214 214
215 } else if (adapter->ahw->port_type == QLCNIC_XGBE) { 215 } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
216 u32 val; 216 u32 val;
@@ -224,10 +224,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
224 ecmd->advertising = ADVERTISED_10000baseT_Full; 224 ecmd->advertising = ADVERTISED_10000baseT_Full;
225 } 225 }
226 226
227 if (netif_running(dev) && adapter->has_link_events) { 227 if (netif_running(dev) && adapter->ahw->has_link_events) {
228 ethtool_cmd_speed_set(ecmd, adapter->link_speed); 228 ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed);
229 ecmd->autoneg = adapter->link_autoneg; 229 ecmd->autoneg = adapter->ahw->link_autoneg;
230 ecmd->duplex = adapter->link_duplex; 230 ecmd->duplex = adapter->ahw->link_duplex;
231 goto skip; 231 goto skip;
232 } 232 }
233 233
@@ -238,7 +238,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
238 return -EIO; 238 return -EIO;
239 239
240skip: 240skip:
241 ecmd->phy_address = adapter->physical_port; 241 ecmd->phy_address = adapter->ahw->physical_port;
242 ecmd->transceiver = XCVR_EXTERNAL; 242 ecmd->transceiver = XCVR_EXTERNAL;
243 243
244 switch (adapter->ahw->board_type) { 244 switch (adapter->ahw->board_type) {
@@ -254,7 +254,7 @@ skip:
254 ecmd->supported |= SUPPORTED_TP; 254 ecmd->supported |= SUPPORTED_TP;
255 ecmd->advertising |= ADVERTISED_TP; 255 ecmd->advertising |= ADVERTISED_TP;
256 ecmd->port = PORT_TP; 256 ecmd->port = PORT_TP;
257 ecmd->autoneg = adapter->link_autoneg; 257 ecmd->autoneg = adapter->ahw->link_autoneg;
258 break; 258 break;
259 case QLCNIC_BRDTYPE_P3P_IMEZ: 259 case QLCNIC_BRDTYPE_P3P_IMEZ:
260 case QLCNIC_BRDTYPE_P3P_XG_LOM: 260 case QLCNIC_BRDTYPE_P3P_XG_LOM:
@@ -270,7 +270,7 @@ skip:
270 ecmd->advertising |= ADVERTISED_TP; 270 ecmd->advertising |= ADVERTISED_TP;
271 ecmd->supported |= SUPPORTED_TP; 271 ecmd->supported |= SUPPORTED_TP;
272 check_sfp_module = netif_running(dev) && 272 check_sfp_module = netif_running(dev) &&
273 adapter->has_link_events; 273 adapter->ahw->has_link_events;
274 case QLCNIC_BRDTYPE_P3P_10G_XFP: 274 case QLCNIC_BRDTYPE_P3P_10G_XFP:
275 ecmd->supported |= SUPPORTED_FIBRE; 275 ecmd->supported |= SUPPORTED_FIBRE;
276 ecmd->advertising |= ADVERTISED_FIBRE; 276 ecmd->advertising |= ADVERTISED_FIBRE;
@@ -285,7 +285,7 @@ skip:
285 (ADVERTISED_FIBRE | ADVERTISED_TP); 285 (ADVERTISED_FIBRE | ADVERTISED_TP);
286 ecmd->port = PORT_FIBRE; 286 ecmd->port = PORT_FIBRE;
287 check_sfp_module = netif_running(dev) && 287 check_sfp_module = netif_running(dev) &&
288 adapter->has_link_events; 288 adapter->ahw->has_link_events;
289 } else { 289 } else {
290 ecmd->autoneg = AUTONEG_ENABLE; 290 ecmd->autoneg = AUTONEG_ENABLE;
291 ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); 291 ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg);
@@ -301,7 +301,7 @@ skip:
301 } 301 }
302 302
303 if (check_sfp_module) { 303 if (check_sfp_module) {
304 switch (adapter->module_type) { 304 switch (adapter->ahw->module_type) {
305 case LINKEVENT_MODULE_OPTICAL_UNKNOWN: 305 case LINKEVENT_MODULE_OPTICAL_UNKNOWN:
306 case LINKEVENT_MODULE_OPTICAL_SRLR: 306 case LINKEVENT_MODULE_OPTICAL_SRLR:
307 case LINKEVENT_MODULE_OPTICAL_LRM: 307 case LINKEVENT_MODULE_OPTICAL_LRM:
@@ -359,9 +359,9 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
359 else if (ret) 359 else if (ret)
360 return -EIO; 360 return -EIO;
361 361
362 adapter->link_speed = ethtool_cmd_speed(ecmd); 362 adapter->ahw->link_speed = ethtool_cmd_speed(ecmd);
363 adapter->link_duplex = ecmd->duplex; 363 adapter->ahw->link_duplex = ecmd->duplex;
364 adapter->link_autoneg = ecmd->autoneg; 364 adapter->ahw->link_autoneg = ecmd->autoneg;
365 365
366 if (!netif_running(dev)) 366 if (!netif_running(dev))
367 return 0; 367 return 0;
@@ -508,14 +508,15 @@ qlcnic_set_ringparam(struct net_device *dev,
508static void qlcnic_get_channels(struct net_device *dev, 508static void qlcnic_get_channels(struct net_device *dev,
509 struct ethtool_channels *channel) 509 struct ethtool_channels *channel)
510{ 510{
511 int min;
511 struct qlcnic_adapter *adapter = netdev_priv(dev); 512 struct qlcnic_adapter *adapter = netdev_priv(dev);
512 513
513 channel->max_rx = rounddown_pow_of_two(min_t(int, 514 min = min_t(int, adapter->ahw->max_rx_ques, num_online_cpus());
514 adapter->max_rx_ques, num_online_cpus())); 515 channel->max_rx = rounddown_pow_of_two(min);
515 channel->max_tx = adapter->max_tx_ques; 516 channel->max_tx = adapter->ahw->max_tx_ques;
516 517
517 channel->rx_count = adapter->max_sds_rings; 518 channel->rx_count = adapter->max_sds_rings;
518 channel->tx_count = adapter->max_tx_ques; 519 channel->tx_count = adapter->ahw->max_tx_ques;
519} 520}
520 521
521static int qlcnic_set_channels(struct net_device *dev, 522static int qlcnic_set_channels(struct net_device *dev,
@@ -543,7 +544,7 @@ qlcnic_get_pauseparam(struct net_device *netdev,
543 struct ethtool_pauseparam *pause) 544 struct ethtool_pauseparam *pause)
544{ 545{
545 struct qlcnic_adapter *adapter = netdev_priv(netdev); 546 struct qlcnic_adapter *adapter = netdev_priv(netdev);
546 int port = adapter->physical_port; 547 int port = adapter->ahw->physical_port;
547 __u32 val; 548 __u32 val;
548 549
549 if (adapter->ahw->port_type == QLCNIC_GBE) { 550 if (adapter->ahw->port_type == QLCNIC_GBE) {
@@ -588,7 +589,7 @@ qlcnic_set_pauseparam(struct net_device *netdev,
588 struct ethtool_pauseparam *pause) 589 struct ethtool_pauseparam *pause)
589{ 590{
590 struct qlcnic_adapter *adapter = netdev_priv(netdev); 591 struct qlcnic_adapter *adapter = netdev_priv(netdev);
591 int port = adapter->physical_port; 592 int port = adapter->ahw->physical_port;
592 __u32 val; 593 __u32 val;
593 594
594 /* read mode */ 595 /* read mode */
@@ -703,7 +704,7 @@ static int qlcnic_irq_test(struct net_device *netdev)
703 if (ret) 704 if (ret)
704 goto clear_it; 705 goto clear_it;
705 706
706 adapter->diag_cnt = 0; 707 adapter->ahw->diag_cnt = 0;
707 memset(&cmd, 0, sizeof(cmd)); 708 memset(&cmd, 0, sizeof(cmd));
708 cmd.req.cmd = QLCNIC_CDRP_CMD_INTRPT_TEST; 709 cmd.req.cmd = QLCNIC_CDRP_CMD_INTRPT_TEST;
709 cmd.req.arg1 = adapter->ahw->pci_func; 710 cmd.req.arg1 = adapter->ahw->pci_func;
@@ -715,7 +716,7 @@ static int qlcnic_irq_test(struct net_device *netdev)
715 716
716 msleep(10); 717 msleep(10);
717 718
718 ret = !adapter->diag_cnt; 719 ret = !adapter->ahw->diag_cnt;
719 720
720done: 721done:
721 qlcnic_diag_free_res(netdev, max_sds_rings); 722 qlcnic_diag_free_res(netdev, max_sds_rings);
@@ -761,7 +762,7 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
761 qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); 762 qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
762 skb_put(skb, QLCNIC_ILB_PKT_SIZE); 763 skb_put(skb, QLCNIC_ILB_PKT_SIZE);
763 764
764 adapter->diag_cnt = 0; 765 adapter->ahw->diag_cnt = 0;
765 qlcnic_xmit_frame(skb, adapter->netdev); 766 qlcnic_xmit_frame(skb, adapter->netdev);
766 767
767 loop = 0; 768 loop = 0;
@@ -770,11 +771,11 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
770 qlcnic_process_rcv_ring_diag(sds_ring); 771 qlcnic_process_rcv_ring_diag(sds_ring);
771 if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) 772 if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP)
772 break; 773 break;
773 } while (!adapter->diag_cnt); 774 } while (!adapter->ahw->diag_cnt);
774 775
775 dev_kfree_skb_any(skb); 776 dev_kfree_skb_any(skb);
776 777
777 if (!adapter->diag_cnt) 778 if (!adapter->ahw->diag_cnt)
778 QLCDB(adapter, DRV, 779 QLCDB(adapter, DRV,
779 "LB Test: packet #%d was not received\n", i + 1); 780 "LB Test: packet #%d was not received\n", i + 1);
780 else 781 else
@@ -800,14 +801,15 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
800 int loop = 0; 801 int loop = 0;
801 int ret; 802 int ret;
802 803
803 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK)) { 804 if (!(adapter->ahw->capabilities &
805 QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK)) {
804 netdev_info(netdev, "Firmware is not loopback test capable\n"); 806 netdev_info(netdev, "Firmware is not loopback test capable\n");
805 return -EOPNOTSUPP; 807 return -EOPNOTSUPP;
806 } 808 }
807 809
808 QLCDB(adapter, DRV, "%s loopback test in progress\n", 810 QLCDB(adapter, DRV, "%s loopback test in progress\n",
809 mode == QLCNIC_ILB_MODE ? "internal" : "external"); 811 mode == QLCNIC_ILB_MODE ? "internal" : "external");
810 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { 812 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
811 netdev_warn(netdev, "Loopback test not supported for non " 813 netdev_warn(netdev, "Loopback test not supported for non "
812 "privilege function\n"); 814 "privilege function\n");
813 return 0; 815 return 0;
@@ -826,7 +828,7 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
826 if (ret) 828 if (ret)
827 goto free_res; 829 goto free_res;
828 830
829 adapter->diag_cnt = 0; 831 adapter->ahw->diag_cnt = 0;
830 do { 832 do {
831 msleep(500); 833 msleep(500);
832 qlcnic_process_rcv_ring_diag(sds_ring); 834 qlcnic_process_rcv_ring_diag(sds_ring);
@@ -835,8 +837,8 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
835 " configure request\n"); 837 " configure request\n");
836 ret = -QLCNIC_FW_NOT_RESPOND; 838 ret = -QLCNIC_FW_NOT_RESPOND;
837 goto free_res; 839 goto free_res;
838 } else if (adapter->diag_cnt) { 840 } else if (adapter->ahw->diag_cnt) {
839 ret = adapter->diag_cnt; 841 ret = adapter->ahw->diag_cnt;
840 goto free_res; 842 goto free_res;
841 } 843 }
842 } while (!QLCNIC_IS_LB_CONFIGURED(adapter->ahw->loopback_state)); 844 } while (!QLCNIC_IS_LB_CONFIGURED(adapter->ahw->loopback_state));
@@ -1028,7 +1030,7 @@ static int qlcnic_set_led(struct net_device *dev,
1028 int max_sds_rings = adapter->max_sds_rings; 1030 int max_sds_rings = adapter->max_sds_rings;
1029 int err = -EIO, active = 1; 1031 int err = -EIO, active = 1;
1030 1032
1031 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { 1033 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
1032 netdev_warn(dev, "LED test not supported for non " 1034 netdev_warn(dev, "LED test not supported for non "
1033 "privilege function\n"); 1035 "privilege function\n");
1034 return -EOPNOTSUPP; 1036 return -EOPNOTSUPP;
@@ -1207,14 +1209,14 @@ static u32 qlcnic_get_msglevel(struct net_device *netdev)
1207{ 1209{
1208 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1210 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1209 1211
1210 return adapter->msg_enable; 1212 return adapter->ahw->msg_enable;
1211} 1213}
1212 1214
1213static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl) 1215static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl)
1214{ 1216{
1215 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1217 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1216 1218
1217 adapter->msg_enable = msglvl; 1219 adapter->ahw->msg_enable = msglvl;
1218} 1220}
1219 1221
1220static int 1222static int
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index ff879cd2925b..382c6ac40cde 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -434,7 +434,7 @@ void qlcnic_set_multi(struct net_device *netdev)
434 } 434 }
435 435
436 if ((netdev->flags & IFF_ALLMULTI) || 436 if ((netdev->flags & IFF_ALLMULTI) ||
437 (netdev_mc_count(netdev) > adapter->max_mc_count)) { 437 (netdev_mc_count(netdev) > adapter->ahw->max_mc_count)) {
438 mode = VPORT_MISS_MODE_ACCEPT_MULTI; 438 mode = VPORT_MISS_MODE_ACCEPT_MULTI;
439 goto send_fw_cmd; 439 goto send_fw_cmd;
440 } 440 }
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
index d8610ea56a48..de79cde233de 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
@@ -246,7 +246,8 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
246 rds_ring->dma_size = 246 rds_ring->dma_size =
247 QLCNIC_P3P_RX_JUMBO_BUF_MAX_LEN; 247 QLCNIC_P3P_RX_JUMBO_BUF_MAX_LEN;
248 248
249 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) 249 if (adapter->ahw->capabilities &
250 QLCNIC_FW_CAPABILITY_HW_LRO)
250 rds_ring->dma_size += QLCNIC_LRO_BUFFER_EXTRA; 251 rds_ring->dma_size += QLCNIC_LRO_BUFFER_EXTRA;
251 252
252 rds_ring->skb_size = 253 rds_ring->skb_size =
@@ -655,7 +656,7 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
655 "Not an Ethernet NIC func=%u\n", val); 656 "Not an Ethernet NIC func=%u\n", val);
656 return -EIO; 657 return -EIO;
657 } 658 }
658 adapter->physical_port = (val >> 2); 659 adapter->ahw->physical_port = (val >> 2);
659 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) 660 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
660 timeo = QLCNIC_INIT_TIMEOUT_SECS; 661 timeo = QLCNIC_INIT_TIMEOUT_SECS;
661 662
@@ -996,7 +997,7 @@ qlcnic_get_bootld_offs(struct qlcnic_adapter *adapter)
996 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_BOOTLD, 997 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_BOOTLD,
997 QLCNIC_UNI_BOOTLD_IDX_OFF); 998 QLCNIC_UNI_BOOTLD_IDX_OFF);
998 999
999 if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) 1000 if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
1000 offs = le32_to_cpu(data_desc->findex); 1001 offs = le32_to_cpu(data_desc->findex);
1001 1002
1002 return (u8 *)&adapter->fw->data[offs]; 1003 return (u8 *)&adapter->fw->data[offs];
@@ -1010,7 +1011,7 @@ qlcnic_get_fw_offs(struct qlcnic_adapter *adapter)
1010 1011
1011 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, 1012 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW,
1012 QLCNIC_UNI_FIRMWARE_IDX_OFF); 1013 QLCNIC_UNI_FIRMWARE_IDX_OFF);
1013 if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) 1014 if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
1014 offs = le32_to_cpu(data_desc->findex); 1015 offs = le32_to_cpu(data_desc->findex);
1015 1016
1016 return (u8 *)&adapter->fw->data[offs]; 1017 return (u8 *)&adapter->fw->data[offs];
@@ -1024,7 +1025,7 @@ static u32 qlcnic_get_fw_size(struct qlcnic_adapter *adapter)
1024 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, 1025 data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW,
1025 QLCNIC_UNI_FIRMWARE_IDX_OFF); 1026 QLCNIC_UNI_FIRMWARE_IDX_OFF);
1026 1027
1027 if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) 1028 if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
1028 return le32_to_cpu(data_desc->size); 1029 return le32_to_cpu(data_desc->size);
1029 else 1030 else
1030 return le32_to_cpu(*(__le32 *)&unirom[QLCNIC_FW_SIZE_OFFSET]); 1031 return le32_to_cpu(*(__le32 *)&unirom[QLCNIC_FW_SIZE_OFFSET]);
@@ -1039,7 +1040,7 @@ static u32 qlcnic_get_fw_version(struct qlcnic_adapter *adapter)
1039 const u8 *ver_str; 1040 const u8 *ver_str;
1040 int i, ret; 1041 int i, ret;
1041 1042
1042 if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { 1043 if (adapter->ahw->fw_type != QLCNIC_UNIFIED_ROMIMAGE) {
1043 version_offset = *(__le32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET]; 1044 version_offset = *(__le32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET];
1044 return le32_to_cpu(version_offset); 1045 return le32_to_cpu(version_offset);
1045 } 1046 }
@@ -1070,7 +1071,7 @@ static u32 qlcnic_get_bios_version(struct qlcnic_adapter *adapter)
1070 u8 *version_offset; 1071 u8 *version_offset;
1071 __le32 temp; 1072 __le32 temp;
1072 1073
1073 if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { 1074 if (adapter->ahw->fw_type != QLCNIC_UNIFIED_ROMIMAGE) {
1074 version_offset = (u8 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET]; 1075 version_offset = (u8 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET];
1075 return le32_to_cpu(*(__le32 *)version_offset); 1076 return le32_to_cpu(*(__le32 *)version_offset);
1076 } 1077 }
@@ -1141,7 +1142,7 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter)
1141 struct pci_dev *pdev = adapter->pdev; 1142 struct pci_dev *pdev = adapter->pdev;
1142 1143
1143 dev_info(&pdev->dev, "loading firmware from %s\n", 1144 dev_info(&pdev->dev, "loading firmware from %s\n",
1144 fw_name[adapter->fw_type]); 1145 fw_name[adapter->ahw->fw_type]);
1145 1146
1146 if (fw) { 1147 if (fw) {
1147 u64 data; 1148 u64 data;
@@ -1233,7 +1234,7 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter)
1233 u32 ver, bios, min_size; 1234 u32 ver, bios, min_size;
1234 struct pci_dev *pdev = adapter->pdev; 1235 struct pci_dev *pdev = adapter->pdev;
1235 const struct firmware *fw = adapter->fw; 1236 const struct firmware *fw = adapter->fw;
1236 u8 fw_type = adapter->fw_type; 1237 u8 fw_type = adapter->ahw->fw_type;
1237 1238
1238 if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) { 1239 if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) {
1239 if (qlcnic_validate_unified_romimage(adapter)) 1240 if (qlcnic_validate_unified_romimage(adapter))
@@ -1278,7 +1279,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter)
1278{ 1279{
1279 u8 fw_type; 1280 u8 fw_type;
1280 1281
1281 switch (adapter->fw_type) { 1282 switch (adapter->ahw->fw_type) {
1282 case QLCNIC_UNKNOWN_ROMIMAGE: 1283 case QLCNIC_UNKNOWN_ROMIMAGE:
1283 fw_type = QLCNIC_UNIFIED_ROMIMAGE; 1284 fw_type = QLCNIC_UNIFIED_ROMIMAGE;
1284 break; 1285 break;
@@ -1289,7 +1290,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter)
1289 break; 1290 break;
1290 } 1291 }
1291 1292
1292 adapter->fw_type = fw_type; 1293 adapter->ahw->fw_type = fw_type;
1293} 1294}
1294 1295
1295 1296
@@ -1299,16 +1300,17 @@ void qlcnic_request_firmware(struct qlcnic_adapter *adapter)
1299 struct pci_dev *pdev = adapter->pdev; 1300 struct pci_dev *pdev = adapter->pdev;
1300 int rc; 1301 int rc;
1301 1302
1302 adapter->fw_type = QLCNIC_UNKNOWN_ROMIMAGE; 1303 adapter->ahw->fw_type = QLCNIC_UNKNOWN_ROMIMAGE;
1303 1304
1304next: 1305next:
1305 qlcnic_get_next_fwtype(adapter); 1306 qlcnic_get_next_fwtype(adapter);
1306 1307
1307 if (adapter->fw_type == QLCNIC_FLASH_ROMIMAGE) { 1308 if (adapter->ahw->fw_type == QLCNIC_FLASH_ROMIMAGE) {
1308 adapter->fw = NULL; 1309 adapter->fw = NULL;
1309 } else { 1310 } else {
1310 rc = request_firmware(&adapter->fw, 1311 rc = request_firmware(&adapter->fw,
1311 fw_name[adapter->fw_type], &pdev->dev); 1312 fw_name[adapter->ahw->fw_type],
1313 &pdev->dev);
1312 if (rc != 0) 1314 if (rc != 0)
1313 goto next; 1315 goto next;
1314 1316
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index ba352c18c358..880a9ca274dc 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -709,7 +709,7 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
709 u8 link_status, module, duplex, autoneg, lb_status = 0; 709 u8 link_status, module, duplex, autoneg, lb_status = 0;
710 struct net_device *netdev = adapter->netdev; 710 struct net_device *netdev = adapter->netdev;
711 711
712 adapter->has_link_events = 1; 712 adapter->ahw->has_link_events = 1;
713 713
714 cable_OUI = msg->body[1] & 0xffffffff; 714 cable_OUI = msg->body[1] & 0xffffffff;
715 cable_len = (msg->body[1] >> 32) & 0xffff; 715 cable_len = (msg->body[1] >> 32) & 0xffff;
@@ -736,18 +736,18 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
736 qlcnic_advert_link_change(adapter, link_status); 736 qlcnic_advert_link_change(adapter, link_status);
737 737
738 if (duplex == LINKEVENT_FULL_DUPLEX) 738 if (duplex == LINKEVENT_FULL_DUPLEX)
739 adapter->link_duplex = DUPLEX_FULL; 739 adapter->ahw->link_duplex = DUPLEX_FULL;
740 else 740 else
741 adapter->link_duplex = DUPLEX_HALF; 741 adapter->ahw->link_duplex = DUPLEX_HALF;
742 742
743 adapter->module_type = module; 743 adapter->ahw->module_type = module;
744 adapter->link_autoneg = autoneg; 744 adapter->ahw->link_autoneg = autoneg;
745 745
746 if (link_status) { 746 if (link_status) {
747 adapter->link_speed = link_speed; 747 adapter->ahw->link_speed = link_speed;
748 } else { 748 } else {
749 adapter->link_speed = SPEED_UNKNOWN; 749 adapter->ahw->link_speed = SPEED_UNKNOWN;
750 adapter->link_duplex = DUPLEX_UNKNOWN; 750 adapter->ahw->link_duplex = DUPLEX_UNKNOWN;
751 } 751 }
752} 752}
753 753
@@ -785,17 +785,17 @@ static void qlcnic_handle_fw_message(int desc_cnt, int index,
785 break; 785 break;
786 case 1: 786 case 1:
787 dev_info(dev, "loopback already in progress\n"); 787 dev_info(dev, "loopback already in progress\n");
788 adapter->diag_cnt = -QLCNIC_TEST_IN_PROGRESS; 788 adapter->ahw->diag_cnt = -QLCNIC_TEST_IN_PROGRESS;
789 break; 789 break;
790 case 2: 790 case 2:
791 dev_info(dev, "loopback cable is not connected\n"); 791 dev_info(dev, "loopback cable is not connected\n");
792 adapter->diag_cnt = -QLCNIC_LB_CABLE_NOT_CONN; 792 adapter->ahw->diag_cnt = -QLCNIC_LB_CABLE_NOT_CONN;
793 break; 793 break;
794 default: 794 default:
795 dev_info(dev, 795 dev_info(dev,
796 "loopback configure request failed, err %x\n", 796 "loopback configure request failed, err %x\n",
797 ret); 797 ret);
798 adapter->diag_cnt = -QLCNIC_UNDEFINED_ERROR; 798 adapter->ahw->diag_cnt = -QLCNIC_UNDEFINED_ERROR;
799 break; 799 break;
800 } 800 }
801 break; 801 break;
@@ -1169,7 +1169,7 @@ static void qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter, int ring,
1169 skb_pull(skb, pkt_offset); 1169 skb_pull(skb, pkt_offset);
1170 1170
1171 if (!qlcnic_check_loopback_buff(skb->data, adapter->mac_addr)) 1171 if (!qlcnic_check_loopback_buff(skb->data, adapter->mac_addr))
1172 adapter->diag_cnt++; 1172 adapter->ahw->diag_cnt++;
1173 else 1173 else
1174 dump_skb(skb, adapter); 1174 dump_skb(skb, adapter);
1175 1175
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index f838a17cb326..c03c7600b576 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -261,7 +261,7 @@ static int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix)
261 adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); 261 adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED);
262 qlcnic_set_msix_bit(pdev, 0); 262 qlcnic_set_msix_bit(pdev, 0);
263 263
264 if (adapter->msix_supported) { 264 if (adapter->ahw->msix_supported) {
265 enable_msix: 265 enable_msix:
266 qlcnic_init_msix_entries(adapter, num_msix); 266 qlcnic_init_msix_entries(adapter, num_msix);
267 err = pci_enable_msix(pdev, adapter->msix_entries, num_msix); 267 err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
@@ -300,7 +300,7 @@ static void qlcnic_enable_msi_legacy(struct qlcnic_adapter *adapter)
300 300
301 legacy_intrp = &legacy_intr[adapter->ahw->pci_func]; 301 legacy_intrp = &legacy_intr[adapter->ahw->pci_func];
302 302
303 adapter->int_vec_bit = legacy_intrp->int_vec_bit; 303 adapter->ahw->int_vec_bit = legacy_intrp->int_vec_bit;
304 adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter, 304 adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter,
305 legacy_intrp->tgt_status_reg); 305 legacy_intrp->tgt_status_reg);
306 adapter->tgt_mask_reg = qlcnic_get_ioaddr(adapter, 306 adapter->tgt_mask_reg = qlcnic_get_ioaddr(adapter,
@@ -318,7 +318,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter)
318{ 318{
319 int num_msix; 319 int num_msix;
320 320
321 if (adapter->msix_supported) { 321 if (adapter->ahw->msix_supported) {
322 num_msix = rounddown_pow_of_two(min_t(int, num_online_cpus(), 322 num_msix = rounddown_pow_of_two(min_t(int, num_online_cpus(),
323 QLCNIC_DEF_NUM_STS_DESC_RINGS)); 323 QLCNIC_DEF_NUM_STS_DESC_RINGS));
324 } else 324 } else
@@ -452,8 +452,8 @@ qlcnic_check_vf(struct qlcnic_adapter *adapter)
452 u32 op_mode, priv_level; 452 u32 op_mode, priv_level;
453 453
454 /* Determine FW API version */ 454 /* Determine FW API version */
455 adapter->fw_hal_version = readl(adapter->ahw->pci_base0 + 455 adapter->ahw->fw_hal_version = readl(adapter->ahw->pci_base0 +
456 QLCNIC_FW_API); 456 QLCNIC_FW_API);
457 457
458 /* Find PCI function number */ 458 /* Find PCI function number */
459 pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func); 459 pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func);
@@ -471,10 +471,10 @@ qlcnic_check_vf(struct qlcnic_adapter *adapter)
471 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw->pci_func); 471 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw->pci_func);
472 472
473 if (priv_level == QLCNIC_NON_PRIV_FUNC) { 473 if (priv_level == QLCNIC_NON_PRIV_FUNC) {
474 adapter->op_mode = QLCNIC_NON_PRIV_FUNC; 474 adapter->ahw->op_mode = QLCNIC_NON_PRIV_FUNC;
475 dev_info(&adapter->pdev->dev, 475 dev_info(&adapter->pdev->dev,
476 "HAL Version: %d Non Privileged function\n", 476 "HAL Version: %d Non Privileged function\n",
477 adapter->fw_hal_version); 477 adapter->ahw->fw_hal_version);
478 adapter->nic_ops = &qlcnic_vf_ops; 478 adapter->nic_ops = &qlcnic_vf_ops;
479 } else 479 } else
480 adapter->nic_ops = &qlcnic_ops; 480 adapter->nic_ops = &qlcnic_ops;
@@ -557,7 +557,7 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
557 557
558 adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build); 558 adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build);
559 559
560 if (adapter->op_mode != QLCNIC_NON_PRIV_FUNC) { 560 if (adapter->ahw->op_mode != QLCNIC_NON_PRIV_FUNC) {
561 if (fw_dump->tmpl_hdr == NULL || 561 if (fw_dump->tmpl_hdr == NULL ||
562 adapter->fw_version > prev_fw_version) { 562 adapter->fw_version > prev_fw_version) {
563 if (fw_dump->tmpl_hdr) 563 if (fw_dump->tmpl_hdr)
@@ -589,7 +589,7 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
589 adapter->max_rxd = MAX_RCV_DESCRIPTORS_1G; 589 adapter->max_rxd = MAX_RCV_DESCRIPTORS_1G;
590 } 590 }
591 591
592 adapter->msix_supported = !!use_msi_x; 592 adapter->ahw->msix_supported = !!use_msi_x;
593 593
594 adapter->num_txd = MAX_CMD_DESCRIPTORS; 594 adapter->num_txd = MAX_CMD_DESCRIPTORS;
595 595
@@ -606,15 +606,15 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter)
606 if (err) 606 if (err)
607 return err; 607 return err;
608 608
609 adapter->physical_port = (u8)nic_info.phys_port; 609 adapter->ahw->physical_port = (u8)nic_info.phys_port;
610 adapter->switch_mode = nic_info.switch_mode; 610 adapter->ahw->switch_mode = nic_info.switch_mode;
611 adapter->max_tx_ques = nic_info.max_tx_ques; 611 adapter->ahw->max_tx_ques = nic_info.max_tx_ques;
612 adapter->max_rx_ques = nic_info.max_rx_ques; 612 adapter->ahw->max_rx_ques = nic_info.max_rx_ques;
613 adapter->capabilities = nic_info.capabilities; 613 adapter->ahw->capabilities = nic_info.capabilities;
614 adapter->max_mac_filters = nic_info.max_mac_filters; 614 adapter->ahw->max_mac_filters = nic_info.max_mac_filters;
615 adapter->max_mtu = nic_info.max_mtu; 615 adapter->ahw->max_mtu = nic_info.max_mtu;
616 616
617 if (adapter->capabilities & BIT_6) 617 if (adapter->ahw->capabilities & BIT_6)
618 adapter->flags |= QLCNIC_ESWITCH_ENABLED; 618 adapter->flags |= QLCNIC_ESWITCH_ENABLED;
619 else 619 else
620 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; 620 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
@@ -700,7 +700,7 @@ qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
700 vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | 700 vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM |
701 NETIF_F_IPV6_CSUM | NETIF_F_HW_VLAN_FILTER); 701 NETIF_F_IPV6_CSUM | NETIF_F_HW_VLAN_FILTER);
702 702
703 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) { 703 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) {
704 features |= (NETIF_F_TSO | NETIF_F_TSO6); 704 features |= (NETIF_F_TSO | NETIF_F_TSO6);
705 vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6); 705 vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
706 } 706 }
@@ -746,7 +746,7 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
746 746
747 if (adapter->flags & QLCNIC_ESWITCH_ENABLED) { 747 if (adapter->flags & QLCNIC_ESWITCH_ENABLED) {
748 if (priv_level == QLCNIC_MGMT_FUNC) { 748 if (priv_level == QLCNIC_MGMT_FUNC) {
749 adapter->op_mode = QLCNIC_MGMT_FUNC; 749 adapter->ahw->op_mode = QLCNIC_MGMT_FUNC;
750 err = qlcnic_init_pci_info(adapter); 750 err = qlcnic_init_pci_info(adapter);
751 if (err) 751 if (err)
752 return err; 752 return err;
@@ -754,12 +754,12 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
754 qlcnic_set_function_modes(adapter); 754 qlcnic_set_function_modes(adapter);
755 dev_info(&adapter->pdev->dev, 755 dev_info(&adapter->pdev->dev,
756 "HAL Version: %d, Management function\n", 756 "HAL Version: %d, Management function\n",
757 adapter->fw_hal_version); 757 adapter->ahw->fw_hal_version);
758 } else if (priv_level == QLCNIC_PRIV_FUNC) { 758 } else if (priv_level == QLCNIC_PRIV_FUNC) {
759 adapter->op_mode = QLCNIC_PRIV_FUNC; 759 adapter->ahw->op_mode = QLCNIC_PRIV_FUNC;
760 dev_info(&adapter->pdev->dev, 760 dev_info(&adapter->pdev->dev,
761 "HAL Version: %d, Privileged function\n", 761 "HAL Version: %d, Privileged function\n",
762 adapter->fw_hal_version); 762 adapter->ahw->fw_hal_version);
763 } 763 }
764 } 764 }
765 765
@@ -786,7 +786,7 @@ qlcnic_set_default_offload_settings(struct qlcnic_adapter *adapter)
786 esw_cfg.offload_flags = BIT_0; 786 esw_cfg.offload_flags = BIT_0;
787 esw_cfg.mac_override = BIT_0; 787 esw_cfg.mac_override = BIT_0;
788 esw_cfg.promisc_mode = BIT_0; 788 esw_cfg.promisc_mode = BIT_0;
789 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) 789 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
790 esw_cfg.offload_flags |= (BIT_1 | BIT_2); 790 esw_cfg.offload_flags |= (BIT_1 | BIT_2);
791 if (qlcnic_config_switch_port(adapter, &esw_cfg)) 791 if (qlcnic_config_switch_port(adapter, &esw_cfg))
792 return -EIO; 792 return -EIO;
@@ -867,7 +867,7 @@ static int qlcnic_check_npar_opertional(struct qlcnic_adapter *adapter)
867 u8 npar_opt_timeo = QLCNIC_DEV_NPAR_OPER_TIMEO; 867 u8 npar_opt_timeo = QLCNIC_DEV_NPAR_OPER_TIMEO;
868 u32 npar_state; 868 u32 npar_state;
869 869
870 if (adapter->op_mode == QLCNIC_MGMT_FUNC) 870 if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC)
871 return 0; 871 return 0;
872 872
873 npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); 873 npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE);
@@ -889,7 +889,7 @@ qlcnic_set_mgmt_operations(struct qlcnic_adapter *adapter)
889 int err; 889 int err;
890 890
891 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) || 891 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
892 adapter->op_mode != QLCNIC_MGMT_FUNC) 892 adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
893 return 0; 893 return 0;
894 894
895 err = qlcnic_set_default_offload_settings(adapter); 895 err = qlcnic_set_default_offload_settings(adapter);
@@ -923,7 +923,7 @@ qlcnic_start_firmware(struct qlcnic_adapter *adapter)
923 if (err) 923 if (err)
924 goto err_out; 924 goto err_out;
925 925
926 adapter->fw_type = QLCNIC_FLASH_ROMIMAGE; 926 adapter->ahw->fw_type = QLCNIC_FLASH_ROMIMAGE;
927 } 927 }
928 928
929 err = qlcnic_need_fw_reset(adapter); 929 err = qlcnic_need_fw_reset(adapter);
@@ -984,7 +984,7 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter)
984 struct net_device *netdev = adapter->netdev; 984 struct net_device *netdev = adapter->netdev;
985 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; 985 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
986 986
987 if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { 987 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
988 handler = qlcnic_tmp_intr; 988 handler = qlcnic_tmp_intr;
989 if (!QLCNIC_IS_MSI_FAMILY(adapter)) 989 if (!QLCNIC_IS_MSI_FAMILY(adapter))
990 flags |= IRQF_SHARED; 990 flags |= IRQF_SHARED;
@@ -1043,7 +1043,7 @@ __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
1043 if (qlcnic_set_eswitch_port_config(adapter)) 1043 if (qlcnic_set_eswitch_port_config(adapter))
1044 return -EIO; 1044 return -EIO;
1045 1045
1046 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { 1046 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) {
1047 capab2 = QLCRD32(adapter, CRB_FW_CAPABILITIES_2); 1047 capab2 = QLCRD32(adapter, CRB_FW_CAPABILITIES_2);
1048 if (capab2 & QLCNIC_FW_CAPABILITY_2_LRO_MAX_TCP_SEG) 1048 if (capab2 & QLCNIC_FW_CAPABILITY_2_LRO_MAX_TCP_SEG)
1049 adapter->flags |= QLCNIC_FW_LRO_MSS_CAP; 1049 adapter->flags |= QLCNIC_FW_LRO_MSS_CAP;
@@ -1074,7 +1074,7 @@ __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
1074 1074
1075 qlcnic_linkevent_request(adapter, 1); 1075 qlcnic_linkevent_request(adapter, 1);
1076 1076
1077 adapter->reset_context = 0; 1077 adapter->ahw->reset_context = 0;
1078 set_bit(__QLCNIC_DEV_UP, &adapter->state); 1078 set_bit(__QLCNIC_DEV_UP, &adapter->state);
1079 return 0; 1079 return 0;
1080} 1080}
@@ -1207,7 +1207,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings)
1207 int ring; 1207 int ring;
1208 1208
1209 clear_bit(__QLCNIC_DEV_UP, &adapter->state); 1209 clear_bit(__QLCNIC_DEV_UP, &adapter->state);
1210 if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { 1210 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
1211 for (ring = 0; ring < adapter->max_sds_rings; ring++) { 1211 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
1212 sds_ring = &adapter->recv_ctx->sds_rings[ring]; 1212 sds_ring = &adapter->recv_ctx->sds_rings[ring];
1213 qlcnic_disable_int(sds_ring); 1213 qlcnic_disable_int(sds_ring);
@@ -1218,7 +1218,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings)
1218 1218
1219 qlcnic_detach(adapter); 1219 qlcnic_detach(adapter);
1220 1220
1221 adapter->diag_test = 0; 1221 adapter->ahw->diag_test = 0;
1222 adapter->max_sds_rings = max_sds_rings; 1222 adapter->max_sds_rings = max_sds_rings;
1223 1223
1224 if (qlcnic_attach(adapter)) 1224 if (qlcnic_attach(adapter))
@@ -1288,7 +1288,7 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test)
1288 qlcnic_detach(adapter); 1288 qlcnic_detach(adapter);
1289 1289
1290 adapter->max_sds_rings = 1; 1290 adapter->max_sds_rings = 1;
1291 adapter->diag_test = test; 1291 adapter->ahw->diag_test = test;
1292 1292
1293 ret = qlcnic_attach(adapter); 1293 ret = qlcnic_attach(adapter);
1294 if (ret) { 1294 if (ret) {
@@ -1308,14 +1308,14 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test)
1308 qlcnic_post_rx_buffers(adapter, rds_ring); 1308 qlcnic_post_rx_buffers(adapter, rds_ring);
1309 } 1309 }
1310 1310
1311 if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { 1311 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
1312 for (ring = 0; ring < adapter->max_sds_rings; ring++) { 1312 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
1313 sds_ring = &adapter->recv_ctx->sds_rings[ring]; 1313 sds_ring = &adapter->recv_ctx->sds_rings[ring];
1314 qlcnic_enable_int(sds_ring); 1314 qlcnic_enable_int(sds_ring);
1315 } 1315 }
1316 } 1316 }
1317 1317
1318 if (adapter->diag_test == QLCNIC_LOOPBACK_TEST) { 1318 if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
1319 adapter->ahw->loopback_state = 0; 1319 adapter->ahw->loopback_state = 0;
1320 qlcnic_linkevent_request(adapter, 1); 1320 qlcnic_linkevent_request(adapter, 1);
1321 } 1321 }
@@ -1386,8 +1386,8 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
1386 int err; 1386 int err;
1387 struct pci_dev *pdev = adapter->pdev; 1387 struct pci_dev *pdev = adapter->pdev;
1388 1388
1389 adapter->mc_enabled = 0; 1389 adapter->ahw->mc_enabled = 0;
1390 adapter->max_mc_count = 38; 1390 adapter->ahw->max_mc_count = 38;
1391 1391
1392 netdev->netdev_ops = &qlcnic_netdev_ops; 1392 netdev->netdev_ops = &qlcnic_netdev_ops;
1393 netdev->watchdog_timeo = 5*HZ; 1393 netdev->watchdog_timeo = 5*HZ;
@@ -1399,16 +1399,16 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
1399 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 1399 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
1400 NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; 1400 NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
1401 1401
1402 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) 1402 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
1403 netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; 1403 netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
1404 if (pci_using_dac == 1) 1404 if (pci_using_dac == 1)
1405 netdev->hw_features |= NETIF_F_HIGHDMA; 1405 netdev->hw_features |= NETIF_F_HIGHDMA;
1406 1406
1407 netdev->vlan_features = netdev->hw_features; 1407 netdev->vlan_features = netdev->hw_features;
1408 1408
1409 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_FVLANTX) 1409 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_FVLANTX)
1410 netdev->hw_features |= NETIF_F_HW_VLAN_TX; 1410 netdev->hw_features |= NETIF_F_HW_VLAN_TX;
1411 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) 1411 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
1412 netdev->hw_features |= NETIF_F_LRO; 1412 netdev->hw_features |= NETIF_F_LRO;
1413 1413
1414 netdev->features |= netdev->hw_features | 1414 netdev->features |= netdev->hw_features |
@@ -1549,7 +1549,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1549 1549
1550 qlcnic_clear_stats(adapter); 1550 qlcnic_clear_stats(adapter);
1551 1551
1552 err = qlcnic_alloc_msix_entries(adapter, adapter->max_rx_ques); 1552 err = qlcnic_alloc_msix_entries(adapter, adapter->ahw->max_rx_ques);
1553 if (err) 1553 if (err)
1554 goto err_out_decr_ref; 1554 goto err_out_decr_ref;
1555 1555
@@ -1846,7 +1846,7 @@ static int qlcnic_check_temp(struct qlcnic_adapter *adapter)
1846 temp_val); 1846 temp_val);
1847 rv = 1; 1847 rv = 1;
1848 } else if (temp_state == QLCNIC_TEMP_WARN) { 1848 } else if (temp_state == QLCNIC_TEMP_WARN) {
1849 if (adapter->temp == QLCNIC_TEMP_NORMAL) { 1849 if (adapter->ahw->temp == QLCNIC_TEMP_NORMAL) {
1850 dev_err(&netdev->dev, 1850 dev_err(&netdev->dev,
1851 "Device temperature %d degrees C " 1851 "Device temperature %d degrees C "
1852 "exceeds operating range." 1852 "exceeds operating range."
@@ -1854,13 +1854,13 @@ static int qlcnic_check_temp(struct qlcnic_adapter *adapter)
1854 temp_val); 1854 temp_val);
1855 } 1855 }
1856 } else { 1856 } else {
1857 if (adapter->temp == QLCNIC_TEMP_WARN) { 1857 if (adapter->ahw->temp == QLCNIC_TEMP_WARN) {
1858 dev_info(&netdev->dev, 1858 dev_info(&netdev->dev,
1859 "Device temperature is now %d degrees C" 1859 "Device temperature is now %d degrees C"
1860 " in normal range.\n", temp_val); 1860 " in normal range.\n", temp_val);
1861 } 1861 }
1862 } 1862 }
1863 adapter->temp = temp_state; 1863 adapter->ahw->temp = temp_state;
1864 return rv; 1864 return rv;
1865} 1865}
1866 1866
@@ -1876,7 +1876,7 @@ static void qlcnic_tx_timeout(struct net_device *netdev)
1876 if (++adapter->tx_timeo_cnt >= QLCNIC_MAX_TX_TIMEOUTS) 1876 if (++adapter->tx_timeo_cnt >= QLCNIC_MAX_TX_TIMEOUTS)
1877 adapter->need_fw_reset = 1; 1877 adapter->need_fw_reset = 1;
1878 else 1878 else
1879 adapter->reset_context = 1; 1879 adapter->ahw->reset_context = 1;
1880} 1880}
1881 1881
1882static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) 1882static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev)
@@ -1900,7 +1900,7 @@ static irqreturn_t qlcnic_clear_legacy_intr(struct qlcnic_adapter *adapter)
1900 1900
1901 status = readl(adapter->isr_int_vec); 1901 status = readl(adapter->isr_int_vec);
1902 1902
1903 if (!(status & adapter->int_vec_bit)) 1903 if (!(status & adapter->ahw->int_vec_bit))
1904 return IRQ_NONE; 1904 return IRQ_NONE;
1905 1905
1906 /* check interrupt state machine, to be sure */ 1906 /* check interrupt state machine, to be sure */
@@ -1932,7 +1932,7 @@ static irqreturn_t qlcnic_tmp_intr(int irq, void *data)
1932 return IRQ_NONE; 1932 return IRQ_NONE;
1933 1933
1934done: 1934done:
1935 adapter->diag_cnt++; 1935 adapter->ahw->diag_cnt++;
1936 qlcnic_enable_int(sds_ring); 1936 qlcnic_enable_int(sds_ring);
1937 return IRQ_HANDLED; 1937 return IRQ_HANDLED;
1938} 1938}
@@ -2213,7 +2213,7 @@ qlcnic_fwinit_work(struct work_struct *work)
2213 return; 2213 return;
2214 } 2214 }
2215 2215
2216 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { 2216 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
2217 qlcnic_api_unlock(adapter); 2217 qlcnic_api_unlock(adapter);
2218 goto wait_npar; 2218 goto wait_npar;
2219 } 2219 }
@@ -2329,9 +2329,9 @@ qlcnic_detach_work(struct work_struct *work)
2329 goto err_ret; 2329 goto err_ret;
2330 } 2330 }
2331 2331
2332 if (adapter->temp == QLCNIC_TEMP_PANIC) { 2332 if (adapter->ahw->temp == QLCNIC_TEMP_PANIC) {
2333 dev_err(&adapter->pdev->dev, "Detaching the device: temp=%d\n", 2333 dev_err(&adapter->pdev->dev, "Detaching the device: temp=%d\n",
2334 adapter->temp); 2334 adapter->ahw->temp);
2335 goto err_ret; 2335 goto err_ret;
2336 } 2336 }
2337 2337
@@ -2456,7 +2456,7 @@ qlcnic_attach_work(struct work_struct *work)
2456 struct net_device *netdev = adapter->netdev; 2456 struct net_device *netdev = adapter->netdev;
2457 u32 npar_state; 2457 u32 npar_state;
2458 2458
2459 if (adapter->op_mode != QLCNIC_MGMT_FUNC) { 2459 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) {
2460 npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); 2460 npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE);
2461 if (adapter->fw_wait_cnt++ > QLCNIC_DEV_NPAR_OPER_TIMEO) 2461 if (adapter->fw_wait_cnt++ > QLCNIC_DEV_NPAR_OPER_TIMEO)
2462 qlcnic_clr_all_drv_state(adapter, 0); 2462 qlcnic_clr_all_drv_state(adapter, 0);
@@ -2513,7 +2513,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
2513 if (adapter->need_fw_reset) 2513 if (adapter->need_fw_reset)
2514 goto detach; 2514 goto detach;
2515 2515
2516 if (adapter->reset_context && auto_fw_reset) { 2516 if (adapter->ahw->reset_context && auto_fw_reset) {
2517 qlcnic_reset_hw_context(adapter); 2517 qlcnic_reset_hw_context(adapter);
2518 adapter->netdev->trans_start = jiffies; 2518 adapter->netdev->trans_start = jiffies;
2519 } 2519 }
@@ -2625,7 +2625,7 @@ static int qlcnic_attach_func(struct pci_dev *pdev)
2625 if (qlcnic_api_lock(adapter)) 2625 if (qlcnic_api_lock(adapter))
2626 return -EINVAL; 2626 return -EINVAL;
2627 2627
2628 if (adapter->op_mode != QLCNIC_NON_PRIV_FUNC && first_func) { 2628 if (adapter->ahw->op_mode != QLCNIC_NON_PRIV_FUNC && first_func) {
2629 adapter->need_fw_reset = 1; 2629 adapter->need_fw_reset = 1;
2630 set_bit(__QLCNIC_START_FW, &adapter->state); 2630 set_bit(__QLCNIC_START_FW, &adapter->state);
2631 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING); 2631 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index bdaa8cea349c..341d37c867ff 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -31,7 +31,7 @@ static ssize_t qlcnic_store_bridged_mode(struct device *dev,
31 unsigned long new; 31 unsigned long new;
32 int ret = -EINVAL; 32 int ret = -EINVAL;
33 33
34 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG)) 34 if (!(adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG))
35 goto err_out; 35 goto err_out;
36 36
37 if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) 37 if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
@@ -54,7 +54,7 @@ static ssize_t qlcnic_show_bridged_mode(struct device *dev,
54 struct qlcnic_adapter *adapter = dev_get_drvdata(dev); 54 struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
55 int bridged_mode = 0; 55 int bridged_mode = 0;
56 56
57 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) 57 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
58 bridged_mode = !!(adapter->flags & QLCNIC_BRIDGE_ENABLED); 58 bridged_mode = !!(adapter->flags & QLCNIC_BRIDGE_ENABLED);
59 59
60 return sprintf(buf, "%d\n", bridged_mode); 60 return sprintf(buf, "%d\n", bridged_mode);
@@ -116,7 +116,7 @@ static ssize_t qlcnic_store_beacon(struct device *dev,
116 u8 b_state, b_rate; 116 u8 b_state, b_rate;
117 int err; 117 int err;
118 118
119 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { 119 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
120 dev_warn(dev, 120 dev_warn(dev,
121 "LED test not supported in non privileged mode\n"); 121 "LED test not supported in non privileged mode\n");
122 return -EOPNOTSUPP; 122 return -EOPNOTSUPP;
@@ -413,7 +413,7 @@ static int validate_esw_config(struct qlcnic_adapter *adapter,
413 if (pci_func >= QLCNIC_MAX_PCI_FUNC) 413 if (pci_func >= QLCNIC_MAX_PCI_FUNC)
414 return QL_STATUS_INVALID_PARAM; 414 return QL_STATUS_INVALID_PARAM;
415 415
416 if (adapter->op_mode == QLCNIC_MGMT_FUNC) { 416 if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC) {
417 if (adapter->npars[pci_func].type != QLCNIC_TYPE_NIC) 417 if (adapter->npars[pci_func].type != QLCNIC_TYPE_NIC)
418 return QL_STATUS_INVALID_PARAM; 418 return QL_STATUS_INVALID_PARAM;
419 } 419 }
@@ -471,7 +471,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
471 return ret; 471 return ret;
472 472
473 for (i = 0; i < count; i++) { 473 for (i = 0; i < count; i++) {
474 if (adapter->op_mode == QLCNIC_MGMT_FUNC) { 474 if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC) {
475 if (qlcnic_config_switch_port(adapter, &esw_cfg[i])) 475 if (qlcnic_config_switch_port(adapter, &esw_cfg[i]))
476 return QL_STATUS_INVALID_PARAM; 476 return QL_STATUS_INVALID_PARAM;
477 } 477 }
@@ -498,7 +498,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
498 } 498 }
499 } 499 }
500 500
501 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 501 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
502 goto out; 502 goto out;
503 503
504 for (i = 0; i < count; i++) { 504 for (i = 0; i < count; i++) {
@@ -880,7 +880,7 @@ void qlcnic_create_sysfs_entries(struct qlcnic_adapter *adapter)
880{ 880{
881 struct device *dev = &adapter->pdev->dev; 881 struct device *dev = &adapter->pdev->dev;
882 882
883 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) 883 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
884 if (device_create_file(dev, &dev_attr_bridged_mode)) 884 if (device_create_file(dev, &dev_attr_bridged_mode))
885 dev_warn(dev, 885 dev_warn(dev,
886 "failed to create bridged_mode sysfs entry\n"); 886 "failed to create bridged_mode sysfs entry\n");
@@ -890,7 +890,7 @@ void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter)
890{ 890{
891 struct device *dev = &adapter->pdev->dev; 891 struct device *dev = &adapter->pdev->dev;
892 892
893 if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) 893 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
894 device_remove_file(dev, &dev_attr_bridged_mode); 894 device_remove_file(dev, &dev_attr_bridged_mode);
895} 895}
896 896
@@ -902,7 +902,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter)
902 if (device_create_bin_file(dev, &bin_attr_port_stats)) 902 if (device_create_bin_file(dev, &bin_attr_port_stats))
903 dev_info(dev, "failed to create port stats sysfs entry"); 903 dev_info(dev, "failed to create port stats sysfs entry");
904 904
905 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) 905 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC)
906 return; 906 return;
907 if (device_create_file(dev, &dev_attr_diag_mode)) 907 if (device_create_file(dev, &dev_attr_diag_mode))
908 dev_info(dev, "failed to create diag_mode sysfs entry\n"); 908 dev_info(dev, "failed to create diag_mode sysfs entry\n");
@@ -923,7 +923,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter)
923 return; 923 return;
924 if (device_create_bin_file(dev, &bin_attr_esw_config)) 924 if (device_create_bin_file(dev, &bin_attr_esw_config))
925 dev_info(dev, "failed to create esw config sysfs entry"); 925 dev_info(dev, "failed to create esw config sysfs entry");
926 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 926 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
927 return; 927 return;
928 if (device_create_bin_file(dev, &bin_attr_npar_config)) 928 if (device_create_bin_file(dev, &bin_attr_npar_config))
929 dev_info(dev, "failed to create npar config sysfs entry"); 929 dev_info(dev, "failed to create npar config sysfs entry");
@@ -940,7 +940,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter)
940 940
941 device_remove_bin_file(dev, &bin_attr_port_stats); 941 device_remove_bin_file(dev, &bin_attr_port_stats);
942 942
943 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) 943 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC)
944 return; 944 return;
945 device_remove_file(dev, &dev_attr_diag_mode); 945 device_remove_file(dev, &dev_attr_diag_mode);
946 device_remove_bin_file(dev, &bin_attr_crb); 946 device_remove_bin_file(dev, &bin_attr_crb);
@@ -952,7 +952,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter)
952 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) 952 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
953 return; 953 return;
954 device_remove_bin_file(dev, &bin_attr_esw_config); 954 device_remove_bin_file(dev, &bin_attr_esw_config);
955 if (adapter->op_mode != QLCNIC_MGMT_FUNC) 955 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
956 return; 956 return;
957 device_remove_bin_file(dev, &bin_attr_npar_config); 957 device_remove_bin_file(dev, &bin_attr_npar_config);
958 device_remove_bin_file(dev, &bin_attr_pm_config); 958 device_remove_bin_file(dev, &bin_attr_pm_config);