aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_init.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 9d2c124048fa..1b621ca13e25 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -530,6 +530,22 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
530 return 0; 530 return 0;
531} 531}
532 532
533void
534qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
535
536 int timeo;
537
538 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
539 timeo = 30;
540
541 adapter->dev_init_timeo = timeo;
542
543 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DRV_RESET_TIMEOUT, &timeo))
544 timeo = 10;
545
546 adapter->reset_ack_timeo = timeo;
547}
548
533static int 549static int
534qlcnic_has_mn(struct qlcnic_adapter *adapter) 550qlcnic_has_mn(struct qlcnic_adapter *adapter)
535{ 551{
@@ -612,7 +628,7 @@ qlcnic_validate_bootld(struct qlcnic_adapter *adapter)
612 return -EINVAL; 628 return -EINVAL;
613 629
614 tab_size = cpu_to_le32(tab_desc->findex) + 630 tab_size = cpu_to_le32(tab_desc->findex) +
615 (cpu_to_le32(tab_desc->entry_size * (idx + 1))); 631 (cpu_to_le32(tab_desc->entry_size) * (idx + 1));
616 632
617 if (adapter->fw->size < tab_size) 633 if (adapter->fw->size < tab_size)
618 return -EINVAL; 634 return -EINVAL;
@@ -621,7 +637,7 @@ qlcnic_validate_bootld(struct qlcnic_adapter *adapter)
621 (cpu_to_le32(tab_desc->entry_size) * (idx)); 637 (cpu_to_le32(tab_desc->entry_size) * (idx));
622 descr = (struct uni_data_desc *)&unirom[offs]; 638 descr = (struct uni_data_desc *)&unirom[offs];
623 639
624 data_size = descr->findex + cpu_to_le32(descr->size); 640 data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size);
625 641
626 if (adapter->fw->size < data_size) 642 if (adapter->fw->size < data_size)
627 return -EINVAL; 643 return -EINVAL;
@@ -647,7 +663,7 @@ qlcnic_validate_fw(struct qlcnic_adapter *adapter)
647 return -EINVAL; 663 return -EINVAL;
648 664
649 tab_size = cpu_to_le32(tab_desc->findex) + 665 tab_size = cpu_to_le32(tab_desc->findex) +
650 (cpu_to_le32(tab_desc->entry_size * (idx + 1))); 666 (cpu_to_le32(tab_desc->entry_size) * (idx + 1));
651 667
652 if (adapter->fw->size < tab_size) 668 if (adapter->fw->size < tab_size)
653 return -EINVAL; 669 return -EINVAL;
@@ -655,7 +671,7 @@ qlcnic_validate_fw(struct qlcnic_adapter *adapter)
655 offs = cpu_to_le32(tab_desc->findex) + 671 offs = cpu_to_le32(tab_desc->findex) +
656 (cpu_to_le32(tab_desc->entry_size) * (idx)); 672 (cpu_to_le32(tab_desc->entry_size) * (idx));
657 descr = (struct uni_data_desc *)&unirom[offs]; 673 descr = (struct uni_data_desc *)&unirom[offs];
658 data_size = descr->findex + cpu_to_le32(descr->size); 674 data_size = cpu_to_le32(descr->findex) + cpu_to_le32(descr->size);
659 675
660 if (adapter->fw->size < data_size) 676 if (adapter->fw->size < data_size)
661 return -EINVAL; 677 return -EINVAL;
@@ -950,6 +966,16 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter)
950 966
951 flashaddr += 8; 967 flashaddr += 8;
952 } 968 }
969
970 size = (__force u32)qlcnic_get_fw_size(adapter) % 8;
971 if (size) {
972 data = cpu_to_le64(ptr64[i]);
973
974 if (qlcnic_pci_mem_write_2M(adapter,
975 flashaddr, data))
976 return -EIO;
977 }
978
953 } else { 979 } else {
954 u64 data; 980 u64 data;
955 u32 hi, lo; 981 u32 hi, lo;
@@ -1261,6 +1287,7 @@ qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
1261 rds_ring->dma_size, PCI_DMA_FROMDEVICE); 1287 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
1262 1288
1263 if (pci_dma_mapping_error(pdev, dma)) { 1289 if (pci_dma_mapping_error(pdev, dma)) {
1290 adapter->stats.rx_dma_map_error++;
1264 dev_kfree_skb_any(skb); 1291 dev_kfree_skb_any(skb);
1265 buffer->skb = NULL; 1292 buffer->skb = NULL;
1266 return -ENOMEM; 1293 return -ENOMEM;
@@ -1285,8 +1312,10 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter,
1285 PCI_DMA_FROMDEVICE); 1312 PCI_DMA_FROMDEVICE);
1286 1313
1287 skb = buffer->skb; 1314 skb = buffer->skb;
1288 if (!skb) 1315 if (!skb) {
1316 adapter->stats.null_skb++;
1289 goto no_skb; 1317 goto no_skb;
1318 }
1290 1319
1291 if (likely(adapter->rx_csum && cksum == STATUS_CKSUM_OK)) { 1320 if (likely(adapter->rx_csum && cksum == STATUS_CKSUM_OK)) {
1292 adapter->stats.csummed++; 1321 adapter->stats.csummed++;
@@ -1476,6 +1505,8 @@ qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max)
1476 1505
1477 if (rxbuf) 1506 if (rxbuf)
1478 list_add_tail(&rxbuf->list, &sds_ring->free_list[ring]); 1507 list_add_tail(&rxbuf->list, &sds_ring->free_list[ring]);
1508 else
1509 adapter->stats.null_rxbuf++;
1479 1510
1480skip: 1511skip:
1481 for (; desc_cnt > 0; desc_cnt--) { 1512 for (; desc_cnt > 0; desc_cnt--) {
@@ -1523,9 +1554,10 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid,
1523 int producer, count = 0; 1554 int producer, count = 0;
1524 struct list_head *head; 1555 struct list_head *head;
1525 1556
1557 spin_lock(&rds_ring->lock);
1558
1526 producer = rds_ring->producer; 1559 producer = rds_ring->producer;
1527 1560
1528 spin_lock(&rds_ring->lock);
1529 head = &rds_ring->free_list; 1561 head = &rds_ring->free_list;
1530 while (!list_empty(head)) { 1562 while (!list_empty(head)) {
1531 1563
@@ -1547,13 +1579,13 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid,
1547 1579
1548 producer = get_next_index(producer, rds_ring->num_desc); 1580 producer = get_next_index(producer, rds_ring->num_desc);
1549 } 1581 }
1550 spin_unlock(&rds_ring->lock);
1551 1582
1552 if (count) { 1583 if (count) {
1553 rds_ring->producer = producer; 1584 rds_ring->producer = producer;
1554 writel((producer-1) & (rds_ring->num_desc-1), 1585 writel((producer-1) & (rds_ring->num_desc-1),
1555 rds_ring->crb_rcv_producer); 1586 rds_ring->crb_rcv_producer);
1556 } 1587 }
1588 spin_unlock(&rds_ring->lock);
1557} 1589}
1558 1590
1559static void 1591static void
@@ -1565,10 +1597,11 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter,
1565 int producer, count = 0; 1597 int producer, count = 0;
1566 struct list_head *head; 1598 struct list_head *head;
1567 1599
1568 producer = rds_ring->producer;
1569 if (!spin_trylock(&rds_ring->lock)) 1600 if (!spin_trylock(&rds_ring->lock))
1570 return; 1601 return;
1571 1602
1603 producer = rds_ring->producer;
1604
1572 head = &rds_ring->free_list; 1605 head = &rds_ring->free_list;
1573 while (!list_empty(head)) { 1606 while (!list_empty(head)) {
1574 1607