diff options
author | Kevin Lo <kevlo@kevlo.org> | 2008-08-26 23:35:15 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 10:24:09 -0400 |
commit | a52be1cbc262bb23cce9d856975c74626d26ec8c (patch) | |
tree | a409d058a33437cb85031e69683dfab72792a920 /drivers/net/8139cp.c | |
parent | b26b555a7b4decf765ade265fa9da3bd6ff3e9e0 (diff) |
8139cp: use netdev_alloc_skb
This patch uses netdev_alloc_skb. This sets skb->dev and allows
arch specific allocation. Also cleanup the alignment code.
Signed-off-by: Kevin Lo <kevlo@kevlo.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/8139cp.c')
-rw-r--r-- | drivers/net/8139cp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 6011d6fabef0..85fa40a0a667 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -127,7 +127,6 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered mu | |||
127 | (CP)->tx_tail - (CP)->tx_head - 1) | 127 | (CP)->tx_tail - (CP)->tx_head - 1) |
128 | 128 | ||
129 | #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ | 129 | #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ |
130 | #define RX_OFFSET 2 | ||
131 | #define CP_INTERNAL_PHY 32 | 130 | #define CP_INTERNAL_PHY 32 |
132 | 131 | ||
133 | /* The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024, 7==end of packet. */ | 132 | /* The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024, 7==end of packet. */ |
@@ -552,14 +551,14 @@ rx_status_loop: | |||
552 | printk(KERN_DEBUG "%s: rx slot %d status 0x%x len %d\n", | 551 | printk(KERN_DEBUG "%s: rx slot %d status 0x%x len %d\n", |
553 | dev->name, rx_tail, status, len); | 552 | dev->name, rx_tail, status, len); |
554 | 553 | ||
555 | buflen = cp->rx_buf_sz + RX_OFFSET; | 554 | buflen = cp->rx_buf_sz + NET_IP_ALIGN; |
556 | new_skb = dev_alloc_skb (buflen); | 555 | new_skb = netdev_alloc_skb(dev, buflen); |
557 | if (!new_skb) { | 556 | if (!new_skb) { |
558 | dev->stats.rx_dropped++; | 557 | dev->stats.rx_dropped++; |
559 | goto rx_next; | 558 | goto rx_next; |
560 | } | 559 | } |
561 | 560 | ||
562 | skb_reserve(new_skb, RX_OFFSET); | 561 | skb_reserve(new_skb, NET_IP_ALIGN); |
563 | 562 | ||
564 | dma_unmap_single(&cp->pdev->dev, mapping, | 563 | dma_unmap_single(&cp->pdev->dev, mapping, |
565 | buflen, PCI_DMA_FROMDEVICE); | 564 | buflen, PCI_DMA_FROMDEVICE); |
@@ -1051,19 +1050,20 @@ static void cp_init_hw (struct cp_private *cp) | |||
1051 | cpw8_f(Cfg9346, Cfg9346_Lock); | 1050 | cpw8_f(Cfg9346, Cfg9346_Lock); |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | static int cp_refill_rx (struct cp_private *cp) | 1053 | static int cp_refill_rx(struct cp_private *cp) |
1055 | { | 1054 | { |
1055 | struct net_device *dev = cp->dev; | ||
1056 | unsigned i; | 1056 | unsigned i; |
1057 | 1057 | ||
1058 | for (i = 0; i < CP_RX_RING_SIZE; i++) { | 1058 | for (i = 0; i < CP_RX_RING_SIZE; i++) { |
1059 | struct sk_buff *skb; | 1059 | struct sk_buff *skb; |
1060 | dma_addr_t mapping; | 1060 | dma_addr_t mapping; |
1061 | 1061 | ||
1062 | skb = dev_alloc_skb(cp->rx_buf_sz + RX_OFFSET); | 1062 | skb = netdev_alloc_skb(dev, cp->rx_buf_sz + NET_IP_ALIGN); |
1063 | if (!skb) | 1063 | if (!skb) |
1064 | goto err_out; | 1064 | goto err_out; |
1065 | 1065 | ||
1066 | skb_reserve(skb, RX_OFFSET); | 1066 | skb_reserve(skb, NET_IP_ALIGN); |
1067 | 1067 | ||
1068 | mapping = dma_map_single(&cp->pdev->dev, skb->data, | 1068 | mapping = dma_map_single(&cp->pdev->dev, skb->data, |
1069 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1069 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |