aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atlx
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/atlx
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/atlx')
-rw-r--r--drivers/net/atlx/atl1.c25
-rw-r--r--drivers/net/atlx/atl2.c17
-rw-r--r--drivers/net/atlx/atl2.h2
-rw-r--r--drivers/net/atlx/atlx.c2
4 files changed, 21 insertions, 25 deletions
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 00569dc1313c..0ebd8208f606 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -84,7 +84,7 @@
84 84
85#define ATLX_DRIVER_VERSION "2.1.3" 85#define ATLX_DRIVER_VERSION "2.1.3"
86MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \ 86MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \
87 Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>"); 87Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>");
88MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
89MODULE_VERSION(ATLX_DRIVER_VERSION); 89MODULE_VERSION(ATLX_DRIVER_VERSION);
90 90
@@ -232,7 +232,7 @@ static void __devinit atl1_check_options(struct atl1_adapter *adapter)
232/* 232/*
233 * atl1_pci_tbl - PCI Device ID Table 233 * atl1_pci_tbl - PCI Device ID Table
234 */ 234 */
235static const struct pci_device_id atl1_pci_tbl[] = { 235static DEFINE_PCI_DEVICE_TABLE(atl1_pci_tbl) = {
236 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1)}, 236 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1)},
237 /* required last entry */ 237 /* required last entry */
238 {0,} 238 {0,}
@@ -1344,8 +1344,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
1344 1344
1345 /* link result is our setting */ 1345 /* link result is our setting */
1346 if (!reconfig) { 1346 if (!reconfig) {
1347 if (adapter->link_speed != speed 1347 if (adapter->link_speed != speed ||
1348 || adapter->link_duplex != duplex) { 1348 adapter->link_duplex != duplex) {
1349 adapter->link_speed = speed; 1349 adapter->link_speed = speed;
1350 adapter->link_duplex = duplex; 1350 adapter->link_duplex = duplex;
1351 atl1_setup_mac_ctrl(adapter); 1351 atl1_setup_mac_ctrl(adapter);
@@ -1864,21 +1864,14 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
1864 1864
1865 rfd_desc = ATL1_RFD_DESC(rfd_ring, rfd_next_to_use); 1865 rfd_desc = ATL1_RFD_DESC(rfd_ring, rfd_next_to_use);
1866 1866
1867 skb = netdev_alloc_skb(adapter->netdev, 1867 skb = netdev_alloc_skb_ip_align(adapter->netdev,
1868 adapter->rx_buffer_len + NET_IP_ALIGN); 1868 adapter->rx_buffer_len);
1869 if (unlikely(!skb)) { 1869 if (unlikely(!skb)) {
1870 /* Better luck next round */ 1870 /* Better luck next round */
1871 adapter->netdev->stats.rx_dropped++; 1871 adapter->netdev->stats.rx_dropped++;
1872 break; 1872 break;
1873 } 1873 }
1874 1874
1875 /*
1876 * Make buffer alignment 2 beyond a 16 byte boundary
1877 * this will result in a 16 byte aligned IP header after
1878 * the 14 byte MAC header is removed
1879 */
1880 skb_reserve(skb, NET_IP_ALIGN);
1881
1882 buffer_info->alloced = 1; 1875 buffer_info->alloced = 1;
1883 buffer_info->skb = skb; 1876 buffer_info->skb = skb;
1884 buffer_info->length = (u16) adapter->rx_buffer_len; 1877 buffer_info->length = (u16) adapter->rx_buffer_len;
@@ -2094,8 +2087,8 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
2094 } 2087 }
2095 atomic_set(&tpd_ring->next_to_clean, sw_tpd_next_to_clean); 2088 atomic_set(&tpd_ring->next_to_clean, sw_tpd_next_to_clean);
2096 2089
2097 if (netif_queue_stopped(adapter->netdev) 2090 if (netif_queue_stopped(adapter->netdev) &&
2098 && netif_carrier_ok(adapter->netdev)) 2091 netif_carrier_ok(adapter->netdev))
2099 netif_wake_queue(adapter->netdev); 2092 netif_wake_queue(adapter->netdev);
2100} 2093}
2101 2094
@@ -2596,7 +2589,7 @@ static s32 atl1_up(struct atl1_adapter *adapter)
2596 irq_flags |= IRQF_SHARED; 2589 irq_flags |= IRQF_SHARED;
2597 } 2590 }
2598 2591
2599 err = request_irq(adapter->pdev->irq, &atl1_intr, irq_flags, 2592 err = request_irq(adapter->pdev->irq, atl1_intr, irq_flags,
2600 netdev->name, netdev); 2593 netdev->name, netdev);
2601 if (unlikely(err)) 2594 if (unlikely(err))
2602 goto err_up; 2595 goto err_up;
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index ab688862093f..54662f24f9bb 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -39,6 +39,7 @@
39#include <linux/pci_ids.h> 39#include <linux/pci_ids.h>
40#include <linux/pm.h> 40#include <linux/pm.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <linux/slab.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43#include <linux/string.h> 44#include <linux/string.h>
44#include <linux/tcp.h> 45#include <linux/tcp.h>
@@ -63,7 +64,7 @@ MODULE_VERSION(ATL2_DRV_VERSION);
63/* 64/*
64 * atl2_pci_tbl - PCI Device ID Table 65 * atl2_pci_tbl - PCI Device ID Table
65 */ 66 */
66static struct pci_device_id atl2_pci_tbl[] = { 67static DEFINE_PCI_DEVICE_TABLE(atl2_pci_tbl) = {
67 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2)}, 68 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2)},
68 /* required last entry */ 69 /* required last entry */
69 {0,} 70 {0,}
@@ -157,7 +158,7 @@ static void atl2_set_multi(struct net_device *netdev)
157 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 158 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
158 159
159 /* comoute mc addresses' hash value ,and put it into hash table */ 160 /* comoute mc addresses' hash value ,and put it into hash table */
160 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 161 netdev_for_each_mc_addr(mc_ptr, netdev) {
161 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr); 162 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr);
162 atl2_hash_set(hw, hash_value); 163 atl2_hash_set(hw, hash_value);
163 } 164 }
@@ -409,7 +410,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
409 if (rxd->status.ok && rxd->status.pkt_size >= 60) { 410 if (rxd->status.ok && rxd->status.pkt_size >= 60) {
410 int rx_size = (int)(rxd->status.pkt_size - 4); 411 int rx_size = (int)(rxd->status.pkt_size - 4);
411 /* alloc new buffer */ 412 /* alloc new buffer */
412 skb = netdev_alloc_skb(netdev, rx_size + NET_IP_ALIGN); 413 skb = netdev_alloc_skb_ip_align(netdev, rx_size);
413 if (NULL == skb) { 414 if (NULL == skb) {
414 printk(KERN_WARNING 415 printk(KERN_WARNING
415 "%s: Mem squeeze, deferring packet.\n", 416 "%s: Mem squeeze, deferring packet.\n",
@@ -421,7 +422,6 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
421 netdev->stats.rx_dropped++; 422 netdev->stats.rx_dropped++;
422 break; 423 break;
423 } 424 }
424 skb_reserve(skb, NET_IP_ALIGN);
425 skb->dev = netdev; 425 skb->dev = netdev;
426 memcpy(skb->data, rxd->packet, rx_size); 426 memcpy(skb->data, rxd->packet, rx_size);
427 skb_put(skb, rx_size); 427 skb_put(skb, rx_size);
@@ -652,7 +652,7 @@ static int atl2_request_irq(struct atl2_adapter *adapter)
652 if (adapter->have_msi) 652 if (adapter->have_msi)
653 flags &= ~IRQF_SHARED; 653 flags &= ~IRQF_SHARED;
654 654
655 return request_irq(adapter->pdev->irq, &atl2_intr, flags, netdev->name, 655 return request_irq(adapter->pdev->irq, atl2_intr, flags, netdev->name,
656 netdev); 656 netdev);
657} 657}
658 658
@@ -1960,12 +1960,15 @@ static int atl2_get_eeprom(struct net_device *netdev,
1960 return -ENOMEM; 1960 return -ENOMEM;
1961 1961
1962 for (i = first_dword; i < last_dword; i++) { 1962 for (i = first_dword; i < last_dword; i++) {
1963 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) 1963 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
1964 return -EIO; 1964 ret_val = -EIO;
1965 goto free;
1966 }
1965 } 1967 }
1966 1968
1967 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), 1969 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
1968 eeprom->len); 1970 eeprom->len);
1971free:
1969 kfree(eeprom_buff); 1972 kfree(eeprom_buff);
1970 1973
1971 return ret_val; 1974 return ret_val;
diff --git a/drivers/net/atlx/atl2.h b/drivers/net/atlx/atl2.h
index d918bbe621ea..927e4de6474d 100644
--- a/drivers/net/atlx/atl2.h
+++ b/drivers/net/atlx/atl2.h
@@ -442,7 +442,7 @@ struct atl2_hw {
442struct atl2_ring_header { 442struct atl2_ring_header {
443 /* pointer to the descriptor ring memory */ 443 /* pointer to the descriptor ring memory */
444 void *desc; 444 void *desc;
445 /* physical adress of the descriptor ring */ 445 /* physical address of the descriptor ring */
446 dma_addr_t dma; 446 dma_addr_t dma;
447 /* length of descriptor ring in bytes */ 447 /* length of descriptor ring in bytes */
448 unsigned int size; 448 unsigned int size;
diff --git a/drivers/net/atlx/atlx.c b/drivers/net/atlx/atlx.c
index 3dc014215679..72f3306352e2 100644
--- a/drivers/net/atlx/atlx.c
+++ b/drivers/net/atlx/atlx.c
@@ -144,7 +144,7 @@ static void atlx_set_multi(struct net_device *netdev)
144 iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2)); 144 iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2));
145 145
146 /* compute mc addresses' hash value ,and put it into hash table */ 146 /* compute mc addresses' hash value ,and put it into hash table */
147 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 147 netdev_for_each_mc_addr(mc_ptr, netdev) {
148 hash_value = atlx_hash_mc_addr(hw, mc_ptr->dmi_addr); 148 hash_value = atlx_hash_mc_addr(hw, mc_ptr->dmi_addr);
149 atlx_hash_set(hw, hash_value); 149 atlx_hash_set(hw, hash_value);
150 } 150 }