]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
qlcnic: Enable diagnostic test for multiple Tx queues.
[karo-tx-linux.git] / drivers / net / ethernet / qlogic / qlcnic / qlcnic_init.c
index d28336fc65abe5752f4a295ae54708edf9d3b0ae..66c26cf7a2b89290524a2d85005ee847f43e925b 100644 (file)
@@ -127,12 +127,12 @@ void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter)
        }
 }
 
-void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter)
+void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter,
+                              struct qlcnic_host_tx_ring *tx_ring)
 {
        struct qlcnic_cmd_buffer *cmd_buf;
        struct qlcnic_skb_frag *buffrag;
        int i, j;
-       struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring;
 
        cmd_buf = tx_ring->cmd_buf_arr;
        for (i = 0; i < tx_ring->num_desc; i++) {
@@ -142,7 +142,7 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter)
                                         buffrag->length, PCI_DMA_TODEVICE);
                        buffrag->dma = 0ULL;
                }
-               for (j = 0; j < cmd_buf->frag_count; j++) {
+               for (j = 1; j < cmd_buf->frag_count; j++) {
                        buffrag++;
                        if (buffrag->dma) {
                                pci_unmap_page(adapter->pdev, buffrag->dma,
@@ -241,7 +241,13 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
                sds_ring->irq = adapter->msix_entries[ring].vector;
                sds_ring->adapter = adapter;
                sds_ring->num_desc = adapter->num_rxd;
-
+               if (qlcnic_82xx_check(adapter)) {
+                       if (qlcnic_check_multi_tx(adapter) &&
+                           !adapter->ahw->diag_test)
+                               sds_ring->tx_ring = &adapter->tx_ring[ring];
+                       else
+                               sds_ring->tx_ring = &adapter->tx_ring[0];
+               }
                for (i = 0; i < NUM_RCV_DESC_RINGS; i++)
                        INIT_LIST_HEAD(&sds_ring->free_list[i]);
        }
@@ -286,10 +292,11 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter)
 {
        long timeout = 0;
        long done = 0;
+       int err = 0;
 
        cond_resched();
        while (done == 0) {
-               done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS);
+               done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS, &err);
                done &= 2;
                if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) {
                        dev_err(&adapter->pdev->dev,
@@ -304,6 +311,8 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter)
 static int do_rom_fast_read(struct qlcnic_adapter *adapter,
                            u32 addr, u32 *valp)
 {
+       int err = 0;
+
        QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr);
        QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
        QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3);
@@ -317,7 +326,9 @@ static int do_rom_fast_read(struct qlcnic_adapter *adapter,
        udelay(10);
        QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
 
-       *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA);
+       *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA, &err);
+       if (err == -EIO)
+               return err;
        return 0;
 }
 
@@ -369,11 +380,11 @@ int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp)
 
 int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
 {
-       int addr, val;
+       int addr, err = 0;
        int i, n, init_delay;
        struct crb_addr_pair *buf;
        unsigned offset;
-       u32 off;
+       u32 off, val;
        struct pci_dev *pdev = adapter->pdev;
 
        QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0);
@@ -402,7 +413,9 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
        QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00);
 
        /* halt sre */
-       val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000);
+       val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000, &err);
+       if (err == -EIO)
+               return err;
        QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1)));
 
        /* halt epg */
@@ -719,10 +732,12 @@ qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter)
 static int
 qlcnic_has_mn(struct qlcnic_adapter *adapter)
 {
-       u32 capability;
-       capability = 0;
+       u32 capability = 0;
+       int err = 0;
 
-       capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY);
+       capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY, &err);
+       if (err == -EIO)
+               return err;
        if (capability & QLCNIC_PEG_TUNE_MN_PRESENT)
                return 1;