[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <29374e542d6211f31b9ed0571a60b795f4aed1bb.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: Grant Grundler <grundler@...isc-linux.org>
Subject: [PATCH 15/21] net: tulip/de2104x: use common rx_copybreak handling
[strict refill!]
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
drivers/net/tulip/de2104x.c | 38 +++++++++-----------------------------
1 files changed, 9 insertions(+), 29 deletions(-)
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index ce90efc..80a34b6 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -409,8 +409,7 @@ static void de_rx (struct de_private *de)
while (--rx_work) {
u32 status, len;
dma_addr_t mapping;
- struct sk_buff *skb, *copy_skb;
- unsigned copying_skb, buflen;
+ struct sk_buff *skb;
skb = de->rx_skb[rx_tail].skb;
BUG_ON(!skb);
@@ -432,42 +431,22 @@ static void de_rx (struct de_private *de)
goto rx_next;
}
- copying_skb = (len <= rx_copybreak);
-
netif_dbg(de, rx_status, de->dev,
"rx slot %d status 0x%x len %d copying? %d\n",
- rx_tail, status, len, copying_skb);
+ rx_tail, status, len, len <= rx_copybreak);
- buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz;
- copy_skb = dev_alloc_skb (buflen);
- if (unlikely(!copy_skb)) {
+ skb = dev_skb_finish_rx_dma_refill(&de->rx_skb[rx_tail].skb,
+ len, rx_copybreak, 0, RX_OFFSET,
+ &de->pdev->dev, &mapping, de->rx_buf_sz);
+ de->rx_skb[rx_tail].mapping = mapping;
+
+ if (unlikely(!skb)) {
de->net_stats.rx_dropped++;
drop = 1;
rx_work = 100;
goto rx_next;
}
- if (!copying_skb) {
- pci_unmap_single(de->pdev, mapping,
- buflen, PCI_DMA_FROMDEVICE);
- skb_put(skb, len);
-
- mapping =
- de->rx_skb[rx_tail].mapping =
- pci_map_single(de->pdev, copy_skb->data,
- buflen, PCI_DMA_FROMDEVICE);
- de->rx_skb[rx_tail].skb = copy_skb;
- } else {
- pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
- skb_reserve(copy_skb, RX_OFFSET);
- skb_copy_from_linear_data(skb, skb_put(copy_skb, len),
- len);
- pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
-
- /* We'll reuse the original ring buffer. */
- skb = copy_skb;
- }
-
skb->protocol = eth_type_trans (skb, de->dev);
de->net_stats.rx_packets++;
@@ -1292,6 +1271,7 @@ static int de_refill_rx (struct de_private *de)
de->rx_skb[i].mapping = pci_map_single(de->pdev,
skb->data, de->rx_buf_sz, PCI_DMA_FROMDEVICE);
de->rx_skb[i].skb = skb;
+ skb_reserve(skb, RX_OFFSET);
de->rx_ring[i].opts1 = cpu_to_le32(DescOwn);
if (i == (DE_RX_RING_SIZE - 1))
--
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