On Thursday 12 November 2009 13:16:31 Andrew Benton wrote:
> On 12/11/09 00:37, Larry Finger wrote:
> > Andy,
> >
> > Please try the patch below to see what we can learn from the DMA descriptor
> > errors. Some of this code is temporary, but there are also some statements 
> > that
> > will probably become permanent.
> >
> > Please post any messages that result.
> 
> The patch failed

Larry had an outdated tree.
This patch applies against wireless-testing:

>From [email protected] Thu Nov 12 01:37:32 2009
Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Thu, 12 Nov 2009 00:38:24 +0000
Received: by vs166246.vserver.de with esmtp (Exim 4.69)
        id 1N8Nhg-0000zK-T1
        for [email protected]; Thu, 12 Nov 2009 00:38:24 +0000
Received: from bat.berlios.de (localhost [127.0.0.1])
        by mail.berlios.de (Postfix) with ESMTP id 2A1D719E79B;
        Thu, 12 Nov 2009 01:38:05 +0100 (CET)
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from mail-yx0-f174.google.com (mail-yx0-f174.google.com
        [209.85.210.174])
        by mail.berlios.de (Postfix) with ESMTP id 22BCAB3811
        for <[email protected]>;
        Thu, 12 Nov 2009 01:37:35 +0100 (CET)
Received: by yxe4 with SMTP id 4so1496946yxe.32
        for <[email protected]>;
        Wed, 11 Nov 2009 16:37:34 -0800 (PST)
Received: by 10.90.10.9 with SMTP id 9mr3391390agj.69.1257986254045;
        Wed, 11 Nov 2009 16:37:34 -0800 (PST)
Received: from ?192.168.2.217? ([65.28.92.235])
        by mx.google.com with ESMTPS id 4sm1044525yxd.70.2009.11.11.16.37.32
        (version=SSLv3 cipher=RC4-MD5); Wed, 11 Nov 2009 16:37:33 -0800 (PST)
Message-ID: <[email protected]>
Date: Wed, 11 Nov 2009 18:37:32 -0600
From: Larry Finger <[email protected]>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
        rv:1.9.1.4pre) Gecko/20090915 SUSE/3.0b4-3.6 Thunderbird/3.0b4
MIME-Version: 1.0
To: Andrew Benton <[email protected]>
Subject: Re: b43-phy0 ERROR: Fatal DMA error: 0x00000400
References: <[email protected]>
In-Reply-To: <[email protected]>
Cc: [email protected],
 Michael Buesch <[email protected]>
X-BeenThere: [email protected]
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bcm43xx-dev.lists.berlios.de>
List-Unsubscribe: <https://lists.berlios.de/mailman/listinfo/bcm43xx-dev>,
        <mailto:[email protected]?subject=unsubscribe>
List-Archive: <https://lists.berlios.de/pipermail/bcm43xx-dev>
List-Post: <mailto:[email protected]>
List-Help: <mailto:[email protected]?subject=help>
List-Subscribe: <https://lists.berlios.de/mailman/listinfo/bcm43xx-dev>,
        <mailto:[email protected]?subject=subscribe>
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: [email protected]
Errors-To: [email protected]
X-Length: 6628
X-UID: 8122

Andy,

Please try the patch below to see what we can learn from the DMA descriptor
errors. Some of this code is temporary, but there are also some statements that
will probably become permanent.

Please post any messages that result.

Larry


---
 drivers/net/wireless/b43/dma.c  |   32 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/b43/dma.h  |    1 +
 drivers/net/wireless/b43/main.c |    1 +
 3 files changed, 34 insertions(+)

--- wireless-testing.orig/drivers/net/wireless/b43/dma.c
+++ wireless-testing/drivers/net/wireless/b43/dma.c
@@ -46,6 +46,8 @@
  * into separate slots. */
 #define TX_SLOTS_PER_FRAME     2
 
+int dma_point = 0;
+struct b43_dmadesc_generic dma_desc_save[20];
 
 /* 32bit DMA ops. */
 static
