Date: Mon, 14 Jan 2008 23:38:18 GMT From: Sepherosa Ziehau <sephe@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 133285 for review Message-ID: <200801142338.m0ENcISN074148@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133285 Change 133285 by sephe@sephe_zealot:sam_wifi on 2008/01/14 23:37:36 Pass ieee80211_channel to various ieee80211_phy functions, handy for the callers. Affected files ... .. //depot/projects/wifi/sys/dev/ral/rt2661.c#23 edit .. //depot/projects/wifi/sys/net80211/ieee80211.c#60 edit .. //depot/projects/wifi/sys/net80211/ieee80211_phy.c#6 edit .. //depot/projects/wifi/sys/net80211/ieee80211_phy.h#3 edit Differences ... ==== //depot/projects/wifi/sys/dev/ral/rt2661.c#23 (text) ==== @@ -1356,8 +1356,7 @@ desc->plcp_service = 4; len += IEEE80211_CRC_LEN; - if (ieee80211_rate2phytype(ic->ic_curchan->ic_rt, rate) == - IEEE80211_T_OFDM) { + if (ieee80211_rate2phytype(ic->ic_curchan, rate) == IEEE80211_T_OFDM) { desc->flags |= htole32(RT2661_TX_OFDM); plcp_length = len & 0xfff; @@ -1443,7 +1442,7 @@ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2661_TX_NEED_ACK; - dur = ieee80211_ack_duration(ic->ic_curchan->ic_rt, + dur = ieee80211_ack_duration(ic->ic_curchan, rate, ic->ic_flags); *(uint16_t *)wh->i_dur = htole16(dur); @@ -1568,12 +1567,12 @@ rtsrate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 2; - dur = ieee80211_ack_duration(ic->ic_curchan->ic_rt, + dur = ieee80211_ack_duration(ic->ic_curchan, rtsrate, ic->ic_flags) - + ieee80211_compute_duration(ic->ic_curchan->ic_rt, + + ieee80211_compute_duration(ic->ic_curchan, m0->m_pkthdr.len + IEEE80211_CRC_LEN, rate, ic->ic_flags) - + ieee80211_ack_duration(ic->ic_curchan->ic_rt, + + ieee80211_ack_duration(ic->ic_curchan, rate, ic->ic_flags); m = rt2661_get_rts(sc, wh, dur); @@ -1677,7 +1676,7 @@ if (!noack && !IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2661_TX_NEED_ACK; - dur = ieee80211_ack_duration(ic->ic_curchan->ic_rt, rate, + dur = ieee80211_ack_duration(ic->ic_curchan, rate, ic->ic_flags); *(uint16_t *)wh->i_dur = htole16(dur); } ==== //depot/projects/wifi/sys/net80211/ieee80211.c#60 (text+ko) ==== @@ -183,8 +183,7 @@ if (IEEE80211_IS_CHAN_HTG(c)) setbit(ic->ic_modecaps, IEEE80211_MODE_11NG); - c->ic_rt = ieee80211_get_ratetable(c); - KASSERT(c->ic_rt != NULL, ("no channel rate table\n")); + ieee80211_set_ratetable(c); } /* initialize candidate channels to all available */ memcpy(ic->ic_chan_active, ic->ic_chan_avail, ==== //depot/projects/wifi/sys/net80211/ieee80211_phy.c#6 (text+ko) ==== @@ -234,6 +234,8 @@ #undef XR static void ieee80211_setup_ratetable(struct ieee80211_rate_table *); +static uint16_t ieee80211_compute_dur(const struct ieee80211_rate_table *, + uint32_t, uint16_t, int); /* Setup all rate tables */ void @@ -305,9 +307,9 @@ * current rate, so control rate's reverse lookup entry * has been installed and following call is safe. */ - rt->info[i].lpAckDuration = ieee80211_compute_duration(rt, + rt->info[i].lpAckDuration = ieee80211_compute_dur(rt, WLAN_CTRL_FRAME_SIZE, ctl_rate, 0); - rt->info[i].spAckDuration = ieee80211_compute_duration(rt, + rt->info[i].spAckDuration = ieee80211_compute_dur(rt, WLAN_CTRL_FRAME_SIZE, ctl_rate, IEEE80211_F_SHPREAMBLE); } @@ -315,10 +317,10 @@ #undef N } -const struct ieee80211_rate_table * -ieee80211_get_ratetable(struct ieee80211_channel *c) +void +ieee80211_set_ratetable(struct ieee80211_channel *c) { - struct ieee80211_rate_table *rt; + const struct ieee80211_rate_table *rt; /* XXX HT */ if (IEEE80211_IS_CHAN_HALF(c)) @@ -346,7 +348,7 @@ panic("%s: no rate table for channel; freq %u flags 0x%x\n", __func__, c->ic_freq, c->ic_flags); } - return rt; + c->ic_rt = rt; } #ifdef notyet @@ -400,8 +402,9 @@ #endif /* notyet */ enum ieee80211_phytype -ieee80211_rate2phytype(const struct ieee80211_rate_table *rt, uint8_t rate) +ieee80211_rate2phytype(const struct ieee80211_channel *c, uint8_t rate) { + const struct ieee80211_rate_table *rt = c->ic_rt; uint8_t rix = rt->rateCodeToIndex[rate]; KASSERT(rix != (uint8_t)-1, ("rate %d has no info", rate)); @@ -415,9 +418,10 @@ * sent using rate, phy and short preamble setting. */ uint16_t -ieee80211_ack_duration(const struct ieee80211_rate_table *rt, +ieee80211_ack_duration(const struct ieee80211_channel *c, uint8_t rate, int flags) { + const struct ieee80211_rate_table *rt = c->ic_rt; uint8_t rix = rt->rateCodeToIndex[rate]; KASSERT(rix != (uint8_t)-1, ("rate %d has no info", rate)); @@ -432,13 +436,20 @@ } } +uint16_t +ieee80211_compute_duration(const struct ieee80211_channel *c, + uint32_t frameLen, uint16_t rate, int flags) +{ + return ieee80211_compute_dur(c->ic_rt, frameLen, rate, flags); +} + /* * Compute the time to transmit a frame of length frameLen bytes * using the specified rate, phy, and short preamble setting. * SIFS is included. */ -uint16_t -ieee80211_compute_duration(const struct ieee80211_rate_table *rt, +static uint16_t +ieee80211_compute_dur(const struct ieee80211_rate_table *rt, uint32_t frameLen, uint16_t rate, int flags) { uint8_t rix = rt->rateCodeToIndex[rate]; ==== //depot/projects/wifi/sys/net80211/ieee80211_phy.h#3 (text+ko) ==== @@ -30,20 +30,18 @@ #ifdef _KERNEL -struct ieee80211_rate_table; struct ieee80211_channel; /* Initialization functions */ void ieee80211_phy_init(void); -const struct ieee80211_rate_table *ieee80211_get_ratetable( - struct ieee80211_channel *); +void ieee80211_set_ratetable(struct ieee80211_channel *); -uint16_t ieee80211_ack_duration(const struct ieee80211_rate_table *, +uint16_t ieee80211_ack_duration(const struct ieee80211_channel *, uint8_t, int); -uint16_t ieee80211_compute_duration(const struct ieee80211_rate_table *, +uint16_t ieee80211_compute_duration(const struct ieee80211_channel *, uint32_t, uint16_t, int); enum ieee80211_phytype ieee80211_rate2phytype( - const struct ieee80211_rate_table *, uint8_t); + const struct ieee80211_channel *, uint8_t); #endif /* _KERNEL */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801142338.m0ENcISN074148>