From owner-freebsd-i386@FreeBSD.ORG Thu Jun 19 08:20:01 2008 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABF06106564A for ; Thu, 19 Jun 2008 08:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8AC738FC1F for ; Thu, 19 Jun 2008 08:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m5J8K18B006697 for ; Thu, 19 Jun 2008 08:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m5J8K1a2006696; Thu, 19 Jun 2008 08:20:01 GMT (envelope-from gnats) Resent-Date: Thu, 19 Jun 2008 08:20:01 GMT Resent-Message-Id: <200806190820.m5J8K1a2006696@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Joseph Lee Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F071065677 for ; Thu, 19 Jun 2008 08:15:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 044FC8FC2F for ; Thu, 19 Jun 2008 08:15:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m5J8FHZl067330 for ; Thu, 19 Jun 2008 08:15:17 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m5J8FHI4067329; Thu, 19 Jun 2008 08:15:17 GMT (envelope-from nobody) Message-Id: <200806190815.m5J8FHI4067329@www.freebsd.org> Date: Thu, 19 Jun 2008 08:15:17 GMT From: Joseph Lee To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/124753: net80211 discards power-save queue packets early X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2008 08:20:01 -0000 >Number: 124753 >Category: i386 >Synopsis: net80211 discards power-save queue packets early >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 19 08:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Joseph Lee >Release: FreeBSD 7.0-stable >Organization: >Environment: FreeBSD ICEwood.shrikelund.nu 7.0-STABLE FreeBSD 7.0-STABLE #6: Mon Jun 16 04:39:16 PDT 2008 root@ICEwood.shrikelund.nu:/usr/obj/usr/src/sys/ICEWOOD i386 >Description: Using a Windows Mobile 6.1 device in WiFi power-saving mode, and running FreeBSD 7.0-stable in hostap mode with hostapd, there's a discard timing discrepancy. The WM6.1 device recv ps-poll's for packets every 20 seconds, while FreeBSD discards packets out of the queue every 15 seconds. I wonder if it's related to the time interval specified in /usr/src/sys/net80211/ieee80211_node.h which has IEEE80211_INACT_WAIT set at 15 seconds. Looking at ieee80211_power.c, it should be aging frames at: /* * Tag the frame with its expiry time and insert * it in the queue. The aging interval is 4 times * the listen interval specified by the station. * Frames that sit around too long are reclaimed * using this information. */ /* TU -> secs. XXX handle overflow? */ age = IEEE80211_TU_TO_MS((ni->ni_intval * ic->ic_bintval) << 2) / 1000; but queued packets don't seem to last 4 times the 'listen interval'. The end result is WM6.1 device is fully-associated, but it never receives packets, unless it's configured to not use power-saving mode. This has only been a problem with the recent upgrade from FreeBSD 6.2-stable to FreeBSD 7.0-stable. Changing the debugging code, I can see that my ni_interval is 3, ic_bintval is 100, and so after the math: ((3 * 100) << 2) = 1200 TU_TO_MS(1200) = 1200 * 1024 / 1000 = 1228 1228 / 1000 = 1 (age) So age is 1, and every 15 seconds, it decrements 15 from the age. Obviously, this means it discards queued packets every 15 seconds no matter what. I then tried changing the math to TU_TO_MS((3 * 100) * 100) which gives me an age of 30 which then properly gets decremented to 15 after one cycle, and then discarded after that. However, now my WM6.1 device times out before it polls for queued packets. This maybe now be a WM6.1 issue, but this is separate from what looks like a useless formula for queuing packets. Is there a non-hardcoded way to tune this discard interval? >How-To-Repeat: wlandebug -i +power Then associate a recent Windows Mobile 6.1 device to the FreeBSD box running hostapd, and set the WM6.1 device to battery conservation mode. Then try to browse with IE, or Opera. Or, ping the WM6.1 device from the FreeBSD device, and watch how none of the packets ever come back. Changing the formula to *100, instead of <<2, only the first 49 packets are lost. >Fix: >Release-Note: >Audit-Trail: >Unformatted: