From patchwork Sun Aug 23 20:43:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Halasa X-Patchwork-Id: 31888 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 985B9B7B80 for ; Mon, 24 Aug 2009 06:44:02 +1000 (EST) Received: by ozlabs.org (Postfix) id 88699DDD0C; Mon, 24 Aug 2009 06:44:02 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 1B1A0DDD01 for ; Mon, 24 Aug 2009 06:44:02 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934048AbZHWUnh (ORCPT ); Sun, 23 Aug 2009 16:43:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934105AbZHWUng (ORCPT ); Sun, 23 Aug 2009 16:43:36 -0400 Received: from khc.piap.pl ([195.187.100.11]:32923 "EHLO khc.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934078AbZHWUng convert rfc822-to-8bit (ORCPT ); Sun, 23 Aug 2009 16:43:36 -0400 Received: from intrepid.localdomain (intrepid.localdomain [10.0.0.2]) by khc.piap.pl (Postfix) with ESMTP id 5DC2D931F; Sun, 23 Aug 2009 22:43:30 +0200 (CEST) To: Walt Holman Cc: netdev@vger.kernel.org, jeffrey t kirsher , jesse brandeburg , bruce w allan , peter p waskiewicz jr , john ronciak , David Miller Subject: Re: E100 RX ring buffers continued... References: <1288246454.81251051629969.JavaMail.root@mail.holmansrus.com> From: Krzysztof Halasa Date: Sun, 23 Aug 2009 22:43:29 +0200 In-Reply-To: <1288246454.81251051629969.JavaMail.root@mail.holmansrus.com> (Walt Holman's message of "Sun\, 23 Aug 2009 13\:20\:29 -0500 \(CDT\)") Message-ID: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Walt Holman writes: > I've tested this under 2.6.31-rc7 (which was also broken to begin > with) and this appears to have fixed it. It's a fairly limited test > at this point, as I've just been downloading a large file for the past > 15 mins. or so, but this was normally enough to have multiple > stoppages. Do you still need 2.6.30.5 tested as well? No, these tests and the drivers in both versions are equivalent. Thanks a lot. David, I think it's safe to apply this. Probably to "stable" series, too. I think at least this should theoretically be changed as well: e100_rx_indicate() ... /* Need to sync before taking a peek at cb_complete bit */ pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr, sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); rfd_status = le16_to_cpu(rfd->status); but since it appears to work I wouldn't touch it ATM. I guess the swiotlb code is smart enough to not write to device-owner memory on for_cpu() call. ... E100: fix interaction with swiotlb on X86. E100 places it's RX packet descriptors inside skb->data and uses them with bidirectional streaming DMA mapping. Data in descriptors is accessed simultaneously by the chip (writing status and size when a packet is received) and CPU (reading to check if the packet was received). This isn't a valid usage of PCI DMA API, which requires use of the coherent (consistent) memory for such purpose. Unfortunately e100 chips working in "simplified" RX mode have to store received data directly after the descriptor. Fixing the driver to conform to the API would require using unsupported "flexible" RX mode or receiving data into a coherent memory and using CPU to copy it to network buffers. This patch, while not yet making the driver conform to the PCI DMA API, allows it to work correctly on X86 with swiotlb (while not breaking other architectures). Signed-off-by: Krzysztof HaƂasa diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 014dfb6..53e8252 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1764,7 +1764,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, nic->ru_running = RU_SUSPENDED; pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, sizeof(struct rfd), - PCI_DMA_BIDIRECTIONAL); + PCI_DMA_FROMDEVICE); return -ENODATA; }