From: Don Fry Date: Tue, 6 Mar 2007 02:13:09 +0000 (-0800) Subject: pcnet32: Fix PCnet32 performance bug on non-coherent architecutres X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b2cbbd8e0e8093fbf115ac2669482b016d781c78;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git pcnet32: Fix PCnet32 performance bug on non-coherent architecutres The PCnet32 driver always passed the the size of the largest possible packet to the pci_dma_sync_single_for_cpu and pci_dma_sync_single_for_device. This results in a fairly large "colateral damage" in the caches and makes the flush operation itself much slower. On a system with a 40MHz CPU this patch increases network bandwidth by about 12%. Signed-off-by: Ralf Baechle Acked-by: Don Fry Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 36f9d988278f..4d94ba7899bf 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -1234,14 +1234,14 @@ static void pcnet32_rx_entry(struct net_device *dev, skb_put(skb, pkt_len); /* Make room */ pci_dma_sync_single_for_cpu(lp->pci_dev, lp->rx_dma_addr[entry], - PKT_BUF_SZ - 2, + pkt_len, PCI_DMA_FROMDEVICE); eth_copy_and_sum(skb, (unsigned char *)(lp->rx_skbuff[entry]->data), pkt_len, 0); pci_dma_sync_single_for_device(lp->pci_dev, lp->rx_dma_addr[entry], - PKT_BUF_SZ - 2, + pkt_len, PCI_DMA_FROMDEVICE); } lp->stats.rx_bytes += skb->len;