[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <482551f30b3125f687454555f575bc08f216c796.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
Cc: Roger Luethi <rl@...lgate.ch>
Subject: [PATCH 19/21] net: via-rhine: use common rx_copybreak handling
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
drivers/net/via-rhine.c | 37 +++++--------------------------------
1 files changed, 5 insertions(+), 32 deletions(-)
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 7f23ab9..c97265e 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1764,40 +1764,13 @@ static int rhine_rx(struct net_device *dev, int limit)
} else {
struct sk_buff *skb = NULL;
/* Length should omit the CRC */
- int pkt_len = data_size - 4;
+ int pkt_len = data_size - ETH_FCS_LEN;
u16 vlan_tci = 0;
- /* Check if the packet is long enough to accept without
- copying to a minimally-sized skbuff. */
- if (pkt_len < rx_copybreak)
- skb = netdev_alloc_skb_ip_align(dev, pkt_len);
- if (skb) {
- pci_dma_sync_single_for_cpu(rp->pdev,
- rp->rx_skbuff_dma[entry],
- rp->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
-
- skb_copy_to_linear_data(skb,
- rp->rx_skbuff[entry]->data,
- pkt_len);
- skb_put(skb, pkt_len);
- pci_dma_sync_single_for_device(rp->pdev,
- rp->rx_skbuff_dma[entry],
- rp->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
- } else {
- skb = rp->rx_skbuff[entry];
- if (skb == NULL) {
- netdev_err(dev, "Inconsistent Rx descriptor chain\n");
- break;
- }
- rp->rx_skbuff[entry] = NULL;
- skb_put(skb, pkt_len);
- pci_unmap_single(rp->pdev,
- rp->rx_skbuff_dma[entry],
- rp->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
- }
+ skb = dev_skb_finish_rx_dma(&rp->rx_skbuff[entry],
+ pkt_len, rx_copybreak,
+ &rp->pdev->dev, rp->rx_skbuff_dma[entry],
+ rp->rx_buf_sz);
if (unlikely(desc_length & DescTag))
vlan_tci = rhine_get_vlan_tci(skb, data_size);
--
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