From patchwork Thu May 10 10:30:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: kabe@sra-tohoku.co.jp X-Patchwork-Id: 10391617 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EBBD6053D for ; Thu, 10 May 2018 10:31:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C943289E8 for ; Thu, 10 May 2018 10:31:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F1E5289EB; Thu, 10 May 2018 10:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CF2F289E8 for ; Thu, 10 May 2018 10:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934760AbeEJKbB (ORCPT ); Thu, 10 May 2018 06:31:01 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:40704 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934517AbeEJKbA (ORCPT ); Thu, 10 May 2018 06:31:00 -0400 Received: by mail-it0-f67.google.com with SMTP id j186-v6so2502496ita.5 for ; Thu, 10 May 2018 03:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sra-tohoku-co-jp.20150623.gappssmtp.com; s=20150623; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-transfer-encoding; bh=Yl9Hm4VrlFBYPdw6jvmZeXDCGAkX487UPb2UPYk+inA=; b=FXY44jNjBua/wW+/AIz7wreXXqRVK+B9CCvG3w/ZtK+1j7stfCrWtaPJDx+8ZTw4HM ALsFWxYr+rKQ3ifHQF+HnGTBfTsejRek41eb0RKl+vQq0o65K51Rgn2YQ5mYNrq6pVJ3 5/oG/O0w5l5DBvCGcCs3DBQFH7sEe/aBUVEnIeuyMirOu09OjPo6H28Yr1kvnpqKVk0C GONprF9fAgJNvRaYr+P8ppfuno3iQDhbI/L/yr/8FVy2u8M7YJXnbGxmmm0YjUU38Ax6 j1K9Is/CchoFUammGRdu+Drh7pngbVIM/2hywdK9QGcRVRMF8WYkrhtZkr+vsqzI4Ffr WC7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-transfer-encoding; bh=Yl9Hm4VrlFBYPdw6jvmZeXDCGAkX487UPb2UPYk+inA=; b=SMYnnA41DgqnSmYufjgXgDoH9z8pjk1sXhOhUK6SvNzKkzXBPf7jqPjfu66o2dYUIl O1f6hWlHZScpewp8y8VdIibS1/yiAlz4SpkW8by+4UhN2EQL+8BGoAQ1zIiVR5SUHFaK aOXgRyECINAHJF3E55lpjBYHgcXWc7r0USSaD4ayWW26F1Z+uW78bQ5vp2I3V3qduzB4 ibQrRS7U2NH+bFznfvRPkMykiGtRZHjzzTlzrfsq5j1LQKAy1lSqsYvbZ0vPOf7ULWDa B2VeFMsfMH/3HtNyoux73H5ofkxehzZT9wEmPkaY6Wj+bVRSASpi3M0eZCY2wWvK8B5a Qmxw== X-Gm-Message-State: ALKqPwdKzEqsH682iX3kTx3o6JMdCWpuQWNjU0WDzgzvC5ZoW0BEhJkn 0F3lt388u5j6jRDyO1Dm9Rjljg== X-Google-Smtp-Source: AB8JxZoiMd8S6cqJ2r2LxjX4uNH/0L2zS58oaQFTZhAERnWpye4m82Yk39EauvjRZoxhLKENk6M6rg== X-Received: by 2002:a24:9d95:: with SMTP id f143-v6mr1164158itd.150.1525948259454; Thu, 10 May 2018 03:30:59 -0700 (PDT) Received: from [10.5.0.101] (w0109-49-135-20-237.uqwimax.jp. [49.135.20.237]) by smtp.googlemail.com with ESMTPSA id r9-v6sm199906ioa.49.2018.05.10.03.30.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 03:30:58 -0700 (PDT) Message-ID: <5AF41F55.4060606@sra-tohoku.co.jp> Date: Thu, 10 May 2018 19:30:45 +0900 From: Taketo Kabe User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: b43-dev@lists.infradead.org CC: kabe@sra-tohoku.co.jp, linux-wireless@vger.kernel.org, kvalo@codeaurora.org Subject: [PATCH v2] drivers/net/wireless/broadcom/b43: fix transmit failure when VT is switched References: <5AF2DE73.20608@sra-tohoku.co.jp> <20180509185101.0888bd7a@wiggum> In-Reply-To: <20180509185101.0888bd7a@wiggum> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Taketo Kabe Fix for b43 wireless card stopping transmission when switching VTs. Setup: Using BCM4306 rev.03 chip based CardBus wireless card. IRQ is shared with yenta (cardbus bridge) and i915 (display) driver. For firmware, installed latest but dated openfwwf 5.2 (http://netweb.ing.unibs.it/~openfwwf/) How-to-reproduce: Do "ssh ", then "ls -lR /" to generate traffic, then repeatedly switch VTs by Alt-F1<>Alt-F2. Eventually (within a minute) the card stops working. You can receive traffic but no transmission. For unknown reason it doesn't occur when just generating traffic by "ssh ls -lR /". With CONFIG_B43_DEBUG=y kernel config, when it stops, the debug message shows kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 148, but got 180 The slot offset I observed so far was always 32. When err_out2 is not set to make error messages successive, the debug output will be like this: kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 148 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 150 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 120 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 152 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 122 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 154 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 124 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 156 kernel: b43-phy1 debug: Out of order TX status report on DMA ring 1. Expected 116, but got 126 The TX ring alternates between 2 sequences; the ring seems to be completely confused. Controller restart is needed. Workaround(1): This problem doesn't occur when using propriatory firmware you will extract by b43-fwcutter, so it may be a bug in openfwwf firmware, as the comment in the b43_dma_handle_txstatus() suggests. I wasn't able to find a bug in the terse openfwwf code though. Workaround(2): Using "pio=1" option to not use DMA makes this problem to not occur. Description of the patch: This patch will forcibly reset the controller to make it work again. Very kludgy and doesn't look right, but the traffic will continue to flow. Changes since last edition: - Remove now unused err_out2 variable. Signed-off-by: Taketo Kabe Reviewed-by: Michael Büsch diff -up ./drivers/net/wireless/broadcom/b43/dma.c.b43 ./drivers/net/wireless/broadcom/b43/dma.c --- ./drivers/net/wireless/broadcom/b43/dma.c.b43 2018-05-04 15:18:12.000000000 +0900 +++ ./drivers/net/wireless/broadcom/b43/dma.c 2018-05-10 18:46:36.000000000 +0900 @@ -1484,7 +1484,7 @@ void b43_dma_handle_txstatus(struct b43_ int slot, firstused; bool frame_succeed; int skip; - static u8 err_out1, err_out2; + static u8 err_out1; ring = parse_cookie(dev, status->cookie, &slot); if (unlikely(!ring)) @@ -1518,13 +1518,13 @@ void b43_dma_handle_txstatus(struct b43_ } } else { /* More than a single header/data pair were missed. - * Report this error once. + * Report this error, and reset the controller to + * revive operation. */ - if (!err_out2) - b43dbg(dev->wl, - "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", - ring->index, firstused, slot); - err_out2 = 1; + b43dbg(dev->wl, + "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", + ring->index, firstused, slot); + b43_controller_restart(dev, "Out of order TX"); return; } }