From owner-p4-projects@FreeBSD.ORG Fri Dec 3 06:10:35 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0D4A416A4D0; Fri, 3 Dec 2004 06:10:35 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC29116A4CE for ; Fri, 3 Dec 2004 06:10:34 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91A0843D6A for ; Fri, 3 Dec 2004 06:10:34 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iB36ATil040355 for ; Fri, 3 Dec 2004 06:10:29 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iB36ATVn040352 for perforce@freebsd.org; Fri, 3 Dec 2004 06:10:29 GMT (envelope-from sam@freebsd.org) Date: Fri, 3 Dec 2004 06:10:29 GMT Message-Id: <200412030610.iB36ATVn040352@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 66299 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Dec 2004 06:10:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=66299 Change 66299 by sam@sam_ebb on 2004/12/03 06:09:57 support dtim period other than 1 Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#37 edit .. //depot/projects/wifi/sys/net80211/ieee80211.c#13 edit .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#23 edit .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#14 edit .. //depot/projects/wifi/sys/net80211/ieee80211_output.c#20 edit .. //depot/projects/wifi/sys/net80211/ieee80211_var.h#15 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#37 (text+ko) ==== @@ -1904,7 +1904,7 @@ * Enable the CAB queue before the beacon queue to * insure cab frames are triggered by this beacon. */ - if (ncabq) + if (sc->sc_boff.bo_tim[4] & 1) /* NB: only at DTIM */ ath_hal_txstart(ah, sc->sc_cabq->axq_qnum); ath_hal_puttxbuf(ah, sc->sc_bhalq, bf->bf_daddr); ath_hal_txstart(ah, sc->sc_bhalq); ==== //depot/projects/wifi/sys/net80211/ieee80211.c#13 (text+ko) ==== @@ -170,6 +170,7 @@ if (ic->ic_lintval == 0) ic->ic_lintval = 100; /* default sleep */ ic->ic_bmisstimeout = 7*ic->ic_lintval; /* default 7 beacons */ + ic->ic_dtim_period = IEEE80211_DTIM_DEFAULT; IEEE80211_BEACON_LOCK_INIT(ic, "beacon"); ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX; ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#23 (text+ko) ==== @@ -1435,6 +1435,9 @@ case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ error = ieee80211_ioctl_getwmeparam(ic, ireq); break; + case IEEE80211_IOC_DTIM_PERIOD: + ireq->i_val = ic->ic_dtim_period; + break; default: error = EINVAL; break; @@ -2248,6 +2251,15 @@ case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ error = ieee80211_ioctl_setwmeparam(ic, ireq); break; + case IEEE80211_IOC_DTIM_PERIOD: + if (IEEE80211_DTIM_MIN < ireq->i_val && + ireq->i_val <= IEEE80211_DTIM_MAX) { + IEEE80211_BEACON_LOCK(ic); + ic->ic_dtim_period = ireq->i_val; + IEEE80211_BEACON_UNLOCK(ic); + } else + error = EINVAL; + break; default: error = EINVAL; break; ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#14 (text+ko) ==== @@ -419,6 +419,7 @@ #define IEEE80211_IOC_WME_TXOPLIMIT 49 /* WME: txops limit */ #define IEEE80211_IOC_WME_ACM 50 /* WME: ACM (bss only) */ #define IEEE80211_IOC_WME_ACKPOLICY 51 /* WME: ACK policy (!bss only)*/ +#define IEEE80211_IOC_DTIM_PERIOD 52 /* DTIM period */ /* * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS. ==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#20 (text+ko) ==== @@ -1518,8 +1518,19 @@ "%s: TIM updated, pending %u, off %u, len %u\n", __func__, ic->ic_ps_pending, timoff, timlen); } + /* count down DTIM period */ + if (bo->bo_tim[2] == 0) { + /* + * NB: update both from ic_dtim_period + * so we automatically collect any + * new DTIM period. + */ + bo->bo_tim[2] = ic->ic_dtim_period - 1; + bo->bo_tim[3] = ic->ic_dtim_period; + } else + bo->bo_tim[2]--; /* update TIM state regarding buffered multicast frames */ - if (mcast) + if (mcast && (bo->bo_tim[2] == 1 || bo->bo_tim[3] == 1)) bo->bo_tim[4] |= 1; else bo->bo_tim[4] &= ~1; ==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#15 (text+ko) ==== @@ -61,6 +61,10 @@ #define IEEE80211_TXPOWER_MAX 100 /* .5 dbM (XXX units?) */ #define IEEE80211_TXPOWER_MIN 0 /* kill radio */ +#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ +#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ +#define IEEE80211_DTIM_DEFAULT 8 /* default DTIM period */ + #define IEEE80211_PS_SLEEP 0x1 /* STA is in power saving mode */ #define IEEE80211_PS_MAX_QUEUE 50 /* maximum saved packets */ @@ -113,7 +117,8 @@ u_int16_t ic_ps_sta; /* stations in power save */ u_int16_t ic_ps_pending; /* ps sta's w/ pending frames */ u_int8_t *ic_tim_bitmap; /* power-save stations w/ data*/ - u_int ic_tim_len; /* ic_tim_bitmap size (bytes) */ + u_int16_t ic_tim_len; /* ic_tim_bitmap size (bytes) */ + u_int16_t ic_dtim_period; /* DTIM period */ struct ifmedia ic_media; /* interface media config */ struct bpf_if *ic_rawbpf; /* packet filter structure */ struct ieee80211_node *ic_bss; /* information for this node */