From nobody@FreeBSD.org  Sun Apr 13 23:22:26 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 6EFA5482
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Apr 2014 23:22:26 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 40F1D1259
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Apr 2014 23:22:26 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s3DNMQOV076520
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Apr 2014 23:22:26 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s3DNMQmU076513;
	Sun, 13 Apr 2014 23:22:26 GMT
	(envelope-from nobody)
Message-Id: <201404132322.s3DNMQmU076513@cgiserv.freebsd.org>
Date: Sun, 13 Apr 2014 23:22:26 GMT
From: Adrian Chadd <adrian@freebsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [ath] traffic hangs in station mode when downgrading from AMPDU TX or reassociating
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         188576
>Category:       kern
>Synopsis:       [ath] traffic hangs in station mode when downgrading from AMPDU TX or reassociating
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-wireless
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 13 23:30:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Sun Apr 13 23:36:12 UTC 2014
>Originator:     Adrian Chadd
>Release:        HEAD
>Organization:
>Environment:
FreeBSD lucy-11i386 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r263418M: Tue Apr  1 11:33:21 PDT 2014     adrian@lucy-11i386:/usr/home/adrian/work/freebsd/head/obj/usr/home/adrian/work/freebsd/head/src/sys/LUCY_11_i386  i386

>Description:
Whenever an ath(4) 11n station reassociates or downgrades from aggregation to no aggregation, there's a chance that it'll hang and refuse to queue more frames.

The session needs to be fully torn down (eg ifconfig wlanX down) for things to go back to normal.
>How-To-Repeat:

>Fix:
I actually have debugged this a little already.

So the problem seems to be that there's more than one entry point into ath_tx_tid_cleanup(). It's likely a couple of calls into the reassociation path or one into reassociate and one into aggregation teardown. I'll go figure that bit out soon.

But what it leads to is thus:

* the caller causes ath_tx_tid_pause();
* ath_tx_tid_cleanup() is called;
* the first time this happens it sees there's 1 or more frames to cleanup, so it sets tid->cleanup_inprogress;
* the caller then checks if that's set to 1 - if so, it assumes that it should wait until the cleanup is finished;
* otherwise it calls ath_tx_tid_resume().

If tid->cleanup_inprogress is set to 1 then the normal TX completion path will eventually call ath_tx_comp_cleanup_unaggr() or ath_tx_comp_cleanup_aggr() which will clear the flag and resume the TID.

If a second path through ath_tx_tid_cleanup() occurs, then:

* the caller pauses;
* ath_tx_tid_cleanup() is called;
* tid->cleanup_inprogress is set to 1, but there's no code to check whether this call actually set it or not - so it doesn't call ath_tx_tid_resume().

So once the frames complete and ath_tx_tid_resume() is called, there's still a pending paused reference and thus traffic never continues flowing.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-wireless 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Apr 13 23:36:00 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=188576 
>Unformatted:
