| 2338 | | pktlen, /* packet length */ |
|---|
| 2339 | | hdrlen, /* header length */ |
|---|
| 2340 | | atype, /* Atheros packet type */ |
|---|
| 2341 | | power, /* txpower */ |
|---|
| 2342 | | txrate, try0, /* series 0 rate/tries */ |
|---|
| 2343 | | HAL_TXKEYIX_INVALID, /* key cache index */ |
|---|
| 2344 | | antenna, /* antenna mode */ |
|---|
| 2345 | | flags, /* flags */ |
|---|
| 2346 | | 0, /* rts/cts rate */ |
|---|
| 2347 | | 0, /* rts/cts duration */ |
|---|
| 2348 | | 0, /* comp icv len */ |
|---|
| 2349 | | 0, /* comp iv len */ |
|---|
| 2350 | | ATH_COMP_PROC_NO_COMP_NO_CCS /* comp scheme */ |
|---|
| | 2348 | pktlen, /* packet length */ |
|---|
| | 2349 | hdrlen, /* header length */ |
|---|
| | 2350 | atype, /* Atheros packet type */ |
|---|
| | 2351 | power, /* txpower */ |
|---|
| | 2352 | txrate, try0, /* series 0 rate/tries */ |
|---|
| | 2353 | HAL_TXKEYIX_INVALID, /* key cache index */ |
|---|
| | 2354 | antenna, /* antenna mode */ |
|---|
| | 2355 | flags, /* flags */ |
|---|
| | 2356 | 0, /* rts/cts rate */ |
|---|
| | 2357 | 0, /* rts/cts duration */ |
|---|
| | 2358 | 0, /* comp icv len */ |
|---|
| | 2359 | 0, /* comp iv len */ |
|---|
| | 2360 | ATH_COMP_PROC_NO_COMP_NO_CCS /* comp scheme */ |
|---|
| 7078 | | pktlen, /* packet length */ |
|---|
| 7079 | | hdrlen, /* header length */ |
|---|
| 7080 | | atype, /* Atheros packet type */ |
|---|
| 7081 | | MIN(ni->ni_txpower, 60), /* txpower */ |
|---|
| 7082 | | txrate, try0, /* series 0 rate/tries */ |
|---|
| 7083 | | keyix, /* key cache index */ |
|---|
| 7084 | | antenna, /* antenna mode */ |
|---|
| 7085 | | flags, /* flags */ |
|---|
| 7086 | | ctsrate, /* rts/cts rate */ |
|---|
| 7087 | | ctsduration, /* rts/cts duration */ |
|---|
| 7088 | | icvlen, /* comp icv len */ |
|---|
| 7089 | | ivlen, /* comp iv len */ |
|---|
| 7090 | | comp /* comp scheme */ |
|---|
| | 7087 | pktlen, /* packet length */ |
|---|
| | 7088 | hdrlen, /* header length */ |
|---|
| | 7089 | atype, /* Atheros packet type */ |
|---|
| | 7090 | vap->iv_txpower, /* txpower */ |
|---|
| | 7091 | txrate, try0, /* series 0 rate/tries */ |
|---|
| | 7092 | keyix, /* key cache index */ |
|---|
| | 7093 | antenna, /* antenna mode */ |
|---|
| | 7094 | flags, /* flags */ |
|---|
| | 7095 | ctsrate, /* rts/cts rate */ |
|---|
| | 7096 | ctsduration, /* rts/cts duration */ |
|---|
| | 7097 | icvlen, /* comp icv len */ |
|---|
| | 7098 | ivlen, /* comp iv len */ |
|---|
| | 7099 | comp /* comp scheme */ |
|---|
| 8699 | | struct ieee80211com *ic = &sc->sc_ic; |
|---|
| | 8698 | struct ieee80211com *ic = &sc->sc_ic; |
|---|
| | 8699 | struct ath_hal *ah = sc->sc_ah; |
|---|
| | 8700 | u_int32_t txpow; |
|---|
| | 8701 | |
|---|
| | 8702 | if (!sc->sc_hastpc) { |
|---|
| | 8703 | ath_hal_settxpowlimit(ah, ic->ic_txpowlimit); |
|---|
| | 8704 | |
|---|
| | 8705 | (void)ath_hal_gettxpowlimit(ah, &txpow); |
|---|
| | 8706 | ic->ic_txpowlimit = txpow; |
|---|
| | 8707 | } |
|---|
| | 8708 | } |
|---|
| | 8709 | |
|---|
| | 8710 | static void |
|---|
| | 8711 | ath_set_txpow(struct ieee80211com *ic, int txpow) |
|---|
| | 8712 | { |
|---|
| | 8713 | struct net_device *dev = ic->ic_dev; |
|---|
| | 8714 | struct ath_softc *sc = dev->priv; |
|---|
| 8701 | | struct ath_hal *ah = sc->sc_ah; |
|---|
| 8702 | | u_int32_t txpowlimit = 0; |
|---|
| 8703 | | u_int32_t maxtxpowlimit = 9999; |
|---|
| 8704 | | u_int32_t clamped_txpow = 0; |
|---|
| 8705 | | |
|---|
| 8706 | | /* |
|---|
| 8707 | | * Find the maxtxpow of the card and regulatory constraints |
|---|
| 8708 | | */ |
|---|
| 8709 | | (void)ath_hal_getmaxtxpow(ah, &txpowlimit); |
|---|
| 8710 | | ath_hal_settxpowlimit(ah, maxtxpowlimit); |
|---|
| 8711 | | (void)ath_hal_getmaxtxpow(ah, &maxtxpowlimit); |
|---|
| 8712 | | ic->ic_txpowlimit = maxtxpowlimit; |
|---|
| 8713 | | ath_hal_settxpowlimit(ah, txpowlimit); |
|---|
| 8714 | | |
|---|
| 8715 | | /* |
|---|
| 8716 | | * Make sure the VAPs change is within limits, clamp it otherwise |
|---|
| 8717 | | */ |
|---|
| 8718 | | if (ic->ic_newtxpowlimit > ic->ic_txpowlimit) |
|---|
| 8719 | | clamped_txpow = ic->ic_txpowlimit; |
|---|
| 8720 | | else |
|---|
| 8721 | | clamped_txpow = ic->ic_newtxpowlimit; |
|---|
| 8722 | | |
|---|
| 8723 | | /* |
|---|
| 8724 | | * Search for the VAP that needs a txpow change, if any |
|---|
| 8725 | | */ |
|---|
| 8726 | | TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { |
|---|
| 8727 | | if (!tpc || ic->ic_newtxpowlimit != vap->iv_bss->ni_txpower) { |
|---|
| 8728 | | vap->iv_bss->ni_txpower = clamped_txpow; |
|---|
| 8729 | | ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow); |
|---|
| 8730 | | } |
|---|
| 8731 | | } |
|---|
| 8732 | | |
|---|
| 8733 | | sc->sc_curtxpow = clamped_txpow; |
|---|
| 8734 | | if (clamped_txpow != txpowlimit) |
|---|
| 8735 | | ath_hal_settxpowlimit(ah, clamped_txpow); |
|---|
| 8736 | | } |
|---|
| 8737 | | |
|---|
| | 8716 | u_int32_t mintxpow; |
|---|
| | 8717 | |
|---|
| | 8718 | if (!sc->sc_hastpc) { |
|---|
| | 8719 | /* Find the minimum TX power of all VAPs and set that; |
|---|
| | 8720 | * i.e., we guarantee that the set TX power is the |
|---|
| | 8721 | * _maximum_ TX power. */ |
|---|
| | 8722 | mintxpow = txpow; |
|---|
| | 8723 | TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { |
|---|
| | 8724 | mintxpow = MIN(mintxpow, vap->iv_txpower); |
|---|
| | 8725 | } |
|---|
| | 8726 | ic->ic_txpowlimit = mintxpow; |
|---|
| | 8727 | } |
|---|
| | 8728 | } |
|---|