Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 2008 08:15:17 GMT
From:      Joseph Lee <nugundam@nugundam.best.vwh.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/124753: net80211 discards power-save queue packets early
Message-ID:  <200806190815.m5J8FHI4067329@www.freebsd.org>
Resent-Message-ID: <200806190820.m5J8K1a2006696@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <interface> +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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806190815.m5J8FHI4067329>