diff options
author | Sritej Velaga <sritej.velaga@qlogic.com> | 2011-08-29 08:50:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-29 22:52:50 -0400 |
commit | 9254b751492c7fc08497a5c0e0cd668ddd269ea2 (patch) | |
tree | 0835d876bf509dc1dc776ad87ee48cdcef043fbc /drivers/net/ethernet/qlogic | |
parent | a2050c7eeef034521f34df9cb896e72ea6802331 (diff) |
qlcnic: fix cdrp race condition
Reading CRB registers(if reqd) before releasing the api lock.
Signed-off-by: Sritej Velaga <sritej.velaga@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')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 116 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | 4 |
4 files changed, 95 insertions, 32 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 4118502ef29..2a3e552e9ff 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -1465,7 +1465,8 @@ int qlcnic_check_loopback_buff(unsigned char *data, u8 mac[]); | |||
1465 | /* Functions from qlcnic_main.c */ | 1465 | /* Functions from qlcnic_main.c */ |
1466 | int qlcnic_reset_context(struct qlcnic_adapter *); | 1466 | int qlcnic_reset_context(struct qlcnic_adapter *); |
1467 | u32 qlcnic_issue_cmd(struct qlcnic_adapter *adapter, | 1467 | u32 qlcnic_issue_cmd(struct qlcnic_adapter *adapter, |
1468 | u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd); | 1468 | u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd, |
1469 | u32 *rd_args[3]); | ||
1469 | void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings); | 1470 | void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings); |
1470 | int qlcnic_diag_alloc_res(struct net_device *netdev, int test); | 1471 | int qlcnic_diag_alloc_res(struct net_device *netdev, int test); |
1471 | netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 1472 | netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index b0d32ddd2cc..e0c85a5e91d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -28,7 +28,8 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
28 | 28 | ||
29 | u32 | 29 | u32 |
30 | qlcnic_issue_cmd(struct qlcnic_adapter *adapter, | 30 | qlcnic_issue_cmd(struct qlcnic_adapter *adapter, |
31 | u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd) | 31 | u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd, |
32 | u32 *rd_args[3]) | ||
32 | { | 33 | { |
33 | u32 rsp; | 34 | u32 rsp; |
34 | u32 signature; | 35 | u32 signature; |
@@ -56,7 +57,14 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, | |||
56 | rcode = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET); | 57 | rcode = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET); |
57 | dev_err(&pdev->dev, "failed card response code:0x%x\n", | 58 | dev_err(&pdev->dev, "failed card response code:0x%x\n", |
58 | rcode); | 59 | rcode); |
60 | } else if (rsp == QLCNIC_CDRP_RSP_OK) { | ||
61 | if (rd_args[1]) | ||
62 | *rd_args[1] = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET); | ||
63 | if (rd_args[2]) | ||
64 | *rd_args[2] = QLCRD32(adapter, QLCNIC_ARG3_CRB_OFFSET); | ||
59 | } | 65 | } |
66 | if (rd_args[0]) | ||
67 | *rd_args[0] = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET); | ||
60 | 68 | ||
61 | /* Release semaphore */ | 69 | /* Release semaphore */ |
62 | qlcnic_api_unlock(adapter); | 70 | qlcnic_api_unlock(adapter); |
@@ -80,28 +88,30 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) | |||
80 | int err, i; | 88 | int err, i; |
81 | u16 temp_size; | 89 | u16 temp_size; |
82 | void *tmp_addr; | 90 | void *tmp_addr; |
83 | u32 version, csum, *template, *tmp_buf; | 91 | u32 version, csum, *template, *tmp_buf, rsp; |
92 | u32 *rd_args[3]; | ||
84 | struct qlcnic_hardware_context *ahw; | 93 | struct qlcnic_hardware_context *ahw; |
85 | struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl; | 94 | struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl; |
86 | dma_addr_t tmp_addr_t = 0; | 95 | dma_addr_t tmp_addr_t = 0; |
87 | 96 | ||
88 | ahw = adapter->ahw; | 97 | ahw = adapter->ahw; |
98 | rd_args[0] = &rsp; | ||
99 | rd_args[1] = (u32 *) &temp_size; | ||
100 | rd_args[2] = &version; | ||
89 | err = qlcnic_issue_cmd(adapter, | 101 | err = qlcnic_issue_cmd(adapter, |
90 | adapter->ahw->pci_func, | 102 | adapter->ahw->pci_func, |
91 | adapter->fw_hal_version, | 103 | adapter->fw_hal_version, |
92 | 0, | 104 | 0, |
93 | 0, | 105 | 0, |
94 | 0, | 106 | 0, |
95 | QLCNIC_CDRP_CMD_TEMP_SIZE); | 107 | QLCNIC_CDRP_CMD_TEMP_SIZE, |
108 | rd_args); | ||
96 | if (err != QLCNIC_RCODE_SUCCESS) { | 109 | if (err != QLCNIC_RCODE_SUCCESS) { |
97 | err = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET); | ||
98 | dev_info(&adapter->pdev->dev, | 110 | dev_info(&adapter->pdev->dev, |
99 | "Can't get template size %d\n", err); | 111 | "Can't get template size %d\n", rsp); |
100 | err = -EIO; | 112 | err = -EIO; |
101 | return err; | 113 | return err; |
102 | } | 114 | } |
103 | version = QLCRD32(adapter, QLCNIC_ARG3_CRB_OFFSET); | ||
104 | temp_size = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET); | ||
105 | if (!temp_size) | 115 | if (!temp_size) |
106 | return -EIO; | 116 | return -EIO; |
107 | 117 | ||
@@ -112,13 +122,15 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter) | |||
112 | "Can't get memory for FW dump template\n"); | 122 | "Can't get memory for FW dump template\n"); |
113 | return -ENOMEM; | 123 | return -ENOMEM; |
114 | } | 124 | } |
125 | memset(rd_args, 0, sizeof(rd_args)); | ||
115 | err = qlcnic_issue_cmd(adapter, | 126 | err = qlcnic_issue_cmd(adapter, |
116 | adapter->ahw->pci_func, | 127 | adapter->ahw->pci_func, |
117 | adapter->fw_hal_version, | 128 | adapter->fw_hal_version, |
118 | LSD(tmp_addr_t), | 129 | LSD(tmp_addr_t), |
119 | MSD(tmp_addr_t), | 130 | MSD(tmp_addr_t), |
120 | temp_size, | 131 | temp_size, |
121 | QLCNIC_CDRP_CMD_GET_TEMP_HDR); | 132 | QLCNIC_CDRP_CMD_GET_TEMP_HDR, |
133 | rd_args); | ||
122 | 134 | ||
123 | if (err != QLCNIC_RCODE_SUCCESS) { | 135 | if (err != QLCNIC_RCODE_SUCCESS) { |
124 | dev_err(&adapter->pdev->dev, | 136 | dev_err(&adapter->pdev->dev, |
@@ -155,8 +167,10 @@ error: | |||
155 | int | 167 | int |
156 | qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) | 168 | qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) |
157 | { | 169 | { |
170 | u32 *rd_args[3]; | ||
158 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 171 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
159 | 172 | ||
173 | memset(rd_args, 0, sizeof(rd_args)); | ||
160 | if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) { | 174 | if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) { |
161 | if (qlcnic_issue_cmd(adapter, | 175 | if (qlcnic_issue_cmd(adapter, |
162 | adapter->ahw->pci_func, | 176 | adapter->ahw->pci_func, |
@@ -164,7 +178,8 @@ qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) | |||
164 | recv_ctx->context_id, | 178 | recv_ctx->context_id, |
165 | mtu, | 179 | mtu, |
166 | 0, | 180 | 0, |
167 | QLCNIC_CDRP_CMD_SET_MTU)) { | 181 | QLCNIC_CDRP_CMD_SET_MTU, |
182 | rd_args)) { | ||
168 | 183 | ||
169 | dev_err(&adapter->pdev->dev, "Failed to set mtu\n"); | 184 | dev_err(&adapter->pdev->dev, "Failed to set mtu\n"); |
170 | return -EIO; | 185 | return -EIO; |
@@ -193,6 +208,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
193 | u8 i, nrds_rings, nsds_rings; | 208 | u8 i, nrds_rings, nsds_rings; |
194 | size_t rq_size, rsp_size; | 209 | size_t rq_size, rsp_size; |
195 | u32 cap, reg, val, reg2; | 210 | u32 cap, reg, val, reg2; |
211 | u32 *rd_args[3]; | ||
196 | int err; | 212 | int err; |
197 | 213 | ||
198 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 214 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
@@ -274,13 +290,15 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
274 | } | 290 | } |
275 | 291 | ||
276 | phys_addr = hostrq_phys_addr; | 292 | phys_addr = hostrq_phys_addr; |
293 | memset(rd_args, 0, sizeof(rd_args)); | ||
277 | err = qlcnic_issue_cmd(adapter, | 294 | err = qlcnic_issue_cmd(adapter, |
278 | adapter->ahw->pci_func, | 295 | adapter->ahw->pci_func, |
279 | adapter->fw_hal_version, | 296 | adapter->fw_hal_version, |
280 | (u32)(phys_addr >> 32), | 297 | (u32)(phys_addr >> 32), |
281 | (u32)(phys_addr & 0xffffffff), | 298 | (u32)(phys_addr & 0xffffffff), |
282 | rq_size, | 299 | rq_size, |
283 | QLCNIC_CDRP_CMD_CREATE_RX_CTX); | 300 | QLCNIC_CDRP_CMD_CREATE_RX_CTX, |
301 | rd_args); | ||
284 | if (err) { | 302 | if (err) { |
285 | dev_err(&adapter->pdev->dev, | 303 | dev_err(&adapter->pdev->dev, |
286 | "Failed to create rx ctx in firmware%d\n", err); | 304 | "Failed to create rx ctx in firmware%d\n", err); |
@@ -326,15 +344,18 @@ out_free_rq: | |||
326 | static void | 344 | static void |
327 | qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter) | 345 | qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter) |
328 | { | 346 | { |
347 | u32 *rd_args[3]; | ||
329 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 348 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
330 | 349 | ||
350 | memset(rd_args, 0, sizeof(rd_args)); | ||
331 | if (qlcnic_issue_cmd(adapter, | 351 | if (qlcnic_issue_cmd(adapter, |
332 | adapter->ahw->pci_func, | 352 | adapter->ahw->pci_func, |
333 | adapter->fw_hal_version, | 353 | adapter->fw_hal_version, |
334 | recv_ctx->context_id, | 354 | recv_ctx->context_id, |
335 | QLCNIC_DESTROY_CTX_RESET, | 355 | QLCNIC_DESTROY_CTX_RESET, |
336 | 0, | 356 | 0, |
337 | QLCNIC_CDRP_CMD_DESTROY_RX_CTX)) { | 357 | QLCNIC_CDRP_CMD_DESTROY_RX_CTX, |
358 | rd_args)) { | ||
338 | 359 | ||
339 | dev_err(&adapter->pdev->dev, | 360 | dev_err(&adapter->pdev->dev, |
340 | "Failed to destroy rx ctx in firmware\n"); | 361 | "Failed to destroy rx ctx in firmware\n"); |
@@ -352,6 +373,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
352 | void *rq_addr, *rsp_addr; | 373 | void *rq_addr, *rsp_addr; |
353 | size_t rq_size, rsp_size; | 374 | size_t rq_size, rsp_size; |
354 | u32 temp; | 375 | u32 temp; |
376 | u32 *rd_args[3]; | ||
355 | int err; | 377 | int err; |
356 | u64 phys_addr; | 378 | u64 phys_addr; |
357 | dma_addr_t rq_phys_addr, rsp_phys_addr; | 379 | dma_addr_t rq_phys_addr, rsp_phys_addr; |
@@ -401,13 +423,15 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
401 | prq_cds->ring_size = cpu_to_le32(tx_ring->num_desc); | 423 | prq_cds->ring_size = cpu_to_le32(tx_ring->num_desc); |
402 | 424 | ||
403 | phys_addr = rq_phys_addr; | 425 | phys_addr = rq_phys_addr; |
426 | memset(rd_args, 0, sizeof(rd_args)); | ||
404 | err = qlcnic_issue_cmd(adapter, | 427 | err = qlcnic_issue_cmd(adapter, |
405 | adapter->ahw->pci_func, | 428 | adapter->ahw->pci_func, |
406 | adapter->fw_hal_version, | 429 | adapter->fw_hal_version, |
407 | (u32)(phys_addr >> 32), | 430 | (u32)(phys_addr >> 32), |
408 | ((u32)phys_addr & 0xffffffff), | 431 | ((u32)phys_addr & 0xffffffff), |
409 | rq_size, | 432 | rq_size, |
410 | QLCNIC_CDRP_CMD_CREATE_TX_CTX); | 433 | QLCNIC_CDRP_CMD_CREATE_TX_CTX, |
434 | rd_args); | ||
411 | 435 | ||
412 | if (err == QLCNIC_RCODE_SUCCESS) { | 436 | if (err == QLCNIC_RCODE_SUCCESS) { |
413 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); | 437 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); |
@@ -433,13 +457,17 @@ out_free_rq: | |||
433 | static void | 457 | static void |
434 | qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) | 458 | qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) |
435 | { | 459 | { |
460 | u32 *rd_args[3]; | ||
461 | |||
462 | memset(rd_args, 0, sizeof(rd_args)); | ||
436 | if (qlcnic_issue_cmd(adapter, | 463 | if (qlcnic_issue_cmd(adapter, |
437 | adapter->ahw->pci_func, | 464 | adapter->ahw->pci_func, |
438 | adapter->fw_hal_version, | 465 | adapter->fw_hal_version, |
439 | adapter->tx_context_id, | 466 | adapter->tx_context_id, |
440 | QLCNIC_DESTROY_CTX_RESET, | 467 | QLCNIC_DESTROY_CTX_RESET, |
441 | 0, | 468 | 0, |
442 | QLCNIC_CDRP_CMD_DESTROY_TX_CTX)) { | 469 | QLCNIC_CDRP_CMD_DESTROY_TX_CTX, |
470 | rd_args)) { | ||
443 | 471 | ||
444 | dev_err(&adapter->pdev->dev, | 472 | dev_err(&adapter->pdev->dev, |
445 | "Failed to destroy tx ctx in firmware\n"); | 473 | "Failed to destroy tx ctx in firmware\n"); |
@@ -449,13 +477,17 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) | |||
449 | int | 477 | int |
450 | qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config) | 478 | qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config) |
451 | { | 479 | { |
480 | u32 *rd_args[3]; | ||
481 | |||
482 | memset(rd_args, 0, sizeof(rd_args)); | ||
452 | return qlcnic_issue_cmd(adapter, | 483 | return qlcnic_issue_cmd(adapter, |
453 | adapter->ahw->pci_func, | 484 | adapter->ahw->pci_func, |
454 | adapter->fw_hal_version, | 485 | adapter->fw_hal_version, |
455 | config, | 486 | config, |
456 | 0, | 487 | 0, |
457 | 0, | 488 | 0, |
458 | QLCNIC_CDRP_CMD_CONFIG_PORT); | 489 | QLCNIC_CDRP_CMD_CONFIG_PORT, |
490 | rd_args); | ||
459 | } | 491 | } |
460 | 492 | ||
461 | int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | 493 | int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) |
@@ -620,20 +652,24 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
620 | int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac) | 652 | int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac) |
621 | { | 653 | { |
622 | int err; | 654 | int err; |
623 | u32 arg1; | 655 | u32 arg1, rd_arg1, rd_arg2; |
656 | u32 *rd_args[3]; | ||
624 | 657 | ||
625 | arg1 = adapter->ahw->pci_func | BIT_8; | 658 | arg1 = adapter->ahw->pci_func | BIT_8; |
659 | rd_args[0] = &rd_arg1; | ||
660 | rd_args[1] = &rd_arg2; | ||
661 | rd_args[2] = 0; | ||
626 | err = qlcnic_issue_cmd(adapter, | 662 | err = qlcnic_issue_cmd(adapter, |
627 | adapter->ahw->pci_func, | 663 | adapter->ahw->pci_func, |
628 | adapter->fw_hal_version, | 664 | adapter->fw_hal_version, |
629 | arg1, | 665 | arg1, |
630 | 0, | 666 | 0, |
631 | 0, | 667 | 0, |
632 | QLCNIC_CDRP_CMD_MAC_ADDRESS); | 668 | QLCNIC_CDRP_CMD_MAC_ADDRESS, |
669 | rd_args); | ||
633 | 670 | ||
634 | if (err == QLCNIC_RCODE_SUCCESS) | 671 | if (err == QLCNIC_RCODE_SUCCESS) |
635 | qlcnic_fetch_mac(adapter, QLCNIC_ARG1_CRB_OFFSET, | 672 | qlcnic_fetch_mac(adapter, rd_arg1, rd_arg2, 0, mac); |
636 | QLCNIC_ARG2_CRB_OFFSET, 0, mac); | ||
637 | else { | 673 | else { |
638 | dev_err(&adapter->pdev->dev, | 674 | dev_err(&adapter->pdev->dev, |
639 | "Failed to get mac address%d\n", err); | 675 | "Failed to get mac address%d\n", err); |
@@ -651,6 +687,7 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, | |||
651 | dma_addr_t nic_dma_t; | 687 | dma_addr_t nic_dma_t; |
652 | struct qlcnic_info *nic_info; | 688 | struct qlcnic_info *nic_info; |
653 | void *nic_info_addr; | 689 | void *nic_info_addr; |
690 | u32 *rd_args[3]; | ||
654 | size_t nic_size = sizeof(struct qlcnic_info); | 691 | size_t nic_size = sizeof(struct qlcnic_info); |
655 | 692 | ||
656 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, | 693 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
@@ -660,13 +697,15 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, | |||
660 | memset(nic_info_addr, 0, nic_size); | 697 | memset(nic_info_addr, 0, nic_size); |
661 | 698 | ||
662 | nic_info = nic_info_addr; | 699 | nic_info = nic_info_addr; |
700 | memset(rd_args, 0, sizeof(rd_args)); | ||
663 | err = qlcnic_issue_cmd(adapter, | 701 | err = qlcnic_issue_cmd(adapter, |
664 | adapter->ahw->pci_func, | 702 | adapter->ahw->pci_func, |
665 | adapter->fw_hal_version, | 703 | adapter->fw_hal_version, |
666 | MSD(nic_dma_t), | 704 | MSD(nic_dma_t), |
667 | LSD(nic_dma_t), | 705 | LSD(nic_dma_t), |
668 | (func_id << 16 | nic_size), | 706 | (func_id << 16 | nic_size), |
669 | QLCNIC_CDRP_CMD_GET_NIC_INFO); | 707 | QLCNIC_CDRP_CMD_GET_NIC_INFO, |
708 | rd_args); | ||
670 | 709 | ||
671 | if (err == QLCNIC_RCODE_SUCCESS) { | 710 | if (err == QLCNIC_RCODE_SUCCESS) { |
672 | npar_info->pci_func = le16_to_cpu(nic_info->pci_func); | 711 | npar_info->pci_func = le16_to_cpu(nic_info->pci_func); |
@@ -705,6 +744,7 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
705 | int err = -EIO; | 744 | int err = -EIO; |
706 | dma_addr_t nic_dma_t; | 745 | dma_addr_t nic_dma_t; |
707 | void *nic_info_addr; | 746 | void *nic_info_addr; |
747 | u32 *rd_args[3]; | ||
708 | struct qlcnic_info *nic_info; | 748 | struct qlcnic_info *nic_info; |
709 | size_t nic_size = sizeof(struct qlcnic_info); | 749 | size_t nic_size = sizeof(struct qlcnic_info); |
710 | 750 | ||
@@ -730,13 +770,15 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
730 | nic_info->min_tx_bw = cpu_to_le16(nic->min_tx_bw); | 770 | nic_info->min_tx_bw = cpu_to_le16(nic->min_tx_bw); |
731 | nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw); | 771 | nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw); |
732 | 772 | ||
773 | memset(rd_args, 0, sizeof(rd_args)); | ||
733 | err = qlcnic_issue_cmd(adapter, | 774 | err = qlcnic_issue_cmd(adapter, |
734 | adapter->ahw->pci_func, | 775 | adapter->ahw->pci_func, |
735 | adapter->fw_hal_version, | 776 | adapter->fw_hal_version, |
736 | MSD(nic_dma_t), | 777 | MSD(nic_dma_t), |
737 | LSD(nic_dma_t), | 778 | LSD(nic_dma_t), |
738 | ((nic->pci_func << 16) | nic_size), | 779 | ((nic->pci_func << 16) | nic_size), |
739 | QLCNIC_CDRP_CMD_SET_NIC_INFO); | 780 | QLCNIC_CDRP_CMD_SET_NIC_INFO, |
781 | rd_args); | ||
740 | 782 | ||
741 | if (err != QLCNIC_RCODE_SUCCESS) { | 783 | if (err != QLCNIC_RCODE_SUCCESS) { |
742 | dev_err(&adapter->pdev->dev, | 784 | dev_err(&adapter->pdev->dev, |
@@ -754,6 +796,7 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter, | |||
754 | struct qlcnic_pci_info *pci_info) | 796 | struct qlcnic_pci_info *pci_info) |
755 | { | 797 | { |
756 | int err = 0, i; | 798 | int err = 0, i; |
799 | u32 *rd_args[3]; | ||
757 | dma_addr_t pci_info_dma_t; | 800 | dma_addr_t pci_info_dma_t; |
758 | struct qlcnic_pci_info *npar; | 801 | struct qlcnic_pci_info *npar; |
759 | void *pci_info_addr; | 802 | void *pci_info_addr; |
@@ -767,13 +810,15 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter, | |||
767 | memset(pci_info_addr, 0, pci_size); | 810 | memset(pci_info_addr, 0, pci_size); |
768 | 811 | ||
769 | npar = pci_info_addr; | 812 | npar = pci_info_addr; |
813 | memset(rd_args, 0, sizeof(rd_args)); | ||
770 | err = qlcnic_issue_cmd(adapter, | 814 | err = qlcnic_issue_cmd(adapter, |
771 | adapter->ahw->pci_func, | 815 | adapter->ahw->pci_func, |
772 | adapter->fw_hal_version, | 816 | adapter->fw_hal_version, |
773 | MSD(pci_info_dma_t), | 817 | MSD(pci_info_dma_t), |
774 | LSD(pci_info_dma_t), | 818 | LSD(pci_info_dma_t), |
775 | pci_size, | 819 | pci_size, |
776 | QLCNIC_CDRP_CMD_GET_PCI_INFO); | 820 | QLCNIC_CDRP_CMD_GET_PCI_INFO, |
821 | rd_args); | ||
777 | 822 | ||
778 | if (err == QLCNIC_RCODE_SUCCESS) { | 823 | if (err == QLCNIC_RCODE_SUCCESS) { |
779 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++, pci_info++) { | 824 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++, pci_info++) { |
@@ -805,6 +850,7 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, | |||
805 | { | 850 | { |
806 | int err = -EIO; | 851 | int err = -EIO; |
807 | u32 arg1; | 852 | u32 arg1; |
853 | u32 *rd_args[3]; | ||
808 | 854 | ||
809 | if (adapter->op_mode != QLCNIC_MGMT_FUNC || | 855 | if (adapter->op_mode != QLCNIC_MGMT_FUNC || |
810 | !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) | 856 | !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) |
@@ -813,13 +859,15 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, | |||
813 | arg1 = id | (enable_mirroring ? BIT_4 : 0); | 859 | arg1 = id | (enable_mirroring ? BIT_4 : 0); |
814 | arg1 |= pci_func << 8; | 860 | arg1 |= pci_func << 8; |
815 | 861 | ||
862 | memset(rd_args, 0, sizeof(rd_args)); | ||
816 | err = qlcnic_issue_cmd(adapter, | 863 | err = qlcnic_issue_cmd(adapter, |
817 | adapter->ahw->pci_func, | 864 | adapter->ahw->pci_func, |
818 | adapter->fw_hal_version, | 865 | adapter->fw_hal_version, |
819 | arg1, | 866 | arg1, |
820 | 0, | 867 | 0, |
821 | 0, | 868 | 0, |
822 | QLCNIC_CDRP_CMD_SET_PORTMIRRORING); | 869 | QLCNIC_CDRP_CMD_SET_PORTMIRRORING, |
870 | rd_args); | ||
823 | 871 | ||
824 | if (err != QLCNIC_RCODE_SUCCESS) { | 872 | if (err != QLCNIC_RCODE_SUCCESS) { |
825 | dev_err(&adapter->pdev->dev, | 873 | dev_err(&adapter->pdev->dev, |
@@ -842,6 +890,7 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
842 | dma_addr_t stats_dma_t; | 890 | dma_addr_t stats_dma_t; |
843 | void *stats_addr; | 891 | void *stats_addr; |
844 | u32 arg1; | 892 | u32 arg1; |
893 | u32 *rd_args[3]; | ||
845 | int err; | 894 | int err; |
846 | 895 | ||
847 | if (esw_stats == NULL) | 896 | if (esw_stats == NULL) |
@@ -865,13 +914,15 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
865 | arg1 = func | QLCNIC_STATS_VERSION << 8 | QLCNIC_STATS_PORT << 12; | 914 | arg1 = func | QLCNIC_STATS_VERSION << 8 | QLCNIC_STATS_PORT << 12; |
866 | arg1 |= rx_tx << 15 | stats_size << 16; | 915 | arg1 |= rx_tx << 15 | stats_size << 16; |
867 | 916 | ||
917 | memset(rd_args, 0, sizeof(rd_args)); | ||
868 | err = qlcnic_issue_cmd(adapter, | 918 | err = qlcnic_issue_cmd(adapter, |
869 | adapter->ahw->pci_func, | 919 | adapter->ahw->pci_func, |
870 | adapter->fw_hal_version, | 920 | adapter->fw_hal_version, |
871 | arg1, | 921 | arg1, |
872 | MSD(stats_dma_t), | 922 | MSD(stats_dma_t), |
873 | LSD(stats_dma_t), | 923 | LSD(stats_dma_t), |
874 | QLCNIC_CDRP_CMD_GET_ESWITCH_STATS); | 924 | QLCNIC_CDRP_CMD_GET_ESWITCH_STATS, |
925 | rd_args); | ||
875 | 926 | ||
876 | if (!err) { | 927 | if (!err) { |
877 | stats = stats_addr; | 928 | stats = stats_addr; |
@@ -952,6 +1003,7 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw, | |||
952 | { | 1003 | { |
953 | 1004 | ||
954 | u32 arg1; | 1005 | u32 arg1; |
1006 | u32 *rd_args[3]; | ||
955 | 1007 | ||
956 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) | 1008 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) |
957 | return -EIO; | 1009 | return -EIO; |
@@ -972,13 +1024,15 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw, | |||
972 | arg1 = port | QLCNIC_STATS_VERSION << 8 | func_esw << 12; | 1024 | arg1 = port | QLCNIC_STATS_VERSION << 8 | func_esw << 12; |
973 | arg1 |= BIT_14 | rx_tx << 15; | 1025 | arg1 |= BIT_14 | rx_tx << 15; |
974 | 1026 | ||
1027 | memset(rd_args, 0, sizeof(rd_args)); | ||
975 | return qlcnic_issue_cmd(adapter, | 1028 | return qlcnic_issue_cmd(adapter, |
976 | adapter->ahw->pci_func, | 1029 | adapter->ahw->pci_func, |
977 | adapter->fw_hal_version, | 1030 | adapter->fw_hal_version, |
978 | arg1, | 1031 | arg1, |
979 | 0, | 1032 | 0, |
980 | 0, | 1033 | 0, |
981 | QLCNIC_CDRP_CMD_GET_ESWITCH_STATS); | 1034 | QLCNIC_CDRP_CMD_GET_ESWITCH_STATS, |
1035 | rd_args); | ||
982 | 1036 | ||
983 | err_ret: | 1037 | err_ret: |
984 | dev_err(&adapter->pdev->dev, "Invalid argument func_esw=%d port=%d" | 1038 | dev_err(&adapter->pdev->dev, "Invalid argument func_esw=%d port=%d" |
@@ -991,19 +1045,22 @@ __qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter, | |||
991 | u32 *arg1, u32 *arg2) | 1045 | u32 *arg1, u32 *arg2) |
992 | { | 1046 | { |
993 | int err = -EIO; | 1047 | int err = -EIO; |
1048 | u32 *rd_args[3]; | ||
994 | u8 pci_func; | 1049 | u8 pci_func; |
995 | pci_func = (*arg1 >> 8); | 1050 | pci_func = (*arg1 >> 8); |
1051 | rd_args[0] = arg1; | ||
1052 | rd_args[1] = arg2; | ||
1053 | rd_args[2] = 0; | ||
996 | err = qlcnic_issue_cmd(adapter, | 1054 | err = qlcnic_issue_cmd(adapter, |
997 | adapter->ahw->pci_func, | 1055 | adapter->ahw->pci_func, |
998 | adapter->fw_hal_version, | 1056 | adapter->fw_hal_version, |
999 | *arg1, | 1057 | *arg1, |
1000 | 0, | 1058 | 0, |
1001 | 0, | 1059 | 0, |
1002 | QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG); | 1060 | QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG, |
1061 | rd_args); | ||
1003 | 1062 | ||
1004 | if (err == QLCNIC_RCODE_SUCCESS) { | 1063 | if (err == QLCNIC_RCODE_SUCCESS) { |
1005 | *arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET); | ||
1006 | *arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET); | ||
1007 | dev_info(&adapter->pdev->dev, | 1064 | dev_info(&adapter->pdev->dev, |
1008 | "eSwitch port config for pci func %d\n", pci_func); | 1065 | "eSwitch port config for pci func %d\n", pci_func); |
1009 | } else { | 1066 | } else { |
@@ -1025,6 +1082,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, | |||
1025 | { | 1082 | { |
1026 | int err = -EIO; | 1083 | int err = -EIO; |
1027 | u32 arg1, arg2 = 0; | 1084 | u32 arg1, arg2 = 0; |
1085 | u32 *rd_args[3]; | ||
1028 | u8 pci_func; | 1086 | u8 pci_func; |
1029 | 1087 | ||
1030 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) | 1088 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) |
@@ -1071,13 +1129,15 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, | |||
1071 | return err; | 1129 | return err; |
1072 | } | 1130 | } |
1073 | 1131 | ||
1132 | memset(rd_args, 0, sizeof(rd_args)); | ||
1074 | err = qlcnic_issue_cmd(adapter, | 1133 | err = qlcnic_issue_cmd(adapter, |
1075 | adapter->ahw->pci_func, | 1134 | adapter->ahw->pci_func, |
1076 | adapter->fw_hal_version, | 1135 | adapter->fw_hal_version, |
1077 | arg1, | 1136 | arg1, |
1078 | arg2, | 1137 | arg2, |
1079 | 0, | 1138 | 0, |
1080 | QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH); | 1139 | QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH, |
1140 | rd_args); | ||
1081 | 1141 | ||
1082 | if (err != QLCNIC_RCODE_SUCCESS) { | 1142 | if (err != QLCNIC_RCODE_SUCCESS) { |
1083 | dev_err(&adapter->pdev->dev, | 1143 | dev_err(&adapter->pdev->dev, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 720b3330aaf..2230a62268a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -659,6 +659,7 @@ static int qlcnic_irq_test(struct net_device *netdev) | |||
659 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 659 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
660 | int max_sds_rings = adapter->max_sds_rings; | 660 | int max_sds_rings = adapter->max_sds_rings; |
661 | int ret; | 661 | int ret; |
662 | u32 *rd_args[3]; | ||
662 | 663 | ||
663 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | 664 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) |
664 | return -EIO; | 665 | return -EIO; |
@@ -668,9 +669,10 @@ static int qlcnic_irq_test(struct net_device *netdev) | |||
668 | goto clear_it; | 669 | goto clear_it; |
669 | 670 | ||
670 | adapter->diag_cnt = 0; | 671 | adapter->diag_cnt = 0; |
672 | memset(rd_args, 0, sizeof(rd_args)); | ||
671 | ret = qlcnic_issue_cmd(adapter, adapter->ahw->pci_func, | 673 | ret = qlcnic_issue_cmd(adapter, adapter->ahw->pci_func, |
672 | adapter->fw_hal_version, adapter->ahw->pci_func, | 674 | adapter->fw_hal_version, adapter->ahw->pci_func, |
673 | 0, 0, 0x00000011); | 675 | 0, 0, 0x00000011, rd_args); |
674 | if (ret) | 676 | if (ret) |
675 | goto done; | 677 | goto done; |
676 | 678 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index 7f4b8e69079..312c1c37889 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | |||
@@ -1889,8 +1889,8 @@ qlcnic_fetch_mac(struct qlcnic_adapter *adapter, u32 off1, u32 off2, | |||
1889 | u32 mac_low, mac_high; | 1889 | u32 mac_low, mac_high; |
1890 | int i; | 1890 | int i; |
1891 | 1891 | ||
1892 | mac_low = QLCRD32(adapter, off1); | 1892 | mac_low = off1; |
1893 | mac_high = QLCRD32(adapter, off2); | 1893 | mac_high = off2; |
1894 | 1894 | ||
1895 | if (alt_mac) { | 1895 | if (alt_mac) { |
1896 | mac_low |= (mac_low >> 16) | (mac_high << 16); | 1896 | mac_low |= (mac_low >> 16) | (mac_high << 16); |