staging: wfx: simplify hif_set_association_mode()
The file hif_tx_mib.c expects to contain functions that format messages for the hardware. It is unexpected to find function that manipulate RCU and structures from mac80211. Keep hif_set_association_mode() with the code necessary for message formatting and relocate the smart part in wfx_join_finalize(). Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200907101521.66082-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
178b8943d3
commit
2a8f726489
@ -187,29 +187,18 @@ int hif_set_block_ack_policy(struct wfx_vif *wvif,
|
|||||||
&val, sizeof(val));
|
&val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
int hif_set_association_mode(struct wfx_vif *wvif,
|
int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density,
|
||||||
struct ieee80211_bss_conf *info)
|
bool greenfield, bool short_preamble)
|
||||||
{
|
{
|
||||||
struct ieee80211_sta *sta = NULL;
|
|
||||||
struct hif_mib_set_association_mode val = {
|
struct hif_mib_set_association_mode val = {
|
||||||
.preambtype_use = 1,
|
.preambtype_use = 1,
|
||||||
.mode = 1,
|
.mode = 1,
|
||||||
.spacing = 1,
|
.spacing = 1,
|
||||||
.short_preamble = info->use_short_preamble,
|
.short_preamble = short_preamble,
|
||||||
|
.greenfield = greenfield,
|
||||||
|
.mpdu_start_spacing = ampdu_density,
|
||||||
};
|
};
|
||||||
|
|
||||||
rcu_read_lock(); // protect sta
|
|
||||||
if (info->bssid && !info->ibss_joined)
|
|
||||||
sta = ieee80211_find_sta(wvif->vif, info->bssid);
|
|
||||||
|
|
||||||
// FIXME: it is strange to not retrieve all information from bss_info
|
|
||||||
if (sta && sta->ht_cap.ht_supported) {
|
|
||||||
val.mpdu_start_spacing = sta->ht_cap.ampdu_density;
|
|
||||||
if (!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT))
|
|
||||||
val.greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
|
|
||||||
}
|
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
return hif_write_mib(wvif->wdev, wvif->id,
|
return hif_write_mib(wvif->wdev, wvif->id,
|
||||||
HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val));
|
HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb,
|
|||||||
int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required);
|
int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required);
|
||||||
int hif_set_block_ack_policy(struct wfx_vif *wvif,
|
int hif_set_block_ack_policy(struct wfx_vif *wvif,
|
||||||
u8 tx_tid_policy, u8 rx_tid_policy);
|
u8 tx_tid_policy, u8 rx_tid_policy);
|
||||||
int hif_set_association_mode(struct wfx_vif *wvif,
|
int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density,
|
||||||
struct ieee80211_bss_conf *info);
|
bool greenfield, bool short_preamble);
|
||||||
int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
|
int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
|
||||||
int policy_index, u8 *rates);
|
int policy_index, u8 *rates);
|
||||||
int hif_set_mac_addr_condition(struct wfx_vif *wvif,
|
int hif_set_mac_addr_condition(struct wfx_vif *wvif,
|
||||||
|
@ -499,8 +499,23 @@ static void wfx_join(struct wfx_vif *wvif)
|
|||||||
static void wfx_join_finalize(struct wfx_vif *wvif,
|
static void wfx_join_finalize(struct wfx_vif *wvif,
|
||||||
struct ieee80211_bss_conf *info)
|
struct ieee80211_bss_conf *info)
|
||||||
{
|
{
|
||||||
|
struct ieee80211_sta *sta = NULL;
|
||||||
|
int ampdu_density = 0;
|
||||||
|
bool greenfield = false;
|
||||||
|
|
||||||
|
rcu_read_lock(); // protect sta
|
||||||
|
if (info->bssid && !info->ibss_joined)
|
||||||
|
sta = ieee80211_find_sta(wvif->vif, info->bssid);
|
||||||
|
if (sta && sta->ht_cap.ht_supported)
|
||||||
|
ampdu_density = sta->ht_cap.ampdu_density;
|
||||||
|
if (sta && sta->ht_cap.ht_supported &&
|
||||||
|
!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT))
|
||||||
|
greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
|
||||||
|
rcu_read_unlock();
|
||||||
|
|
||||||
wvif->join_in_progress = false;
|
wvif->join_in_progress = false;
|
||||||
hif_set_association_mode(wvif, info);
|
hif_set_association_mode(wvif, ampdu_density, greenfield,
|
||||||
|
info->use_short_preamble);
|
||||||
hif_keep_alive_period(wvif, 0);
|
hif_keep_alive_period(wvif, 0);
|
||||||
// beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
|
// beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
|
||||||
// the same value.
|
// the same value.
|
||||||
|
Loading…
Reference in New Issue
Block a user