aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdrivers/net/qla3xxx.c78
1 files changed, 24 insertions, 54 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 7d68d1f2df69..bdf1a400430a 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1746,6 +1746,23 @@ static void ql_process_mac_tx_intr(struct ql3_adapter *qdev,
1746 atomic_inc(&qdev->tx_count); 1746 atomic_inc(&qdev->tx_count);
1747} 1747}
1748 1748
1749void ql_get_sbuf(struct ql3_adapter *qdev)
1750{
1751 if (++qdev->small_buf_index == NUM_SMALL_BUFFERS)
1752 qdev->small_buf_index = 0;
1753 qdev->small_buf_release_cnt++;
1754}
1755
1756struct ql_rcv_buf_cb *ql_get_lbuf(struct ql3_adapter *qdev)
1757{
1758 struct ql_rcv_buf_cb *lrg_buf_cb = NULL;
1759 lrg_buf_cb = &qdev->lrg_buf[qdev->lrg_buf_index];
1760 qdev->lrg_buf_release_cnt++;
1761 if (++qdev->lrg_buf_index == qdev->num_large_buffers)
1762 qdev->lrg_buf_index = 0;
1763 return(lrg_buf_cb);
1764}
1765
1749/* 1766/*
1750 * The difference between 3022 and 3032 for inbound completions: 1767 * The difference between 3022 and 3032 for inbound completions:
1751 * 3022 uses two buffers per completion. The first buffer contains 1768 * 3022 uses two buffers per completion. The first buffer contains
@@ -1761,47 +1778,21 @@ static void ql_process_mac_tx_intr(struct ql3_adapter *qdev,
1761static void ql_process_mac_rx_intr(struct ql3_adapter *qdev, 1778static void ql_process_mac_rx_intr(struct ql3_adapter *qdev,
1762 struct ib_mac_iocb_rsp *ib_mac_rsp_ptr) 1779 struct ib_mac_iocb_rsp *ib_mac_rsp_ptr)
1763{ 1780{
1764 long int offset;
1765 u32 lrg_buf_phy_addr_low = 0;
1766 struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL; 1781 struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL;
1767 struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL; 1782 struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL;
1768 u32 *curr_ial_ptr;
1769 struct sk_buff *skb; 1783 struct sk_buff *skb;
1770 u16 length = le16_to_cpu(ib_mac_rsp_ptr->length); 1784 u16 length = le16_to_cpu(ib_mac_rsp_ptr->length);
1771 1785
1772 /* 1786 /*
1773 * Get the inbound address list (small buffer). 1787 * Get the inbound address list (small buffer).
1774 */ 1788 */
1775 offset = qdev->small_buf_index * QL_SMALL_BUFFER_SIZE; 1789 ql_get_sbuf(qdev);
1776 if (++qdev->small_buf_index == NUM_SMALL_BUFFERS)
1777 qdev->small_buf_index = 0;
1778
1779 curr_ial_ptr = (u32 *) (qdev->small_buf_virt_addr + offset);
1780 qdev->last_rsp_offset = qdev->small_buf_phy_addr_low + offset;
1781 qdev->small_buf_release_cnt++;
1782 1790
1783 if (qdev->device_id == QL3022_DEVICE_ID) { 1791 if (qdev->device_id == QL3022_DEVICE_ID)
1784 /* start of first buffer (3022 only) */ 1792 lrg_buf_cb1 = ql_get_lbuf(qdev);
1785 lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr);
1786 lrg_buf_cb1 = &qdev->lrg_buf[qdev->lrg_buf_index];
1787 qdev->lrg_buf_release_cnt++;
1788 if (++qdev->lrg_buf_index == qdev->num_large_buffers) {
1789 qdev->lrg_buf_index = 0;
1790 }
1791 curr_ial_ptr++; /* 64-bit pointers require two incs. */
1792 curr_ial_ptr++;
1793 }
1794 1793
1795 /* start of second buffer */ 1794 /* start of second buffer */
1796 lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); 1795 lrg_buf_cb2 = ql_get_lbuf(qdev);
1797 lrg_buf_cb2 = &qdev->lrg_buf[qdev->lrg_buf_index];
1798
1799 /*
1800 * Second buffer gets sent up the stack.
1801 */
1802 qdev->lrg_buf_release_cnt++;
1803 if (++qdev->lrg_buf_index == qdev->num_large_buffers)
1804 qdev->lrg_buf_index = 0;
1805 skb = lrg_buf_cb2->skb; 1796 skb = lrg_buf_cb2->skb;
1806 1797
1807 qdev->stats.rx_packets++; 1798 qdev->stats.rx_packets++;
@@ -1829,11 +1820,8 @@ static void ql_process_mac_rx_intr(struct ql3_adapter *qdev,
1829static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, 1820static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1830 struct ib_ip_iocb_rsp *ib_ip_rsp_ptr) 1821 struct ib_ip_iocb_rsp *ib_ip_rsp_ptr)
1831{ 1822{
1832 long int offset;
1833 u32 lrg_buf_phy_addr_low = 0;
1834 struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL; 1823 struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL;
1835 struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL; 1824 struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL;
1836 u32 *curr_ial_ptr;
1837 struct sk_buff *skb1 = NULL, *skb2; 1825 struct sk_buff *skb1 = NULL, *skb2;
1838 struct net_device *ndev = qdev->ndev; 1826 struct net_device *ndev = qdev->ndev;
1839 u16 length = le16_to_cpu(ib_ip_rsp_ptr->length); 1827 u16 length = le16_to_cpu(ib_ip_rsp_ptr->length);
@@ -1843,35 +1831,20 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1843 * Get the inbound address list (small buffer). 1831 * Get the inbound address list (small buffer).
1844 */ 1832 */
1845 1833
1846 offset = qdev->small_buf_index * QL_SMALL_BUFFER_SIZE; 1834 ql_get_sbuf(qdev);
1847 if (++qdev->small_buf_index == NUM_SMALL_BUFFERS)
1848 qdev->small_buf_index = 0;
1849 curr_ial_ptr = (u32 *) (qdev->small_buf_virt_addr + offset);
1850 qdev->last_rsp_offset = qdev->small_buf_phy_addr_low + offset;
1851 qdev->small_buf_release_cnt++;
1852 1835
1853 if (qdev->device_id == QL3022_DEVICE_ID) { 1836 if (qdev->device_id == QL3022_DEVICE_ID) {
1854 /* start of first buffer on 3022 */ 1837 /* start of first buffer on 3022 */
1855 lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); 1838 lrg_buf_cb1 = ql_get_lbuf(qdev);
1856 lrg_buf_cb1 = &qdev->lrg_buf[qdev->lrg_buf_index];
1857 qdev->lrg_buf_release_cnt++;
1858 if (++qdev->lrg_buf_index == qdev->num_large_buffers)
1859 qdev->lrg_buf_index = 0;
1860 skb1 = lrg_buf_cb1->skb; 1839 skb1 = lrg_buf_cb1->skb;
1861 curr_ial_ptr++; /* 64-bit pointers require two incs. */
1862 curr_ial_ptr++;
1863 size = ETH_HLEN; 1840 size = ETH_HLEN;
1864 if (*((u16 *) skb1->data) != 0xFFFF) 1841 if (*((u16 *) skb1->data) != 0xFFFF)
1865 size += VLAN_ETH_HLEN - ETH_HLEN; 1842 size += VLAN_ETH_HLEN - ETH_HLEN;
1866 } 1843 }
1867 1844
1868 /* start of second buffer */ 1845 /* start of second buffer */
1869 lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); 1846 lrg_buf_cb2 = ql_get_lbuf(qdev);
1870 lrg_buf_cb2 = &qdev->lrg_buf[qdev->lrg_buf_index];
1871 skb2 = lrg_buf_cb2->skb; 1847 skb2 = lrg_buf_cb2->skb;
1872 qdev->lrg_buf_release_cnt++;
1873 if (++qdev->lrg_buf_index == qdev->num_large_buffers)
1874 qdev->lrg_buf_index = 0;
1875 1848
1876 skb_put(skb2, length); /* Just the second buffer length here. */ 1849 skb_put(skb2, length); /* Just the second buffer length here. */
1877 pci_unmap_single(qdev->pdev, 1850 pci_unmap_single(qdev->pdev,
@@ -2410,7 +2383,6 @@ static void ql_free_buffer_queues(struct ql3_adapter *qdev)
2410 return; 2383 return;
2411 } 2384 }
2412 if(qdev->lrg_buf) kfree(qdev->lrg_buf); 2385 if(qdev->lrg_buf) kfree(qdev->lrg_buf);
2413
2414 pci_free_consistent(qdev->pdev, 2386 pci_free_consistent(qdev->pdev,
2415 qdev->lrg_buf_q_alloc_size, 2387 qdev->lrg_buf_q_alloc_size,
2416 qdev->lrg_buf_q_alloc_virt_addr, 2388 qdev->lrg_buf_q_alloc_virt_addr,
@@ -2455,8 +2427,6 @@ static int ql_alloc_small_buffers(struct ql3_adapter *qdev)
2455 2427
2456 small_buf_q_entry = qdev->small_buf_q_virt_addr; 2428 small_buf_q_entry = qdev->small_buf_q_virt_addr;
2457 2429
2458 qdev->last_rsp_offset = qdev->small_buf_phy_addr_low;
2459
2460 /* Initialize the small buffer queue. */ 2430 /* Initialize the small buffer queue. */
2461 for (i = 0; i < (QL_ADDR_ELE_PER_BUFQ_ENTRY * NUM_SBUFQ_ENTRIES); i++) { 2431 for (i = 0; i < (QL_ADDR_ELE_PER_BUFQ_ENTRY * NUM_SBUFQ_ENTRIES); i++) {
2462 small_buf_q_entry->addr_high = 2432 small_buf_q_entry->addr_high =