@@ -190,6 +192,12 @@ static void op64_fill_descriptor(struct 
        desc->dma64.control1 = cpu_to_le32(ctl1);
        desc->dma64.address_low = cpu_to_le32(addrlo);
        desc->dma64.address_high = cpu_to_le32(addrhi);
+       dma_desc_save[dma_point].dma64.control0 = desc->dma64.control0;
+       dma_desc_save[dma_point].dma64.control1 = desc->dma64.control1;
+       dma_desc_save[dma_point].dma64.address_low = desc->dma64.address_low;
+       dma_desc_save[dma_point].dma64.address_high = desc->dma64.address_high;
+       if (++dma_point >= 20)
+               dma_point = 0;
 }
 
 static void op64_poke_tx(struct b43_dmaring *ring, int slot)
@@ -1216,8 +1224,11 @@ static int dma_tx_fragment(struct b43_dm
        meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
        /* create a bounce buffer in zone_dma on mapping failure. */
        if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
+               printk(KERN_INFO "b43: Using bounce buffer\n");
                priv_info->bouncebuffer = kmalloc(skb->len, GFP_ATOMIC | 
GFP_DMA);
                if (!priv_info->bouncebuffer) {
+                       b43warn(ring->dev->wl, "Bounce buffer allocation "
+                               "failed\n");
                        ring->current_slot = old_top_slot;
                        ring->used_slots = old_used_slots;
                        err = -ENOMEM;
@@ -1227,6 +1238,8 @@ static int dma_tx_fragment(struct b43_dm
 
                meta->dmaaddr = map_descbuffer(ring, priv_info->bouncebuffer, 
skb->len, 1);
                if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
+                       b43warn(ring->dev->wl, "DMA mapping error for bounce "
+                               "buffer\n");
                        kfree(priv_info->bouncebuffer);
                        priv_info->bouncebuffer = NULL;
                        ring->current_slot = old_top_slot;
@@ -1612,6 +1625,25 @@ void b43_dma_tx_resume(struct b43_wldev 
        b43_power_saving_ctl_bits(dev, 0);
 }
 
+void b43_dump_desc_buffer(void)
+{
+       /* dump the descriptor buffer once */
+       int i, j = dma_point;
+       static int once = 0;
+
+       if (once)
+               return;
+       printk(KERN_INFO "b43: Dump of last 20 DMA descriptors\n");
+       for (i = 0; i < 20; i++) {
+               if (--j < 0)
+                       j = 19;
+               printk(KERN_INFO "b43: Descr. %2d: 0x%x 0x%X 0x%X 0x%X\n", i,
+                      dma_desc_save[j].dma64.control0, 
dma_desc_save[j].dma64.control1,
+                      dma_desc_save[j].dma64.address_low, 
dma_desc_save[j].dma64.address_high);
+       }
+       once++;
+}
+
 #ifdef CONFIG_B43_PIO
 static void direct_fifo_rx(struct b43_wldev *dev, enum b43_dmatype type,
                           u16 mmio_base, bool enable)
--- wireless-testing.orig/drivers/net/wireless/b43/dma.h
+++ wireless-testing/drivers/net/wireless/b43/dma.h
@@ -287,4 +287,5 @@ void b43_dma_rx(struct b43_dmaring *ring
 void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
                            unsigned int engine_index, bool enable);
 
+void b43_dump_desc_buffer(void);
 #endif /* B43_DMA_H_ */
--- wireless-testing.orig/drivers/net/wireless/b43/main.c
+++ wireless-testing/drivers/net/wireless/b43/main.c
@@ -1785,6 +1785,7 @@ static void b43_do_interrupt_thread(stru
                               dma_reason[2], dma_reason[3],
                               dma_reason[4], dma_reason[5]);
                        b43_controller_restart(dev, "DMA error");
+                       b43_dump_desc_buffer();
                        return;
                }
                if (merged_dma_reason & B43_DMAIRQ_NONFATALMASK) {

-- 
Greetings, Michael.
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to