aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2007-02-28 17:16:57 -0500
committerJeff Garzik <jeff@garzik.org>2007-07-08 22:16:44 -0400
commite9f63f30863fd778a5329e93c7e2208b9bcb5b79 (patch)
treef6744d61585961022468e96164684987dd4fd1a1 /drivers/net/r8169.c
parent275391a482c436282dde57beeffc5d61b229fdd2 (diff)
r8169: align the IP header when there is no DMA constraint
Align the IP header when the chipset can DMA at any location (plain 0x8169). Otherwise (0x8136/0x8168) obey the constraint imposed by the hardware. This patch complements the previous alignment rework done for copybreak. Original idea from Philip Craig <philipc@snapgear.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Philip Craig <philipc@snapgear.com> Cc: Mike Isely <isely@pobox.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d8862cd84f3d..1942bf7843aa 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1415,7 +1415,7 @@ static const struct rtl_cfg_info {
1415 [RTL_CFG_0] = { 1415 [RTL_CFG_0] = {
1416 .hw_start = rtl_hw_start_8169, 1416 .hw_start = rtl_hw_start_8169,
1417 .region = 1, 1417 .region = 1,
1418 .align = 2, 1418 .align = 0,
1419 .intr_event = SYSErr | LinkChg | RxOverflow | 1419 .intr_event = SYSErr | LinkChg | RxOverflow |
1420 RxFIFOOver | TxErr | TxOK | RxOK | RxErr, 1420 RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
1421 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow 1421 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow
@@ -2076,12 +2076,15 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
2076{ 2076{
2077 struct sk_buff *skb; 2077 struct sk_buff *skb;
2078 dma_addr_t mapping; 2078 dma_addr_t mapping;
2079 unsigned int pad;
2079 2080
2080 skb = netdev_alloc_skb(dev, rx_buf_sz + align); 2081 pad = align ? align : NET_IP_ALIGN;
2082
2083 skb = netdev_alloc_skb(dev, rx_buf_sz + pad);
2081 if (!skb) 2084 if (!skb)
2082 goto err_out; 2085 goto err_out;
2083 2086
2084 skb_reserve(skb, (align - 1) & (unsigned long)skb->data); 2087 skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad);
2085 2088
2086 mapping = pci_map_single(pdev, skb->data, rx_buf_sz, 2089 mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
2087 PCI_DMA_FROMDEVICE); 2090 PCI_DMA_FROMDEVICE);