Commit 238d781d authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlwifi: add context pointer to station

Sometimes we only pass around station
pointers but need to find the context
they belong to, so store it in there.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 770e13bd
...@@ -3751,7 +3751,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, ...@@ -3751,7 +3751,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
sta_priv->client = true; sta_priv->client = true;
ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr, ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr,
is_ap, &sta->ht_cap, &sta_id); is_ap, sta, &sta_id);
if (ret) { if (ret) {
IWL_ERR(priv, "Unable to add station %pM (%d)\n", IWL_ERR(priv, "Unable to add station %pM (%d)\n",
sta->addr, ret); sta->addr, ret);
......
...@@ -502,6 +502,7 @@ struct iwl_station_entry { ...@@ -502,6 +502,7 @@ struct iwl_station_entry {
}; };
struct iwl_station_priv_common { struct iwl_station_priv_common {
struct iwl_rxon_context *ctx;
u8 sta_id; u8 sta_id;
}; };
......
...@@ -172,12 +172,13 @@ int iwl_send_add_sta(struct iwl_priv *priv, ...@@ -172,12 +172,13 @@ int iwl_send_add_sta(struct iwl_priv *priv,
EXPORT_SYMBOL(iwl_send_add_sta); EXPORT_SYMBOL(iwl_send_add_sta);
static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
struct ieee80211_sta_ht_cap *sta_ht_inf) struct ieee80211_sta *sta)
{ {
struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap;
__le32 sta_flags; __le32 sta_flags;
u8 mimo_ps_mode; u8 mimo_ps_mode;
if (!sta_ht_inf || !sta_ht_inf->ht_supported) if (!sta || !sta_ht_inf->ht_supported)
goto done; goto done;
mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
...@@ -228,7 +229,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, ...@@ -228,7 +229,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
*/ */
static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool is_ap, const u8 *addr, bool is_ap,
struct ieee80211_sta_ht_cap *ht_info) struct ieee80211_sta *sta)
{ {
struct iwl_station_entry *station; struct iwl_station_entry *station;
int i; int i;
...@@ -292,12 +293,19 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -292,12 +293,19 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
station->sta.station_flags = ctx->station_flags; station->sta.station_flags = ctx->station_flags;
station->ctxid = ctx->ctxid; station->ctxid = ctx->ctxid;
if (sta) {
struct iwl_station_priv_common *sta_priv;
sta_priv = (void *)sta->drv_priv;
sta_priv->ctx = ctx;
}
/* /*
* OK to call unconditionally, since local stations (IBSS BSSID * OK to call unconditionally, since local stations (IBSS BSSID
* STA and broadcast STA) pass in a NULL ht_info, and mac80211 * STA and broadcast STA) pass in a NULL sta, and mac80211
* doesn't allow HT IBSS. * doesn't allow HT IBSS.
*/ */
iwl_set_ht_add_station(priv, sta_id, ht_info); iwl_set_ht_add_station(priv, sta_id, sta);
/* 3945 only */ /* 3945 only */
rate = (priv->band == IEEE80211_BAND_5GHZ) ? rate = (priv->band == IEEE80211_BAND_5GHZ) ?
...@@ -316,7 +324,7 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -316,7 +324,7 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
*/ */
int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool is_ap, const u8 *addr, bool is_ap,
struct ieee80211_sta_ht_cap *ht_info, u8 *sta_id_r) struct ieee80211_sta *sta, u8 *sta_id_r)
{ {
unsigned long flags_spin; unsigned long flags_spin;
int ret = 0; int ret = 0;
...@@ -325,7 +333,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -325,7 +333,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
*sta_id_r = 0; *sta_id_r = 0;
spin_lock_irqsave(&priv->sta_lock, flags_spin); spin_lock_irqsave(&priv->sta_lock, flags_spin);
sta_id = iwl_prep_station(priv, ctx, addr, is_ap, ht_info); sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
IWL_ERR(priv, "Unable to prepare station %pM for addition\n", IWL_ERR(priv, "Unable to prepare station %pM for addition\n",
addr); addr);
......
...@@ -74,7 +74,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -74,7 +74,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool init_rs, u8 *sta_id_r); const u8 *addr, bool init_rs, u8 *sta_id_r);
int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool is_ap, const u8 *addr, bool is_ap,
struct ieee80211_sta_ht_cap *ht_info, u8 *sta_id_r); struct ieee80211_sta *sta, u8 *sta_id_r);
int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
const u8 *addr); const u8 *addr);
int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
......
...@@ -3390,7 +3390,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, ...@@ -3390,7 +3390,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
ret = iwl_add_station_common(priv, &priv->contexts[IWL_RXON_CTX_BSS], ret = iwl_add_station_common(priv, &priv->contexts[IWL_RXON_CTX_BSS],
sta->addr, is_ap, &sta->ht_cap, &sta_id); sta->addr, is_ap, sta, &sta_id);
if (ret) { if (ret) {
IWL_ERR(priv, "Unable to add station %pM (%d)\n", IWL_ERR(priv, "Unable to add station %pM (%d)\n",
sta->addr, ret); sta->addr, ret);
......
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