public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hao <kexin.hao@windriver.com>
To: linux-kernel@vger.kernel.org
Cc: jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,
	bruce.w.allan@intel.com, john.ronciak@intel.com,
	dacker@roinet.com, e1000-devel@lists.sourceforge.net,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-net@vger.kernel.org
Subject: [PATCH] e100: Do pci_dma_sync after skb_alloc for proper operation on ixp4xx
Date: Sat, 21 Jun 2008 18:20:35 +0800	[thread overview]
Message-ID: <1214043635.12484.8.camel@hkx> (raw)

Hi,

The E100 device can't work on current kernel (2.6.26-rc6) and will cause
kernel corruption on intel ixdp4xx. This patch fix this regression.

---
commit c1f24812b9de182a4272724a2e84ea1ae5dd4659
Author: Kevin Hao <kexin.hao@windriver.com>
Date:   Sat Jun 21 16:50:50 2008 +0800

    e100: Do pci_dma_sync after skb_alloc for proper operation on ixp4xx
    
    Do a DMA sync after we've allocated a new skb and link it with the previous
    RFD.  Otherwise the previous RFD may reference the previously freed skb
    and cause kernel corruption.
    
    Previously there was such a DMA sync at this place, but it was removed
    by commit 7734f6e6bcd7ba78b00e93e74a4ddafd9886cdea.
    Restoring this sync operation eliminates the regression.
    
    Signed-off-by: Kevin Hao <kexin.hao@windriver.com>

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index f3cba5e..1037b13 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1803,6 +1803,8 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 	if (rx->prev->skb) {
 		struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
 		put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
+		pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
+			sizeof(struct rfd), PCI_DMA_TODEVICE);
 	}
 
 	return 0;
---

Best Regards,
Kevin


             reply	other threads:[~2008-06-21 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-21 10:20 Kevin Hao [this message]
2008-06-22  1:51 ` [PATCH] e100: Do pci_dma_sync after skb_alloc for proper operation on ixp4xx David Acker
2008-06-27  5:32 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1214043635.12484.8.camel@hkx \
    --to=kexin.hao@windriver.com \
    --cc=bruce.w.allan@intel.com \
    --cc=dacker@roinet.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox