Deleted Added
full compact
27c27
< __FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 252717 2013-07-04 19:45:34Z adrian $");
---
> __FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 252727 2013-07-04 21:16:49Z adrian $");
337a338,339
> IWN_DEBUG_TXRATE = 0x00002000, /* TX rate debugging */
> IWN_DEBUG_PWRSAVE = 0x00004000, /* Power save operations */
2101,2102c2103,2112
< static void
< iwn_newassoc(struct ieee80211_node *ni, int isnew)
---
> /*
> * Calculate the required PLCP value from the given rate,
> * to the given node.
> *
> * This will take the node configuration (eg 11n, rate table
> * setup, etc) into consideration.
> */
> static uint32_t
> iwn_rate_to_plcp(struct iwn_softc *sc, struct ieee80211_node *ni,
> uint8_t rate)
2106,2107d2115
< struct iwn_softc *sc = ic->ic_ifp->if_softc;
< struct iwn_node *wn = (void *)ni;
2109c2117,2118
< int i, plcp, rate, ridx;
---
> uint32_t plcp = 0;
> int ridx;
2114a2124,2127
> /*
> * If it's an MCS rate, let's set the plcp correctly
> * and set the relevant flags based on the node config.
> */
2116,2123c2129,2148
< ridx = ni->ni_rates.rs_nrates - 1;
< for (i = ni->ni_htrates.rs_nrates - 1; i >= 0; i--) {
< plcp = RV(ni->ni_htrates.rs_rates[i]) | IWN_RFLAG_MCS;
< if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
< plcp |= IWN_RFLAG_HT40;
< if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
< plcp |= IWN_RFLAG_SGI;
< } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)
---
> /*
> * Set the initial PLCP value to be between 0->31 for
> * MCS 0 -> MCS 31, then set the "I'm an MCS rate!"
> * flag.
> */
> plcp = RV(rate) | IWN_RFLAG_MCS;
>
> /*
> * XXX the following should only occur if both
> * the local configuration _and_ the remote node
> * advertise these capabilities. Thus this code
> * may need fixing!
> */
>
> /*
> * Set the channel width and guard interval.
> */
> if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
> plcp |= IWN_RFLAG_HT40;
> if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
2125,2134c2150,2151
< if (RV(ni->ni_htrates.rs_rates[i]) > 7)
< plcp |= IWN_RFLAG_ANT(txant1 | txant2);
< else
< plcp |= IWN_RFLAG_ANT(txant1);
< if (ridx >= 0) {
< rate = RV(ni->ni_rates.rs_rates[ridx]);
< wn->ridx[rate] = plcp;
< }
< wn->ridx[IEEE80211_RATE_MCS | i] = plcp;
< ridx--;
---
> } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) {
> plcp |= IWN_RFLAG_SGI;
2136,2143c2153,2162
< } else {
< for (i = 0; i < ni->ni_rates.rs_nrates; i++) {
< rate = RV(ni->ni_rates.rs_rates[i]);
< plcp = rate2plcp(rate);
< ridx = ic->ic_rt->rateCodeToIndex[rate];
< if (ridx < IWN_RIDX_OFDM6 &&
< IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))
< plcp |= IWN_RFLAG_CCK;
---
>
> /*
> * If it's a two stream rate, enable TX on both
> * antennas.
> *
> * XXX three stream rates?
> */
> if (rate > 0x87)
> plcp |= IWN_RFLAG_ANT(txant1 | txant2);
> else
2145,2146c2164,2185
< wn->ridx[rate] = htole32(plcp);
< }
---
> } else {
> /*
> * Set the initial PLCP - fine for both
> * OFDM and CCK rates.
> */
> plcp = rate2plcp(rate);
>
> /* Set CCK flag if it's CCK */
>
> /* XXX It would be nice to have a method
> * to map the ridx -> phy table entry
> * so we could just query that, rather than
> * this hack to check against IWN_RIDX_OFDM6.
> */
> ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
> rate & IEEE80211_RATE_VAL);
> if (ridx < IWN_RIDX_OFDM6 &&
> IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))
> plcp |= IWN_RFLAG_CCK;
>
> /* Set antenna configuration */
> plcp |= IWN_RFLAG_ANT(txant1);
2147a2187,2193
>
> DPRINTF(sc, IWN_DEBUG_TXRATE, "%s: rate=0x%02x, plcp=0x%08x\n",
> __func__,
> rate,
> plcp);
>
> return (htole32(plcp));
2150a2197,2202
> static void
> iwn_newassoc(struct ieee80211_node *ni, int isnew)
> {
> /* Doesn't do anything at the moment */
> }
>
3404c3456,3457
< ridx = ic->ic_rt->rateCodeToIndex[rate];
---
> ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
> rate & IEEE80211_RATE_VAL);
3510c3563
< tx->rate = wn->ridx[rate];
---
> tx->rate = iwn_rate_to_plcp(sc, ni, rate);
3641c3694,3695
< ridx = ic->ic_rt->rateCodeToIndex[rate];
---
> ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
> rate & IEEE80211_RATE_VAL);
3716a3771,3772
>
> /* XXX should just use iwn_rate_to_plcp() */
3720a3777
>
3724a3782
>
4079a4138,4139
> uint32_t plcp;
>
4084d4143
< linkq.retry[i] = wn->ridx[rate];
4086,4087c4145,4151
< if ((le32toh(wn->ridx[rate]) & IWN_RFLAG_MCS) &&
< RV(le32toh(wn->ridx[rate])) > 7)
---
> /* Do rate -> PLCP config mapping */
> plcp = iwn_rate_to_plcp(sc, ni, rate);
> linkq.retry[i] = plcp;
>
> /* Special case for dual-stream rates? */
> if ((le32toh(plcp) & IWN_RFLAG_MCS) &&
> RV(le32toh(plcp)) > 7)
4942a5007,5013
> DPRINTF(sc, IWN_DEBUG_PWRSAVE,
> "%s: dtim=%d, level=%d, async=%d\n",
> __func__,
> dtim,
> level,
> async);
>