aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/acenic.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-07-22 02:31:12 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-25 19:16:00 -0400
commit427e21faee1877053828b115bbb336c289562ac5 (patch)
treef9e85e1f2a70bda11bc227e23a559820298677d7 /drivers/net/acenic.c
parent750e06992d49666a7589aac555eb3bb68e4dbb88 (diff)
acenic: use netdev_alloc_skb_ip_align
Take Eric's patch one step further. Use netdev_skb_ip_align to do setup the receive skb. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/acenic.c')
-rw-r--r--drivers/net/acenic.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 536038b2271..31798f5f5d0 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -1502,13 +1502,13 @@ static int __devinit ace_init(struct net_device *dev)
1502 * firmware to wipe the ring without re-initializing it. 1502 * firmware to wipe the ring without re-initializing it.
1503 */ 1503 */
1504 if (!test_and_set_bit(0, &ap->std_refill_busy)) 1504 if (!test_and_set_bit(0, &ap->std_refill_busy))
1505 ace_load_std_rx_ring(ap, RX_RING_SIZE); 1505 ace_load_std_rx_ring(dev, RX_RING_SIZE);
1506 else 1506 else
1507 printk(KERN_ERR "%s: Someone is busy refilling the RX ring\n", 1507 printk(KERN_ERR "%s: Someone is busy refilling the RX ring\n",
1508 ap->name); 1508 ap->name);
1509 if (ap->version >= 2) { 1509 if (ap->version >= 2) {
1510 if (!test_and_set_bit(0, &ap->mini_refill_busy)) 1510 if (!test_and_set_bit(0, &ap->mini_refill_busy))
1511 ace_load_mini_rx_ring(ap, RX_MINI_SIZE); 1511 ace_load_mini_rx_ring(dev, RX_MINI_SIZE);
1512 else 1512 else
1513 printk(KERN_ERR "%s: Someone is busy refilling " 1513 printk(KERN_ERR "%s: Someone is busy refilling "
1514 "the RX mini ring\n", ap->name); 1514 "the RX mini ring\n", ap->name);
@@ -1584,9 +1584,10 @@ static void ace_watchdog(struct net_device *data)
1584} 1584}
1585 1585
1586 1586
1587static void ace_tasklet(unsigned long dev) 1587static void ace_tasklet(unsigned long arg)
1588{ 1588{
1589 struct ace_private *ap = netdev_priv((struct net_device *)dev); 1589 struct net_device *dev = (struct net_device *) arg;
1590 struct ace_private *ap = netdev_priv(dev);
1590 int cur_size; 1591 int cur_size;
1591 1592
1592 cur_size = atomic_read(&ap->cur_rx_bufs); 1593 cur_size = atomic_read(&ap->cur_rx_bufs);
@@ -1595,7 +1596,7 @@ static void ace_tasklet(unsigned long dev)
1595#ifdef DEBUG 1596#ifdef DEBUG
1596 printk("refilling buffers (current %i)\n", cur_size); 1597 printk("refilling buffers (current %i)\n", cur_size);
1597#endif 1598#endif
1598 ace_load_std_rx_ring(ap, RX_RING_SIZE - cur_size); 1599 ace_load_std_rx_ring(dev, RX_RING_SIZE - cur_size);
1599 } 1600 }
1600 1601
1601 if (ap->version >= 2) { 1602 if (ap->version >= 2) {
@@ -1606,7 +1607,7 @@ static void ace_tasklet(unsigned long dev)
1606 printk("refilling mini buffers (current %i)\n", 1607 printk("refilling mini buffers (current %i)\n",
1607 cur_size); 1608 cur_size);
1608#endif 1609#endif
1609 ace_load_mini_rx_ring(ap, RX_MINI_SIZE - cur_size); 1610 ace_load_mini_rx_ring(dev, RX_MINI_SIZE - cur_size);
1610 } 1611 }
1611 } 1612 }
1612 1613
@@ -1616,7 +1617,7 @@ static void ace_tasklet(unsigned long dev)
1616#ifdef DEBUG 1617#ifdef DEBUG
1617 printk("refilling jumbo buffers (current %i)\n", cur_size); 1618 printk("refilling jumbo buffers (current %i)\n", cur_size);
1618#endif 1619#endif
1619 ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE - cur_size); 1620 ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE - cur_size);
1620 } 1621 }
1621 ap->tasklet_pending = 0; 1622 ap->tasklet_pending = 0;
1622} 1623}
@@ -1642,8 +1643,9 @@ static void ace_dump_trace(struct ace_private *ap)
1642 * done only before the device is enabled, thus no interrupts are 1643 * done only before the device is enabled, thus no interrupts are
1643 * generated and by the interrupt handler/tasklet handler. 1644 * generated and by the interrupt handler/tasklet handler.
1644 */ 1645 */
1645static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs) 1646static void ace_load_std_rx_ring(struct net_device *dev, int nr_bufs)
1646{ 1647{
1648 struct ace_private *ap = netdev_priv(dev);
1647 struct ace_regs __iomem *regs = ap->regs; 1649 struct ace_regs __iomem *regs = ap->regs;
1648 short i, idx; 1650 short i, idx;
1649 1651
@@ -1657,11 +1659,10 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
1657 struct rx_desc *rd; 1659 struct rx_desc *rd;
1658 dma_addr_t mapping; 1660 dma_addr_t mapping;
1659 1661
1660 skb = dev_alloc_skb(ACE_STD_BUFSIZE + NET_IP_ALIGN); 1662 skb = netdev_alloc_skb_ip_align(dev, ACE_STD_BUFSIZE);
1661 if (!skb) 1663 if (!skb)
1662 break; 1664 break;
1663 1665
1664 skb_reserve(skb, NET_IP_ALIGN);
1665 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data), 1666 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
1666 offset_in_page(skb->data), 1667 offset_in_page(skb->data),
1667 ACE_STD_BUFSIZE, 1668 ACE_STD_BUFSIZE,
@@ -1705,8 +1706,9 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
1705} 1706}
1706 1707
1707 1708
1708static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs) 1709static void ace_load_mini_rx_ring(struct net_device *dev, int nr_bufs)
1709{ 1710{
1711 struct ace_private *ap = netdev_priv(dev);
1710 struct ace_regs __iomem *regs = ap->regs; 1712 struct ace_regs __iomem *regs = ap->regs;
1711 short i, idx; 1713 short i, idx;
1712 1714
@@ -1718,11 +1720,10 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
1718 struct rx_desc *rd; 1720 struct rx_desc *rd;
1719 dma_addr_t mapping; 1721 dma_addr_t mapping;
1720 1722
1721 skb = dev_alloc_skb(ACE_MINI_BUFSIZE + NET_IP_ALIGN); 1723 skb = netdev_alloc_skb_ip_align(dev, ACE_MINI_BUFSIZE);
1722 if (!skb) 1724 if (!skb)
1723 break; 1725 break;
1724 1726
1725 skb_reserve(skb, NET_IP_ALIGN);
1726 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data), 1727 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
1727 offset_in_page(skb->data), 1728 offset_in_page(skb->data),
1728 ACE_MINI_BUFSIZE, 1729 ACE_MINI_BUFSIZE,
@@ -1762,8 +1763,9 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
1762 * Load the jumbo rx ring, this may happen at any time if the MTU 1763 * Load the jumbo rx ring, this may happen at any time if the MTU
1763 * is changed to a value > 1500. 1764 * is changed to a value > 1500.
1764 */ 1765 */
1765static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs) 1766static void ace_load_jumbo_rx_ring(struct net_device *dev, int nr_bufs)
1766{ 1767{
1768 struct ace_private *ap = netdev_priv(dev);
1767 struct ace_regs __iomem *regs = ap->regs; 1769 struct ace_regs __iomem *regs = ap->regs;
1768 short i, idx; 1770 short i, idx;
1769 1771
@@ -1774,11 +1776,10 @@ static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
1774 struct rx_desc *rd; 1776 struct rx_desc *rd;
1775 dma_addr_t mapping; 1777 dma_addr_t mapping;
1776 1778
1777 skb = dev_alloc_skb(ACE_JUMBO_BUFSIZE + NET_IP_ALIGN); 1779 skb = netdev_alloc_skb_ip_align(dev, ACE_JUMBO_BUFSIZE);
1778 if (!skb) 1780 if (!skb)
1779 break; 1781 break;
1780 1782
1781 skb_reserve(skb, NET_IP_ALIGN);
1782 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data), 1783 mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
1783 offset_in_page(skb->data), 1784 offset_in_page(skb->data),
1784 ACE_JUMBO_BUFSIZE, 1785 ACE_JUMBO_BUFSIZE,
@@ -2196,7 +2197,7 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
2196#ifdef DEBUG 2197#ifdef DEBUG
2197 printk("low on std buffers %i\n", cur_size); 2198 printk("low on std buffers %i\n", cur_size);
2198#endif 2199#endif
2199 ace_load_std_rx_ring(ap, 2200 ace_load_std_rx_ring(dev,
2200 RX_RING_SIZE - cur_size); 2201 RX_RING_SIZE - cur_size);
2201 } else 2202 } else
2202 run_tasklet = 1; 2203 run_tasklet = 1;
@@ -2212,7 +2213,8 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
2212 printk("low on mini buffers %i\n", 2213 printk("low on mini buffers %i\n",
2213 cur_size); 2214 cur_size);
2214#endif 2215#endif
2215 ace_load_mini_rx_ring(ap, RX_MINI_SIZE - cur_size); 2216 ace_load_mini_rx_ring(dev,
2217 RX_MINI_SIZE - cur_size);
2216 } else 2218 } else
2217 run_tasklet = 1; 2219 run_tasklet = 1;
2218 } 2220 }
@@ -2228,7 +2230,8 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
2228 printk("low on jumbo buffers %i\n", 2230 printk("low on jumbo buffers %i\n",
2229 cur_size); 2231 cur_size);
2230#endif 2232#endif
2231 ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE - cur_size); 2233 ace_load_jumbo_rx_ring(dev,
2234 RX_JUMBO_SIZE - cur_size);
2232 } else 2235 } else
2233 run_tasklet = 1; 2236 run_tasklet = 1;
2234 } 2237 }
@@ -2267,7 +2270,7 @@ static int ace_open(struct net_device *dev)
2267 2270
2268 if (ap->jumbo && 2271 if (ap->jumbo &&
2269 !test_and_set_bit(0, &ap->jumbo_refill_busy)) 2272 !test_and_set_bit(0, &ap->jumbo_refill_busy))
2270 ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE); 2273 ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE);
2271 2274
2272 if (dev->flags & IFF_PROMISC) { 2275 if (dev->flags & IFF_PROMISC) {
2273 cmd.evt = C_SET_PROMISC_MODE; 2276 cmd.evt = C_SET_PROMISC_MODE;
@@ -2575,7 +2578,7 @@ static int ace_change_mtu(struct net_device *dev, int new_mtu)
2575 "support\n", dev->name); 2578 "support\n", dev->name);
2576 ap->jumbo = 1; 2579 ap->jumbo = 1;
2577 if (!test_and_set_bit(0, &ap->jumbo_refill_busy)) 2580 if (!test_and_set_bit(0, &ap->jumbo_refill_busy))
2578 ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE); 2581 ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE);
2579 ace_set_rxtx_parms(dev, 1); 2582 ace_set_rxtx_parms(dev, 1);
2580 } 2583 }
2581 } else { 2584 } else {