* Install received rate set information in the node's state block. */
| 391 | * Install received rate set information in the node's state block. |
| 392 | */ |
| 393 | int |
| 394 | ieee80211_setup_rates(struct ieee80211_node *ni, |
| 395 | const uint8_t *rates, const uint8_t *xrates, int flags) |
| 396 | { |
| 397 | struct ieee80211vap *vap = ni->ni_vap; |
| 398 | struct ieee80211_rateset *rs = &ni->ni_rates; |
| 399 | |
| 400 | memset(rs, 0, sizeof(*rs)); |
| 401 | rs->rs_nrates = rates[1]; |
| 402 | memcpy(rs->rs_rates, rates + 2, rs->rs_nrates); |
| 403 | if (xrates != NULL) { |
| 404 | uint8_t nxrates; |
| 405 | /* |
| 406 | * Tack on 11g extended supported rate element. |
| 407 | */ |
| 408 | nxrates = xrates[1]; |
| 409 | if (rs->rs_nrates + nxrates > IEEE80211_RATE_MAXSIZE) { |
| 410 | nxrates = IEEE80211_RATE_MAXSIZE - rs->rs_nrates; |
| 411 | IEEE80211_NOTE(vap, IEEE80211_MSG_XRATE, ni, |
| 412 | "extended rate set too large; only using " |
| 413 | "%u of %u rates", nxrates, xrates[1]); |
| 414 | vap->iv_stats.is_rx_rstoobig++; |
| 415 | } |
| 416 | memcpy(rs->rs_rates + rs->rs_nrates, xrates+2, nxrates); |
| 417 | rs->rs_nrates += nxrates; |
| 418 | } |
| 419 | return ieee80211_fix_rate(ni, rs, flags); |
| 420 | } |
| 421 | |
| 422 | /* |
| 423 | * Send a management frame error response to the specified |
no test coverage detected