From owner-freebsd-net@FreeBSD.ORG Sun Dec 5 06:32:48 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 582881065670 for ; Sun, 5 Dec 2010 06:32:48 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id DC6C08FC1C for ; Sun, 5 Dec 2010 06:32:47 +0000 (UTC) Received: by wwf26 with SMTP id 26so6716948wwf.31 for ; Sat, 04 Dec 2010 22:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=hW4G3U4sgFL2tbG0soLtXFpMmEuxZ8jhoH6Ie+gGEOk=; b=U9/Mmb/Q3GPhM+yYzWl+c1uWPV7Vk97MXaTBQhKjNMFBzBG2GkgEMrbGvwZXkx0RfR TJAb9VIUe1C4lYfsYKG3lPZHI62wl6LC6YtW1VRoiGQ6j77XqUnVDGVv5oP7lR9v3u4x TL+8KjchW4+kJdl/n0GktbDfX/3Wzg/Le8eBQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=lNQmdhcrJl0kIBI3cWSZNOv/SJw8FpdloVnZ9Rrxwl2k/VHwgnRFdQyE5JgLWqNalV oNHbznAosXYqFo+EbnFc8k1cSkd0eKOVOt+pe2Xvgj8Kcidhvnwrb2erETyy6UV3Tkz+ 8QGAvI1ZAi+JBiSDafAjfXfN2OUsGd8hjjCj4= MIME-Version: 1.0 Received: by 10.216.191.210 with SMTP id g60mr3614762wen.5.1291530766844; Sat, 04 Dec 2010 22:32:46 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.65.210 with HTTP; Sat, 4 Dec 2010 22:32:46 -0800 (PST) In-Reply-To: References: <201012021530.oB2FUEh1034901@freefall.freebsd.org> Date: Sun, 5 Dec 2010 14:32:46 +0800 X-Google-Sender-Auth: ojhfpIwxpcBqDYatPRl75Qp8f8c Message-ID: From: Adrian Chadd To: =?KOI8-R?B?6M/S1dbJyiDzxdLHxcog4NLYxdfJ3g==?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: kern/124753: [ieee80211] net80211 discards power-save queue packets early X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Dec 2010 06:32:48 -0000 Right, the problem here is: * the listen interval advertised by the device is "1". The math here is: age =3D IEEE80211_TU_TO_MS((ni->ni_intval * ic->ic_bintval) << 2) /= 1000; * the default beacon interval is 100 TU's. * (1 * 100) << 2 =3D=3D 400 TU's * It then is converted up to milliseconds - * 1024 / 1000, so just for arguments sake say "400" * then that's divided by 1000 to get age in seconds - which results in 0 * thus the packets are immediately discarded in the next call to ieee80211_node_psq_age() Does this always happen? From what I can tell, the code path to actually calling ieee80211_node_psq_age() goes via the callout ieee80211_node_timeout(), which is called every IEEE80211_INACT_WAIT seconds (15). Unless something else is calling ieee80211_node_timeout() more frequently. Can you add some debugging into ieee80211_node_timeout() and find out how often it's actually being called? If the above is actually happening, it should only be being called every 15 seconds and thus the chances of it occuring just as you have some age=3D0 frames on the ps queue should be pretty low. I think it's worthwhile fixing what "age" is, but I guess that'll have to come later. Thanks, Adrian 2010/12/5 Adrian Chadd : > I've done a bit of digging with this in private, would you (and others > having this problem) please re-test with this patch: > > [adrian@pcbsd-3114]/data/freebsd/git/adrianchadd-freebsd/sys/net80211(48)= % > git diff . > diff --git a/sys/net80211/ieee80211_power.c b/sys/net80211/ieee80211_powe= r.c > index aad82ba..a9d8eff 100644 > --- a/sys/net80211/ieee80211_power.c > +++ b/sys/net80211/ieee80211_power.c > @@ -393,7 +393,7 @@ ieee80211_pwrsave(struct ieee80211_node *ni, struct m= buf *m) > =A0 =A0 =A0 =A0IEEE80211_PSQ_UNLOCK(psq); > > =A0 =A0 =A0 =A0IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, > - =A0 =A0 =A0 =A0 =A0 "save frame with age %d, %u now queued", age, qlen)= ; > + =A0 =A0 =A0 =A0 =A0 "save frame with age %d, %u now queued (intval=3D%d= , > bintval=3D%d)", age, qlen, ni->ni_intval, ic->ic_bintval); > > =A0 =A0 =A0 =A0if (qlen =3D=3D 1 && vap->iv_set_tim !=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vap->iv_set_tim(ni, 1); > > I'd like to see exactly what's going on there; age=3D0 looks very wrong. > > > > Adrian >