PERFORCE change 66597 for review
Sam Leffler
sam at FreeBSD.org
Mon Dec 6 16:54:45 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=66597
Change 66597 by sam at 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);
More information about the p4-projects
mailing list