diff options
author | Malli Chilakala <mallikarjuna.chilakala@intel.com> | 2005-04-28 22:04:54 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-05-12 20:54:42 -0400 |
commit | f404de1cd407c1f56fa478810c6c48e015d377bd (patch) | |
tree | e7a40872bc886c7b1b784624402663eb1239f527 /drivers/net/ixgb | |
parent | c2eba932b14718e34ac2609e35c6d41e032a2478 (diff) |
[PATCH] ixgb: Code optimization
Code optimization
Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Signed-off-by: Ganesh Venkatesan <ganesh.venkatesan@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
diff -up net-drivers-2.6/drivers/net/ixgb/ixgb_main.c net-drivers-2.6/drivers/net/ixgb.new/ixgb_main.c
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 0a0f0417f85d..db1089c67ebc 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1822,7 +1822,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1822 | struct pci_dev *pdev = adapter->pdev; | 1822 | struct pci_dev *pdev = adapter->pdev; |
1823 | struct ixgb_rx_desc *rx_desc, *next_rxd; | 1823 | struct ixgb_rx_desc *rx_desc, *next_rxd; |
1824 | struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer; | 1824 | struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer; |
1825 | struct sk_buff *skb, *next_skb; | ||
1826 | uint32_t length; | 1825 | uint32_t length; |
1827 | unsigned int i, j; | 1826 | unsigned int i, j; |
1828 | boolean_t cleaned = FALSE; | 1827 | boolean_t cleaned = FALSE; |
@@ -1832,6 +1831,8 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1832 | buffer_info = &rx_ring->buffer_info[i]; | 1831 | buffer_info = &rx_ring->buffer_info[i]; |
1833 | 1832 | ||
1834 | while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) { | 1833 | while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) { |
1834 | struct sk_buff *skb, *next_skb; | ||
1835 | u8 status; | ||
1835 | 1836 | ||
1836 | #ifdef CONFIG_IXGB_NAPI | 1837 | #ifdef CONFIG_IXGB_NAPI |
1837 | if(*work_done >= work_to_do) | 1838 | if(*work_done >= work_to_do) |
@@ -1839,7 +1840,9 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1839 | 1840 | ||
1840 | (*work_done)++; | 1841 | (*work_done)++; |
1841 | #endif | 1842 | #endif |
1843 | status = rx_desc->status; | ||
1842 | skb = buffer_info->skb; | 1844 | skb = buffer_info->skb; |
1845 | |||
1843 | prefetch(skb->data); | 1846 | prefetch(skb->data); |
1844 | 1847 | ||
1845 | if(++i == rx_ring->count) i = 0; | 1848 | if(++i == rx_ring->count) i = 0; |
@@ -1864,7 +1867,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1864 | 1867 | ||
1865 | length = le16_to_cpu(rx_desc->length); | 1868 | length = le16_to_cpu(rx_desc->length); |
1866 | 1869 | ||
1867 | if(unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) { | 1870 | if(unlikely(!(status & IXGB_RX_DESC_STATUS_EOP))) { |
1868 | 1871 | ||
1869 | /* All receives must fit into a single buffer */ | 1872 | /* All receives must fit into a single buffer */ |
1870 | 1873 | ||
@@ -1872,12 +1875,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1872 | "length<%x>\n", length); | 1875 | "length<%x>\n", length); |
1873 | 1876 | ||
1874 | dev_kfree_skb_irq(skb); | 1877 | dev_kfree_skb_irq(skb); |
1875 | rx_desc->status = 0; | 1878 | goto rxdesc_done; |
1876 | buffer_info->skb = NULL; | ||
1877 | |||
1878 | rx_desc = next_rxd; | ||
1879 | buffer_info = next_buffer; | ||
1880 | continue; | ||
1881 | } | 1879 | } |
1882 | 1880 | ||
1883 | if (unlikely(rx_desc->errors | 1881 | if (unlikely(rx_desc->errors |
@@ -1886,12 +1884,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1886 | IXGB_RX_DESC_ERRORS_RXE))) { | 1884 | IXGB_RX_DESC_ERRORS_RXE))) { |
1887 | 1885 | ||
1888 | dev_kfree_skb_irq(skb); | 1886 | dev_kfree_skb_irq(skb); |
1889 | rx_desc->status = 0; | 1887 | goto rxdesc_done; |
1890 | buffer_info->skb = NULL; | ||
1891 | |||
1892 | rx_desc = next_rxd; | ||
1893 | buffer_info = next_buffer; | ||
1894 | continue; | ||
1895 | } | 1888 | } |
1896 | 1889 | ||
1897 | /* Good Receive */ | 1890 | /* Good Receive */ |
@@ -1902,7 +1895,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1902 | 1895 | ||
1903 | skb->protocol = eth_type_trans(skb, netdev); | 1896 | skb->protocol = eth_type_trans(skb, netdev); |
1904 | #ifdef CONFIG_IXGB_NAPI | 1897 | #ifdef CONFIG_IXGB_NAPI |
1905 | if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { | 1898 | if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { |
1906 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, | 1899 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
1907 | le16_to_cpu(rx_desc->special) & | 1900 | le16_to_cpu(rx_desc->special) & |
1908 | IXGB_RX_DESC_SPECIAL_VLAN_MASK); | 1901 | IXGB_RX_DESC_SPECIAL_VLAN_MASK); |
@@ -1910,7 +1903,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1910 | netif_receive_skb(skb); | 1903 | netif_receive_skb(skb); |
1911 | } | 1904 | } |
1912 | #else /* CONFIG_IXGB_NAPI */ | 1905 | #else /* CONFIG_IXGB_NAPI */ |
1913 | if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { | 1906 | if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { |
1914 | vlan_hwaccel_rx(skb, adapter->vlgrp, | 1907 | vlan_hwaccel_rx(skb, adapter->vlgrp, |
1915 | le16_to_cpu(rx_desc->special) & | 1908 | le16_to_cpu(rx_desc->special) & |
1916 | IXGB_RX_DESC_SPECIAL_VLAN_MASK); | 1909 | IXGB_RX_DESC_SPECIAL_VLAN_MASK); |
@@ -1920,9 +1913,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1920 | #endif /* CONFIG_IXGB_NAPI */ | 1913 | #endif /* CONFIG_IXGB_NAPI */ |
1921 | netdev->last_rx = jiffies; | 1914 | netdev->last_rx = jiffies; |
1922 | 1915 | ||
1916 | rxdesc_done: | ||
1917 | /* clean up descriptor, might be written over by hw */ | ||
1923 | rx_desc->status = 0; | 1918 | rx_desc->status = 0; |
1924 | buffer_info->skb = NULL; | 1919 | buffer_info->skb = NULL; |
1925 | 1920 | ||
1921 | /* use prefetched values */ | ||
1926 | rx_desc = next_rxd; | 1922 | rx_desc = next_rxd; |
1927 | buffer_info = next_buffer; | 1923 | buffer_info = next_buffer; |
1928 | } | 1924 | } |