Commit 323ce79a authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: share sta->supp_rates

As more preparation for a saner rate control algorithm API,
share the supported rates bitmap in the public API.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b7e35008
...@@ -1825,7 +1825,7 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta) ...@@ -1825,7 +1825,7 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta)
sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
for (i = 0; i < sband->n_bitrates; i++) { for (i = 0; i < sband->n_bitrates; i++) {
if (sta->supp_rates[local->hw.conf.channel->band] & BIT(i)) { if (sta->sta.supp_rates[local->hw.conf.channel->band] & BIT(i)) {
rc_priv->neg_rates.rs_rates[j] rc_priv->neg_rates.rs_rates[j]
= (sband->bitrates[i].bitrate * 2) / 10; = (sband->bitrates[i].bitrate * 2) / 10;
j++; j++;
......
...@@ -333,7 +333,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, ...@@ -333,7 +333,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
* after assoc.. */ * after assoc.. */
for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) { if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) {
sta->txrate_idx = i; sta->txrate_idx = i;
break; break;
} }
...@@ -680,7 +680,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -680,7 +680,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
rs_sta = (void *)sta->rate_ctrl_priv; rs_sta = (void *)sta->rate_ctrl_priv;
rate_mask = sta->supp_rates[sband->band]; rate_mask = sta->sta.supp_rates[sband->band];
index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
if (sband->band == IEEE80211_BAND_5GHZ) if (sband->band == IEEE80211_BAND_5GHZ)
......
...@@ -1731,7 +1731,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -1731,7 +1731,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
return; return;
lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band];
tid = rs_tl_add_packet(lq_sta, hdr); tid = rs_tl_add_packet(lq_sta, hdr);
...@@ -2233,7 +2233,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, ...@@ -2233,7 +2233,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
lq_sta->flush_timer = 0; lq_sta->flush_timer = 0;
lq_sta->supp_rates = sta->supp_rates[sband->band]; lq_sta->supp_rates = sta->sta.supp_rates[sband->band];
sta->txrate_idx = 3; sta->txrate_idx = 3;
for (j = 0; j < LQ_SIZE; j++) for (j = 0; j < LQ_SIZE; j++)
for (i = 0; i < IWL_RATE_COUNT; i++) for (i = 0; i < IWL_RATE_COUNT; i++)
...@@ -2270,7 +2270,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, ...@@ -2270,7 +2270,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
/* Find highest tx rate supported by hardware and destination station */ /* Find highest tx rate supported by hardware and destination station */
for (i = 0; i < sband->n_bitrates; i++) for (i = 0; i < sband->n_bitrates; i++)
if (sta->supp_rates[sband->band] & BIT(i)) if (sta->sta.supp_rates[sband->band] & BIT(i))
sta->txrate_idx = i; sta->txrate_idx = i;
lq_sta->last_txrate_idx = sta->txrate_idx; lq_sta->last_txrate_idx = sta->txrate_idx;
......
...@@ -666,10 +666,12 @@ enum set_key_cmd { ...@@ -666,10 +666,12 @@ enum set_key_cmd {
* *
* @addr: MAC address * @addr: MAC address
* @aid: AID we assigned to the station if we're an AP * @aid: AID we assigned to the station if we're an AP
* @supp_rates: Bitmap of supported rates (per band)
* @drv_priv: data area for driver use, will always be aligned to * @drv_priv: data area for driver use, will always be aligned to
* sizeof(void *), size is determined in hw information. * sizeof(void *), size is determined in hw information.
*/ */
struct ieee80211_sta { struct ieee80211_sta {
u64 supp_rates[IEEE80211_NUM_BANDS];
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
u16 aid; u16 aid;
......
...@@ -667,7 +667,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -667,7 +667,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
rates |= BIT(j); rates |= BIT(j);
} }
} }
sta->supp_rates[local->oper_channel->band] = rates; sta->sta.supp_rates[local->oper_channel->band] = rates;
} }
if (params->ht_capa) { if (params->ht_capa) {
......
...@@ -106,7 +106,7 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, ...@@ -106,7 +106,7 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
return NULL; return NULL;
sta->flags = WLAN_STA_AUTHORIZED; sta->flags = WLAN_STA_AUTHORIZED;
sta->supp_rates[local->hw.conf.channel->band] = rates; sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
return sta; return sta;
} }
...@@ -243,7 +243,7 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct ieee80211_sub_if_data ...@@ -243,7 +243,7 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct ieee80211_sub_if_data
} }
sta->last_rx = jiffies; sta->last_rx = jiffies;
sta->supp_rates[local->hw.conf.channel->band] = rates; sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN && if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN &&
sdata->u.mesh.accepting_plinks && sdata->u.mesh.accepting_plinks &&
sdata->u.mesh.mshcfg.auto_open_plinks) sdata->u.mesh.mshcfg.auto_open_plinks)
......
...@@ -1301,7 +1301,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1301,7 +1301,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
} }
} }
sta->supp_rates[local->hw.conf.channel->band] = rates; sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
sdata->bss_conf.basic_rates = basic_rates; sdata->bss_conf.basic_rates = basic_rates;
/* cf. IEEE 802.11 9.2.12 */ /* cf. IEEE 802.11 9.2.12 */
...@@ -1497,13 +1497,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -1497,13 +1497,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
if (sta) { if (sta) {
u64 prev_rates; u64 prev_rates;
prev_rates = sta->supp_rates[band]; prev_rates = sta->sta.supp_rates[band];
/* make sure mandatory rates are always added */ /* make sure mandatory rates are always added */
sta->supp_rates[band] = supp_rates | sta->sta.supp_rates[band] = supp_rates |
ieee80211_mandatory_rates(local, band); ieee80211_mandatory_rates(local, band);
#ifdef CONFIG_MAC80211_IBSS_DEBUG #ifdef CONFIG_MAC80211_IBSS_DEBUG
if (sta->supp_rates[band] != prev_rates) if (sta->sta.supp_rates[band] != prev_rates)
printk(KERN_DEBUG "%s: updated supp_rates set " printk(KERN_DEBUG "%s: updated supp_rates set "
"for %s based on beacon info (0x%llx | " "for %s based on beacon info (0x%llx | "
"0x%llx -> 0x%llx)\n", "0x%llx -> 0x%llx)\n",
...@@ -1511,7 +1511,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -1511,7 +1511,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
print_mac(mac, sta->sta.addr), print_mac(mac, sta->sta.addr),
(unsigned long long) prev_rates, (unsigned long long) prev_rates,
(unsigned long long) supp_rates, (unsigned long long) supp_rates,
(unsigned long long) sta->supp_rates[band]); (unsigned long long) sta->sta.supp_rates[band]);
#endif #endif
} else { } else {
ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid, ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid,
...@@ -2339,7 +2339,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, ...@@ -2339,7 +2339,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
set_sta_flags(sta, WLAN_STA_AUTHORIZED); set_sta_flags(sta, WLAN_STA_AUTHORIZED);
/* make sure mandatory rates are always added */ /* make sure mandatory rates are always added */
sta->supp_rates[band] = supp_rates | sta->sta.supp_rates[band] = supp_rates |
ieee80211_mandatory_rates(local, band); ieee80211_mandatory_rates(local, band);
rate_control_rate_init(sta, local); rate_control_rate_init(sta, local);
......
...@@ -134,7 +134,7 @@ static inline int rate_supported(struct sta_info *sta, ...@@ -134,7 +134,7 @@ static inline int rate_supported(struct sta_info *sta,
enum ieee80211_band band, enum ieee80211_band band,
int index) int index)
{ {
return (sta == NULL || sta->supp_rates[band] & BIT(index)); return (sta == NULL || sta->sta.supp_rates[band] & BIT(index));
} }
static inline s8 static inline s8
......
...@@ -168,7 +168,6 @@ struct sta_ampdu_mlme { ...@@ -168,7 +168,6 @@ struct sta_ampdu_mlme {
* in the header file. * in the header file.
* @flaglock: spinlock for flags accesses * @flaglock: spinlock for flags accesses
* @ht_info: HT capabilities of this STA * @ht_info: HT capabilities of this STA
* @supp_rates: Bitmap of supported rates (per band)
* @addr: MAC address of this STA * @addr: MAC address of this STA
* @aid: STA's unique AID (1..2007, 0 = not assigned yet), * @aid: STA's unique AID (1..2007, 0 = not assigned yet),
* only used in AP (and IBSS?) mode * only used in AP (and IBSS?) mode
...@@ -228,7 +227,6 @@ struct sta_info { ...@@ -228,7 +227,6 @@ struct sta_info {
spinlock_t lock; spinlock_t lock;
spinlock_t flaglock; spinlock_t flaglock;
struct ieee80211_ht_info ht_info; struct ieee80211_ht_info ht_info;
u64 supp_rates[IEEE80211_NUM_BANDS];
u16 listen_interval; u16 listen_interval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment