@@ -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);
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/net/via-rhine.c | 37 +++++-------------------------------- 1 files changed, 5 insertions(+), 32 deletions(-)