diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-06-21 23:19:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-23 16:16:30 -0400 |
commit | 8a15ad1fb14d67450742cf975a76e744b3189f4d (patch) | |
tree | d64402cdeec98e3838d8c73924db199a294ba845 /drivers | |
parent | 42f65cbad4168958dff8a307bfe4b528409951d3 (diff) |
qlcnic: release device resources during interface down
Previously we were allocating device resources during probe and
release them during remove.
Now alloc during interface up and release in interface down.
This helps in device performance, as it doesn't need to keep
track of inactive resources.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 4 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ctx.c | 50 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_hw.c | 4 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 26 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 60 |
6 files changed, 114 insertions, 37 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index 588b9a9611aa..5c7d474e560b 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -1124,6 +1124,10 @@ void __iomem *qlcnic_get_ioaddr(struct qlcnic_adapter *, u32); | |||
1124 | int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter); | 1124 | int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter); |
1125 | void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter); | 1125 | void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter); |
1126 | 1126 | ||
1127 | int qlcnic_fw_create_ctx(struct qlcnic_adapter *adapter); | ||
1128 | void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter); | ||
1129 | |||
1130 | void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter); | ||
1127 | void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter); | 1131 | void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter); |
1128 | void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter); | 1132 | void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter); |
1129 | 1133 | ||
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c index 7c96c8e06c3f..be341c1564b8 100644 --- a/drivers/net/qlcnic/qlcnic_ctx.c +++ b/drivers/net/qlcnic/qlcnic_ctx.c | |||
@@ -180,6 +180,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
180 | for (i = 0; i < nrds_rings; i++) { | 180 | for (i = 0; i < nrds_rings; i++) { |
181 | 181 | ||
182 | rds_ring = &recv_ctx->rds_rings[i]; | 182 | rds_ring = &recv_ctx->rds_rings[i]; |
183 | rds_ring->producer = 0; | ||
183 | 184 | ||
184 | prq_rds[i].host_phys_addr = cpu_to_le64(rds_ring->phys_addr); | 185 | prq_rds[i].host_phys_addr = cpu_to_le64(rds_ring->phys_addr); |
185 | prq_rds[i].ring_size = cpu_to_le32(rds_ring->num_desc); | 186 | prq_rds[i].ring_size = cpu_to_le32(rds_ring->num_desc); |
@@ -193,6 +194,8 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
193 | for (i = 0; i < nsds_rings; i++) { | 194 | for (i = 0; i < nsds_rings; i++) { |
194 | 195 | ||
195 | sds_ring = &recv_ctx->sds_rings[i]; | 196 | sds_ring = &recv_ctx->sds_rings[i]; |
197 | sds_ring->consumer = 0; | ||
198 | memset(sds_ring->desc_head, 0, STATUS_DESC_RINGSIZE(sds_ring)); | ||
196 | 199 | ||
197 | prq_sds[i].host_phys_addr = cpu_to_le64(sds_ring->phys_addr); | 200 | prq_sds[i].host_phys_addr = cpu_to_le64(sds_ring->phys_addr); |
198 | prq_sds[i].ring_size = cpu_to_le32(sds_ring->num_desc); | 201 | prq_sds[i].ring_size = cpu_to_le32(sds_ring->num_desc); |
@@ -293,6 +296,11 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
293 | dma_addr_t rq_phys_addr, rsp_phys_addr; | 296 | dma_addr_t rq_phys_addr, rsp_phys_addr; |
294 | struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring; | 297 | struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring; |
295 | 298 | ||
299 | /* reset host resources */ | ||
300 | tx_ring->producer = 0; | ||
301 | tx_ring->sw_consumer = 0; | ||
302 | *(tx_ring->hw_consumer) = 0; | ||
303 | |||
296 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); | 304 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); |
297 | rq_addr = pci_alloc_consistent(adapter->pdev, | 305 | rq_addr = pci_alloc_consistent(adapter->pdev, |
298 | rq_size, &rq_phys_addr); | 306 | rq_size, &rq_phys_addr); |
@@ -476,15 +484,6 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
476 | sds_ring->desc_head = (struct status_desc *)addr; | 484 | sds_ring->desc_head = (struct status_desc *)addr; |
477 | } | 485 | } |
478 | 486 | ||
479 | |||
480 | err = qlcnic_fw_cmd_create_rx_ctx(adapter); | ||
481 | if (err) | ||
482 | goto err_out_free; | ||
483 | err = qlcnic_fw_cmd_create_tx_ctx(adapter); | ||
484 | if (err) | ||
485 | goto err_out_free; | ||
486 | |||
487 | set_bit(__QLCNIC_FW_ATTACHED, &adapter->state); | ||
488 | return 0; | 487 | return 0; |
489 | 488 | ||
490 | err_out_free: | 489 | err_out_free: |
@@ -492,15 +491,27 @@ err_out_free: | |||
492 | return err; | 491 | return err; |
493 | } | 492 | } |
494 | 493 | ||
495 | void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | 494 | |
495 | int qlcnic_fw_create_ctx(struct qlcnic_adapter *adapter) | ||
496 | { | 496 | { |
497 | struct qlcnic_recv_context *recv_ctx; | 497 | int err; |
498 | struct qlcnic_host_rds_ring *rds_ring; | 498 | |
499 | struct qlcnic_host_sds_ring *sds_ring; | 499 | err = qlcnic_fw_cmd_create_rx_ctx(adapter); |
500 | struct qlcnic_host_tx_ring *tx_ring; | 500 | if (err) |
501 | int ring; | 501 | return err; |
502 | 502 | ||
503 | err = qlcnic_fw_cmd_create_tx_ctx(adapter); | ||
504 | if (err) { | ||
505 | qlcnic_fw_cmd_destroy_rx_ctx(adapter); | ||
506 | return err; | ||
507 | } | ||
508 | |||
509 | set_bit(__QLCNIC_FW_ATTACHED, &adapter->state); | ||
510 | return 0; | ||
511 | } | ||
503 | 512 | ||
513 | void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) | ||
514 | { | ||
504 | if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { | 515 | if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { |
505 | qlcnic_fw_cmd_destroy_rx_ctx(adapter); | 516 | qlcnic_fw_cmd_destroy_rx_ctx(adapter); |
506 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); | 517 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); |
@@ -508,6 +519,15 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
508 | /* Allow dma queues to drain after context reset */ | 519 | /* Allow dma queues to drain after context reset */ |
509 | msleep(20); | 520 | msleep(20); |
510 | } | 521 | } |
522 | } | ||
523 | |||
524 | void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | ||
525 | { | ||
526 | struct qlcnic_recv_context *recv_ctx; | ||
527 | struct qlcnic_host_rds_ring *rds_ring; | ||
528 | struct qlcnic_host_sds_ring *sds_ring; | ||
529 | struct qlcnic_host_tx_ring *tx_ring; | ||
530 | int ring; | ||
511 | 531 | ||
512 | recv_ctx = &adapter->recv_ctx; | 532 | recv_ctx = &adapter->recv_ctx; |
513 | 533 | ||
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index a4f112022715..d4e803e2a977 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -348,7 +348,7 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
348 | for (i = 0; diag_registers[i] != -1; i++) | 348 | for (i = 0; diag_registers[i] != -1; i++) |
349 | regs_buff[i] = QLCRD32(adapter, diag_registers[i]); | 349 | regs_buff[i] = QLCRD32(adapter, diag_registers[i]); |
350 | 350 | ||
351 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 351 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) |
352 | return; | 352 | return; |
353 | 353 | ||
354 | regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/ | 354 | regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/ |
@@ -833,6 +833,9 @@ static int qlcnic_blink_led(struct net_device *dev, u32 val) | |||
833 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 833 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
834 | int ret; | 834 | int ret; |
835 | 835 | ||
836 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) | ||
837 | return -EIO; | ||
838 | |||
836 | ret = adapter->nic_ops->config_led(adapter, 1, 0xf); | 839 | ret = adapter->nic_ops->config_led(adapter, 1, 0xf); |
837 | if (ret) { | 840 | if (ret) { |
838 | dev_err(&adapter->pdev->dev, | 841 | dev_err(&adapter->pdev->dev, |
@@ -904,7 +907,7 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, | |||
904 | { | 907 | { |
905 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 908 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
906 | 909 | ||
907 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 910 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) |
908 | return -EINVAL; | 911 | return -EINVAL; |
909 | 912 | ||
910 | /* | 913 | /* |
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index ad124254b6a9..e08c8b0556a4 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c | |||
@@ -327,7 +327,7 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter, | |||
327 | 327 | ||
328 | i = 0; | 328 | i = 0; |
329 | 329 | ||
330 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 330 | if (!test_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) |
331 | return -EIO; | 331 | return -EIO; |
332 | 332 | ||
333 | tx_ring = adapter->tx_ring; | 333 | tx_ring = adapter->tx_ring; |
@@ -431,7 +431,7 @@ void qlcnic_set_multi(struct net_device *netdev) | |||
431 | u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 431 | u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
432 | u32 mode = VPORT_MISS_MODE_DROP; | 432 | u32 mode = VPORT_MISS_MODE_DROP; |
433 | 433 | ||
434 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 434 | if (!test_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) |
435 | return; | 435 | return; |
436 | 436 | ||
437 | qlcnic_nic_add_mac(adapter, adapter->mac_addr); | 437 | qlcnic_nic_add_mac(adapter, adapter->mac_addr); |
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index d19d0120e5b8..6678127ed4f2 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
@@ -125,6 +125,32 @@ void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter) | ||
129 | { | ||
130 | struct qlcnic_recv_context *recv_ctx; | ||
131 | struct qlcnic_host_rds_ring *rds_ring; | ||
132 | struct qlcnic_rx_buffer *rx_buf; | ||
133 | int i, ring; | ||
134 | |||
135 | recv_ctx = &adapter->recv_ctx; | ||
136 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | ||
137 | rds_ring = &recv_ctx->rds_rings[ring]; | ||
138 | |||
139 | spin_lock(&rds_ring->lock); | ||
140 | |||
141 | INIT_LIST_HEAD(&rds_ring->free_list); | ||
142 | |||
143 | rx_buf = rds_ring->rx_buf_arr; | ||
144 | for (i = 0; i < rds_ring->num_desc; i++) { | ||
145 | list_add_tail(&rx_buf->list, | ||
146 | &rds_ring->free_list); | ||
147 | rx_buf++; | ||
148 | } | ||
149 | |||
150 | spin_unlock(&rds_ring->lock); | ||
151 | } | ||
152 | } | ||
153 | |||
128 | void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter) | 154 | void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter) |
129 | { | 155 | { |
130 | struct qlcnic_cmd_buffer *cmd_buf; | 156 | struct qlcnic_cmd_buffer *cmd_buf; |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 9658b1849386..38d8fe08b7ff 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -346,7 +346,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) | |||
346 | if (!is_valid_ether_addr(addr->sa_data)) | 346 | if (!is_valid_ether_addr(addr->sa_data)) |
347 | return -EINVAL; | 347 | return -EINVAL; |
348 | 348 | ||
349 | if (netif_running(netdev)) { | 349 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
350 | netif_device_detach(netdev); | 350 | netif_device_detach(netdev); |
351 | qlcnic_napi_disable(adapter); | 351 | qlcnic_napi_disable(adapter); |
352 | } | 352 | } |
@@ -355,7 +355,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) | |||
355 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 355 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
356 | qlcnic_set_multi(adapter->netdev); | 356 | qlcnic_set_multi(adapter->netdev); |
357 | 357 | ||
358 | if (netif_running(netdev)) { | 358 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
359 | netif_device_attach(netdev); | 359 | netif_device_attach(netdev); |
360 | qlcnic_napi_enable(adapter); | 360 | qlcnic_napi_enable(adapter); |
361 | } | 361 | } |
@@ -877,9 +877,23 @@ qlcnic_init_coalesce_defaults(struct qlcnic_adapter *adapter) | |||
877 | static int | 877 | static int |
878 | __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | 878 | __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) |
879 | { | 879 | { |
880 | int ring; | ||
881 | struct qlcnic_host_rds_ring *rds_ring; | ||
882 | |||
880 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 883 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
881 | return -EIO; | 884 | return -EIO; |
882 | 885 | ||
886 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) | ||
887 | return 0; | ||
888 | |||
889 | if (qlcnic_fw_create_ctx(adapter)) | ||
890 | return -EIO; | ||
891 | |||
892 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | ||
893 | rds_ring = &adapter->recv_ctx.rds_rings[ring]; | ||
894 | qlcnic_post_rx_buffers(adapter, ring, rds_ring); | ||
895 | } | ||
896 | |||
883 | qlcnic_set_multi(netdev); | 897 | qlcnic_set_multi(netdev); |
884 | qlcnic_fw_cmd_set_mtu(adapter, netdev->mtu); | 898 | qlcnic_fw_cmd_set_mtu(adapter, netdev->mtu); |
885 | 899 | ||
@@ -936,6 +950,9 @@ __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
936 | 950 | ||
937 | qlcnic_napi_disable(adapter); | 951 | qlcnic_napi_disable(adapter); |
938 | 952 | ||
953 | qlcnic_fw_destroy_ctx(adapter); | ||
954 | |||
955 | qlcnic_reset_rx_buffers_list(adapter); | ||
939 | qlcnic_release_tx_buffers(adapter); | 956 | qlcnic_release_tx_buffers(adapter); |
940 | spin_unlock(&adapter->tx_clean_lock); | 957 | spin_unlock(&adapter->tx_clean_lock); |
941 | } | 958 | } |
@@ -957,13 +974,11 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
957 | { | 974 | { |
958 | struct net_device *netdev = adapter->netdev; | 975 | struct net_device *netdev = adapter->netdev; |
959 | struct pci_dev *pdev = adapter->pdev; | 976 | struct pci_dev *pdev = adapter->pdev; |
960 | int err, ring; | 977 | int err; |
961 | struct qlcnic_host_rds_ring *rds_ring; | ||
962 | 978 | ||
963 | if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) | 979 | if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) |
964 | return 0; | 980 | return 0; |
965 | 981 | ||
966 | |||
967 | err = qlcnic_napi_add(adapter, netdev); | 982 | err = qlcnic_napi_add(adapter, netdev); |
968 | if (err) | 983 | if (err) |
969 | return err; | 984 | return err; |
@@ -971,7 +986,7 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
971 | err = qlcnic_alloc_sw_resources(adapter); | 986 | err = qlcnic_alloc_sw_resources(adapter); |
972 | if (err) { | 987 | if (err) { |
973 | dev_err(&pdev->dev, "Error in setting sw resources\n"); | 988 | dev_err(&pdev->dev, "Error in setting sw resources\n"); |
974 | return err; | 989 | goto err_out_napi_del; |
975 | } | 990 | } |
976 | 991 | ||
977 | err = qlcnic_alloc_hw_resources(adapter); | 992 | err = qlcnic_alloc_hw_resources(adapter); |
@@ -980,16 +995,10 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
980 | goto err_out_free_sw; | 995 | goto err_out_free_sw; |
981 | } | 996 | } |
982 | 997 | ||
983 | |||
984 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | ||
985 | rds_ring = &adapter->recv_ctx.rds_rings[ring]; | ||
986 | qlcnic_post_rx_buffers(adapter, ring, rds_ring); | ||
987 | } | ||
988 | |||
989 | err = qlcnic_request_irq(adapter); | 998 | err = qlcnic_request_irq(adapter); |
990 | if (err) { | 999 | if (err) { |
991 | dev_err(&pdev->dev, "failed to setup interrupt\n"); | 1000 | dev_err(&pdev->dev, "failed to setup interrupt\n"); |
992 | goto err_out_free_rxbuf; | 1001 | goto err_out_free_hw; |
993 | } | 1002 | } |
994 | 1003 | ||
995 | qlcnic_init_coalesce_defaults(adapter); | 1004 | qlcnic_init_coalesce_defaults(adapter); |
@@ -999,11 +1008,12 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
999 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; | 1008 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; |
1000 | return 0; | 1009 | return 0; |
1001 | 1010 | ||
1002 | err_out_free_rxbuf: | 1011 | err_out_free_hw: |
1003 | qlcnic_release_rx_buffers(adapter); | ||
1004 | qlcnic_free_hw_resources(adapter); | 1012 | qlcnic_free_hw_resources(adapter); |
1005 | err_out_free_sw: | 1013 | err_out_free_sw: |
1006 | qlcnic_free_sw_resources(adapter); | 1014 | qlcnic_free_sw_resources(adapter); |
1015 | err_out_napi_del: | ||
1016 | qlcnic_napi_del(adapter); | ||
1007 | return err; | 1017 | return err; |
1008 | } | 1018 | } |
1009 | 1019 | ||
@@ -1038,6 +1048,8 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings) | |||
1038 | } | 1048 | } |
1039 | } | 1049 | } |
1040 | 1050 | ||
1051 | qlcnic_fw_destroy_ctx(adapter); | ||
1052 | |||
1041 | qlcnic_detach(adapter); | 1053 | qlcnic_detach(adapter); |
1042 | 1054 | ||
1043 | adapter->diag_test = 0; | 1055 | adapter->diag_test = 0; |
@@ -1056,6 +1068,7 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | |||
1056 | { | 1068 | { |
1057 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1069 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1058 | struct qlcnic_host_sds_ring *sds_ring; | 1070 | struct qlcnic_host_sds_ring *sds_ring; |
1071 | struct qlcnic_host_rds_ring *rds_ring; | ||
1059 | int ring; | 1072 | int ring; |
1060 | int ret; | 1073 | int ret; |
1061 | 1074 | ||
@@ -1075,6 +1088,17 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | |||
1075 | return ret; | 1088 | return ret; |
1076 | } | 1089 | } |
1077 | 1090 | ||
1091 | ret = qlcnic_fw_create_ctx(adapter); | ||
1092 | if (ret) { | ||
1093 | qlcnic_detach(adapter); | ||
1094 | return ret; | ||
1095 | } | ||
1096 | |||
1097 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | ||
1098 | rds_ring = &adapter->recv_ctx.rds_rings[ring]; | ||
1099 | qlcnic_post_rx_buffers(adapter, ring, rds_ring); | ||
1100 | } | ||
1101 | |||
1078 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { | 1102 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { |
1079 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1103 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
1080 | sds_ring = &adapter->recv_ctx.sds_rings[ring]; | 1104 | sds_ring = &adapter->recv_ctx.sds_rings[ring]; |
@@ -2636,7 +2660,7 @@ qlcnic_store_bridged_mode(struct device *dev, | |||
2636 | if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG)) | 2660 | if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG)) |
2637 | goto err_out; | 2661 | goto err_out; |
2638 | 2662 | ||
2639 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 2663 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) |
2640 | goto err_out; | 2664 | goto err_out; |
2641 | 2665 | ||
2642 | if (strict_strtoul(buf, 2, &new)) | 2666 | if (strict_strtoul(buf, 2, &new)) |
@@ -2944,7 +2968,7 @@ recheck: | |||
2944 | if (!adapter) | 2968 | if (!adapter) |
2945 | goto done; | 2969 | goto done; |
2946 | 2970 | ||
2947 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 2971 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) |
2948 | goto done; | 2972 | goto done; |
2949 | 2973 | ||
2950 | qlcnic_config_indev_addr(dev, event); | 2974 | qlcnic_config_indev_addr(dev, event); |
@@ -2980,7 +3004,7 @@ recheck: | |||
2980 | if (!adapter) | 3004 | if (!adapter) |
2981 | goto done; | 3005 | goto done; |
2982 | 3006 | ||
2983 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 3007 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) |
2984 | goto done; | 3008 | goto done; |
2985 | 3009 | ||
2986 | switch (event) { | 3010 | switch (event) { |