[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <bf7f9370b83ff9297f5100b435f2a060347a5275.1310229312.git.mirq-linux@rere.qmqm.pl>
Date: Sat, 9 Jul 2011 19:17:53 +0200 (CEST)
From: Michał Mirosław <mirq-linux@...e.qmqm.pl>
To: netdev@...r.kernel.org
Subject: [PATCH 21/21] net: yellowfin: use common rx_copybreak handling
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
drivers/net/yellowfin.c | 27 ++++++---------------------
1 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 3e5ac60..e1aa4a6 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -1124,27 +1124,12 @@ static int yellowfin_rx(struct net_device *dev)
printk(KERN_DEBUG " %s() normal Rx pkt length %d of %d, bogus_cnt %d\n",
__func__, pkt_len, data_size, boguscnt);
#endif
- /* Check if the packet is long enough to just pass up the skbuff
- without copying to a properly sized skbuff. */
- if (pkt_len > rx_copybreak) {
- skb_put(skb = rx_skb, pkt_len);
- pci_unmap_single(yp->pci_dev,
- le32_to_cpu(yp->rx_ring[entry].addr),
- yp->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
- yp->rx_skbuff[entry] = NULL;
- } else {
- skb = dev_alloc_skb(pkt_len + 2);
- if (skb == NULL)
- break;
- skb_reserve(skb, 2); /* 16 byte align the IP header */
- skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
- skb_put(skb, pkt_len);
- pci_dma_sync_single_for_device(yp->pci_dev,
- le32_to_cpu(desc->addr),
- yp->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
- }
+ skb = dev_skb_finish_rx_dma(&yp->rx_skbuff[entry],
+ pkt_len, rx_copybreak,
+ &yp->pci_dev->dev,
+ le32_to_cpu(desc->addr),
+ yp->rx_buf_sz);
+
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->stats.rx_packets++;
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists