diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-13 01:34:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-13 14:48:18 -0400 |
commit | 89d71a66c40d629e3b1285def543ab1425558cd5 (patch) | |
tree | 45159e85418170fe36e4e023d9617693625d1740 /drivers/net/lib82596.c | |
parent | bff1c09640b3006bca711e18ef08a5fb955ad9b5 (diff) |
net: Use netdev_alloc_skb_ip_align()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/lib82596.c')
-rw-r--r-- | drivers/net/lib82596.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c index 51e11c3e53e1..5b24c67de25e 100644 --- a/drivers/net/lib82596.c +++ b/drivers/net/lib82596.c | |||
@@ -470,11 +470,11 @@ static inline int init_rx_bufs(struct net_device *dev) | |||
470 | 470 | ||
471 | for (i = 0, rbd = dma->rbds; i < rx_ring_size; i++, rbd++) { | 471 | for (i = 0, rbd = dma->rbds; i < rx_ring_size; i++, rbd++) { |
472 | dma_addr_t dma_addr; | 472 | dma_addr_t dma_addr; |
473 | struct sk_buff *skb = netdev_alloc_skb(dev, PKT_BUF_SZ + 4); | 473 | struct sk_buff *skb; |
474 | 474 | ||
475 | skb = netdev_alloc_skb_ip_align(dev, PKT_BUF_SZ); | ||
475 | if (skb == NULL) | 476 | if (skb == NULL) |
476 | return -1; | 477 | return -1; |
477 | skb_reserve(skb, 2); | ||
478 | dma_addr = dma_map_single(dev->dev.parent, skb->data, | 478 | dma_addr = dma_map_single(dev->dev.parent, skb->data, |
479 | PKT_BUF_SZ, DMA_FROM_DEVICE); | 479 | PKT_BUF_SZ, DMA_FROM_DEVICE); |
480 | rbd->v_next = rbd+1; | 480 | rbd->v_next = rbd+1; |
@@ -697,12 +697,12 @@ static inline int i596_rx(struct net_device *dev) | |||
697 | (dma_addr_t)SWAP32(rbd->b_data), | 697 | (dma_addr_t)SWAP32(rbd->b_data), |
698 | PKT_BUF_SZ, DMA_FROM_DEVICE); | 698 | PKT_BUF_SZ, DMA_FROM_DEVICE); |
699 | /* Get fresh skbuff to replace filled one. */ | 699 | /* Get fresh skbuff to replace filled one. */ |
700 | newskb = netdev_alloc_skb(dev, PKT_BUF_SZ + 4); | 700 | newskb = netdev_alloc_skb_ip_align(dev, |
701 | PKT_BUF_SZ); | ||
701 | if (newskb == NULL) { | 702 | if (newskb == NULL) { |
702 | skb = NULL; /* drop pkt */ | 703 | skb = NULL; /* drop pkt */ |
703 | goto memory_squeeze; | 704 | goto memory_squeeze; |
704 | } | 705 | } |
705 | skb_reserve(newskb, 2); | ||
706 | 706 | ||
707 | /* Pass up the skb already on the Rx ring. */ | 707 | /* Pass up the skb already on the Rx ring. */ |
708 | skb_put(skb, pkt_len); | 708 | skb_put(skb, pkt_len); |
@@ -716,7 +716,7 @@ static inline int i596_rx(struct net_device *dev) | |||
716 | rbd->b_data = SWAP32(dma_addr); | 716 | rbd->b_data = SWAP32(dma_addr); |
717 | DMA_WBACK_INV(dev, rbd, sizeof(struct i596_rbd)); | 717 | DMA_WBACK_INV(dev, rbd, sizeof(struct i596_rbd)); |
718 | } else | 718 | } else |
719 | skb = netdev_alloc_skb(dev, pkt_len + 2); | 719 | skb = netdev_alloc_skb_ip_align(dev, pkt_len); |
720 | memory_squeeze: | 720 | memory_squeeze: |
721 | if (skb == NULL) { | 721 | if (skb == NULL) { |
722 | /* XXX tulip.c can defer packets here!! */ | 722 | /* XXX tulip.c can defer packets here!! */ |
@@ -730,7 +730,6 @@ memory_squeeze: | |||
730 | dma_sync_single_for_cpu(dev->dev.parent, | 730 | dma_sync_single_for_cpu(dev->dev.parent, |
731 | (dma_addr_t)SWAP32(rbd->b_data), | 731 | (dma_addr_t)SWAP32(rbd->b_data), |
732 | PKT_BUF_SZ, DMA_FROM_DEVICE); | 732 | PKT_BUF_SZ, DMA_FROM_DEVICE); |
733 | skb_reserve(skb, 2); | ||
734 | memcpy(skb_put(skb, pkt_len), rbd->v_data, pkt_len); | 733 | memcpy(skb_put(skb, pkt_len), rbd->v_data, pkt_len); |
735 | dma_sync_single_for_device(dev->dev.parent, | 734 | dma_sync_single_for_device(dev->dev.parent, |
736 | (dma_addr_t)SWAP32(rbd->b_data), | 735 | (dma_addr_t)SWAP32(rbd->b_data), |