aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2007-02-20 16:20:51 -0500
committerJeff Garzik <jeff@garzik.org>2007-07-08 22:16:44 -0400
commit864022344caf43dab7fa5219152280d056c6e051 (patch)
tree6df9d868ff437b6ae7fa76d1821ac79a2448e857 /drivers/net/r8169.c
parent0e4851502f846b13b29b7f88f1250c980d57e944 (diff)
r8169: confusion between hardware and IP header alignment
The rx copybreak part is straightforward. The align field in struct rtl_cfg_info is related to the alignment requirements of the DMA operation. Its value is set at 2 to limit the scale of possible regression but my old v1.21 8169 datasheet claims a 8 bytes requirements (which never appeared in the driver, of course) and the 8101/8168 go with a plain 8 bytes alignment. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 9c49d910c06d..a6fea192ffff 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1490,7 +1490,7 @@ static const struct rtl_cfg_info {
1490 [RTL_CFG_0] = { 1490 [RTL_CFG_0] = {
1491 .hw_start = rtl_hw_start_8169, 1491 .hw_start = rtl_hw_start_8169,
1492 .region = 1, 1492 .region = 1,
1493 .align = NET_IP_ALIGN, 1493 .align = 2,
1494 .intr_event = SYSErr | LinkChg | RxOverflow | 1494 .intr_event = SYSErr | LinkChg | RxOverflow |
1495 RxFIFOOver | TxErr | TxOK | RxOK | RxErr, 1495 RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
1496 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow 1496 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow
@@ -2649,8 +2649,7 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc)
2649} 2649}
2650 2650
2651static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size, 2651static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
2652 struct pci_dev *pdev, dma_addr_t addr, 2652 struct pci_dev *pdev, dma_addr_t addr)
2653 unsigned int align)
2654{ 2653{
2655 struct sk_buff *skb; 2654 struct sk_buff *skb;
2656 bool done = false; 2655 bool done = false;
@@ -2658,12 +2657,12 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
2658 if (pkt_size >= rx_copybreak) 2657 if (pkt_size >= rx_copybreak)
2659 goto out; 2658 goto out;
2660 2659
2661 skb = dev_alloc_skb(pkt_size + align); 2660 skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN);
2662 if (!skb) 2661 if (!skb)
2663 goto out; 2662 goto out;
2664 2663
2665 pci_dma_sync_single_for_cpu(pdev, addr, pkt_size, PCI_DMA_FROMDEVICE); 2664 pci_dma_sync_single_for_cpu(pdev, addr, pkt_size, PCI_DMA_FROMDEVICE);
2666 skb_reserve(skb, (align - 1) & (unsigned long)skb->data); 2665 skb_reserve(skb, NET_IP_ALIGN);
2667 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); 2666 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size);
2668 *sk_buff = skb; 2667 *sk_buff = skb;
2669 done = true; 2668 done = true;
@@ -2732,8 +2731,7 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
2732 2731
2733 rtl8169_rx_csum(skb, desc); 2732 rtl8169_rx_csum(skb, desc);
2734 2733
2735 if (rtl8169_try_rx_copy(&skb, pkt_size, pdev, addr, 2734 if (rtl8169_try_rx_copy(&skb, pkt_size, pdev, addr)) {
2736 tp->align)) {
2737 pci_dma_sync_single_for_device(pdev, addr, 2735 pci_dma_sync_single_for_device(pdev, addr,
2738 pkt_size, PCI_DMA_FROMDEVICE); 2736 pkt_size, PCI_DMA_FROMDEVICE);
2739 rtl8169_mark_to_asic(desc, tp->rx_buf_sz); 2737 rtl8169_mark_to_asic(desc, tp->rx_buf_sz);