From owner-p4-projects@FreeBSD.ORG Tue Dec 7 00:54:45 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BFEFB16A4D0; Tue, 7 Dec 2004 00:54:44 +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 996CF16A4CE for ; Tue, 7 Dec 2004 00:54:44 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69EF043D68 for ; Tue, 7 Dec 2004 00:54:44 +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 iB70siRZ028148 for ; Tue, 7 Dec 2004 00:54:44 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iB70siqY028145 for perforce@freebsd.org; Tue, 7 Dec 2004 00:54:44 GMT (envelope-from sam@freebsd.org) Date: Tue, 7 Dec 2004 00:54:44 GMT Message-Id: <200412070054.iB70siqY028145@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 66597 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: Tue, 07 Dec 2004 00:54:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=66597 Change 66597 by sam@sam_ebb on 2004/12/07 00:54:05 cleanup dtim code to use a struct Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_output.c#22 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#22 (text+ko) ==== @@ -1359,12 +1359,15 @@ *frm++ = 0; *frm++ = 0; /* TODO: ATIM window */ bo->bo_tim_len = 0; } else { - *frm++ = IEEE80211_ELEMID_TIM; - *frm++ = 4; /* length */ - *frm++ = 0; /* DTIM count */ - *frm++ = 1; /* DTIM period */ - *frm++ = 0; /* bitmap control */ - *frm++ = 0; /* Partial Virtual Bitmap (variable length) */ + struct ieee80211_tim_ie *tie = (struct ieee80211_tim_ie *) frm; + + tie->tim_ie = IEEE80211_ELEMID_TIM; + tie->tim_len = 4; /* length */ + tie->tim_count = 0; /* DTIM count */ + tie->tim_period = ic->ic_dtim_period; /* DTIM period */ + tie->tim_bitctl = 0; /* bitmap control */ + tie->tim_bitmap[0] = 0; /* Partial Virtual Bitmap */ + frm += sizeof(struct ieee80211_tim_ie); bo->bo_tim_len = 1; } bo->bo_trailer = frm; @@ -1462,6 +1465,8 @@ } if (ic->ic_opmode == IEEE80211_M_HOSTAP) { /* NB: no IBSS support*/ + struct ieee80211_tim_ie *tie = + (struct ieee80211_tim_ie *) bo->bo_tim; if (ic->ic_flags & IEEE80211_F_TIMUPDATE) { u_int timlen, timoff, i; /* @@ -1498,18 +1503,18 @@ } if (timlen != bo->bo_tim_len) { /* copy up/down trailer */ - ovbcopy(bo->bo_trailer, bo->bo_tim + 5 + timlen, + ovbcopy(bo->bo_trailer, tie->tim_bitmap+timlen, bo->bo_trailer_len); - bo->bo_trailer = bo->bo_tim + 5 + timlen; + bo->bo_trailer = tie->tim_bitmap+timlen; bo->bo_wme = bo->bo_trailer; bo->bo_tim_len = timlen; /* update information element */ - bo->bo_tim[1] = 3 + timlen; - bo->bo_tim[4] = timoff; + tie->tim_len = 3 + timlen; + tie->tim_bitctl = timoff; len_changed = 1; } - memcpy(bo->bo_tim + 5, ic->ic_tim_bitmap + timoff, + memcpy(tie->tim_bitmap, ic->ic_tim_bitmap + timoff, bo->bo_tim_len); ic->ic_flags &= ~IEEE80211_F_TIMUPDATE; @@ -1519,21 +1524,15 @@ __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 && (bo->bo_tim[2] == 1 || bo->bo_tim[3] == 1)) - bo->bo_tim[4] |= 1; + if (tie->tim_count == 0) + tie->tim_count = tie->tim_period - 1; + else + tie->tim_count--; + /* update state for buffered multicast frames on DTIM */ + if (mcast && (tie->tim_count == 1 || tie->tim_period == 1)) + tie->tim_bitctl |= 1; else - bo->bo_tim[4] &= ~1; + tie->tim_bitctl &= ~1; } IEEE80211_BEACON_UNLOCK(ic);