MCPcopy Create free account
hub / github.com/F-Stack/f-stack / amrr_node_init

Function amrr_node_init

freebsd/net80211/ieee80211_amrr.c:161–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161static void
162amrr_node_init(struct ieee80211_node *ni)
163{
164 const struct ieee80211_rateset *rs = NULL;
165 struct ieee80211vap *vap = ni->ni_vap;
166 struct ieee80211_amrr *amrr = vap->iv_rs;
167 struct ieee80211_amrr_node *amn;
168 uint8_t rate;
169
170 if (!amrr) {
171 if_printf(vap->iv_ifp, "ratectl structure was not allocated, "
172 "per-node structure allocation skipped\n");
173 return;
174 }
175
176 if (ni->ni_rctls == NULL) {
177 ni->ni_rctls = amn = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr_node),
178 M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
179 if (amn == NULL) {
180 if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
181 "structure\n");
182 return;
183 }
184 } else
185 amn = ni->ni_rctls;
186 amn->amn_amrr = amrr;
187 amn->amn_success = 0;
188 amn->amn_recovery = 0;
189 amn->amn_txcnt = amn->amn_retrycnt = 0;
190 amn->amn_success_threshold = amrr->amrr_min_success_threshold;
191
192 /* 11n or not? Pick the right rateset */
193 if (amrr_node_is_11n(ni)) {
194 /* XXX ew */
195 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
196 "%s: 11n node", __func__);
197 rs = (struct ieee80211_rateset *) &ni->ni_htrates;
198 } else {
199 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
200 "%s: non-11n node", __func__);
201 rs = &ni->ni_rates;
202 }
203
204 /* Initial rate - lowest */
205 rate = rs->rs_rates[0];
206
207 /* XXX clear the basic rate flag if it's not 11n */
208 if (! amrr_node_is_11n(ni))
209 rate &= IEEE80211_RATE_VAL;
210
211 /* pick initial rate from the rateset - HT or otherwise */
212 /* Pick something low that's likely to succeed */
213 for (amn->amn_rix = rs->rs_nrates - 1; amn->amn_rix > 0;
214 amn->amn_rix--) {
215 /* legacy - anything < 36mbit, stop searching */
216 /* 11n - stop at MCS4 */
217 if (amrr_node_is_11n(ni)) {
218 if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4)

Callers

nothing calls this directly

Calls 2

if_printfFunction · 0.85
amrr_node_is_11nFunction · 0.85

Tested by

no test coverage detected