From owner-freebsd-mips@freebsd.org Thu Oct 29 21:15:20 2015 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9FC2A202D0 for ; Thu, 29 Oct 2015 21:15:20 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D9C11518 for ; Thu, 29 Oct 2015 21:15:19 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221]) by hz.grosbein.net (8.14.9/8.14.9) with ESMTP id t9TLF7Yj042952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 29 Oct 2015 22:15:08 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: adrian.chadd@gmail.com Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id t9TLF05k035281; Fri, 30 Oct 2015 04:15:01 +0700 (KRAT) (envelope-from eugen@grosbein.net) Subject: Re: arge1 on TL WDR3600 To: Adrian Chadd References: <562CBEC3.8030308@rdtc.ru> <562E3027.4020806@grosbein.net> <562F75E2.9000505@grosbein.net> <5630E844.2080807@grosbein.net> <56321ED9.4050602@grosbein.net> <56323496.609@grosbein.net> <56325769.8070202@grosbein.net> Cc: "freebsd-mips@freebsd.org" From: Eugene Grosbein X-Enigmail-Draft-Status: N1110 Message-ID: <56328C54.1050709@grosbein.net> Date: Fri, 30 Oct 2015 04:15:00 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM autolearn=no version=3.3.2 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on hz.grosbein.net X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2015 21:15:20 -0000 On 30.10.2015 01:41, Adrian Chadd wrote: > AH, ok. So it says TX_UNDERRUN + TX_PKT_SENT. So hm. > > The way this is supposed to work is .. odd. > > You queue TX packets to the hardware. The hardware increments > TXPKTCOUNT in the TX DMA status register. > > Then for each packet you see transmitted, you write TXPKTSENT to the > TX DMA status register and that decrements TXPKTCOUNT. Once it's zero, > you won't see any more TX interrupts. > > Now, the 'arge_tx_cnt' value tracks that; it should be zero if it's > idle. It's 126, which means there are still things to process. there's > 128 ring slots, so that prod/cons value indicates there's 126 things > in the ring. arge_tx_locked() does the decrementing and poking > TXPKTSENT. > > So, I bet the driver and hardware is out of sync. I bet that the (ctrl > & ARGE_DESC_EMPTY) check is triggering on the current frame in that > ring. I don't know if it's because prod/cons are out of whack, or it's > currently trying to check a descriptor in a multi-frame TX descriptor, > or whether the hardware is just plain buggy and it didn't update that. > But, that's actually what's going on. > > So that's my 5 minute analysis of it. I wish I could reproduce it on > what I have here because then I could see what the state of the ring > is and whether the hardware is buggy or our tx prod/cons tracking is > busted. I'd reaally appreciate help here :( I do not think that hardware is buggy because several versions of "official" TP-Link firmware work just fine with this particular device and earlier versions of FreeBSD 11 also work without interrupt storms. In fact, I've applied dichotomy and found guilty commit. It took 12 iterations but here is it: kernel built using head at r289897 runs my test without a storm (but forwarding speed is pretty bad) and kernel built with r289898 or later revisions has interrupt storm. This is the change: https://svnweb.freebsd.org/base/head/sys/mips/atheros/if_arge.c?r1=289744&r2=289898&view=patch My device has hw.model: Atheros AR9344 rev 2