staging: wfx: simplify hif_start() usage
The structure hif_req_start come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_start() is too dumb. It should pack data with hardware representation instead of leaving all work to the caller. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-10-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
e52e68eee7
Коммит
09779276f1
|
@ -409,16 +409,23 @@ int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int hif_start(struct wfx_vif *wvif, const struct hif_req_start *arg)
|
||||
int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
|
||||
const struct ieee80211_channel *channel)
|
||||
{
|
||||
int ret;
|
||||
struct hif_msg *hif;
|
||||
struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif);
|
||||
|
||||
memcpy(body, arg, sizeof(*body));
|
||||
cpu_to_le16s(&body->channel_number);
|
||||
cpu_to_le32s(&body->beacon_interval);
|
||||
cpu_to_le32s(&body->basic_rate_set);
|
||||
body->dtim_period = conf->dtim_period,
|
||||
body->short_preamble = conf->use_short_preamble,
|
||||
body->channel_number = cpu_to_le16(channel->hw_value),
|
||||
body->beacon_interval = cpu_to_le32(conf->beacon_int);
|
||||
body->basic_rate_set =
|
||||
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
|
||||
if (!conf->hidden_ssid) {
|
||||
body->ssid_length = conf->ssid_len;
|
||||
memcpy(body->ssid, conf->ssid, conf->ssid_len);
|
||||
}
|
||||
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body));
|
||||
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
|
||||
kfree(hif);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "hif_api_cmd.h"
|
||||
|
||||
struct ieee80211_channel;
|
||||
struct ieee80211_bss_conf;
|
||||
struct ieee80211_tx_queue_params;
|
||||
struct cfg80211_scan_request;
|
||||
struct wfx_dev;
|
||||
|
@ -51,7 +53,8 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg);
|
|||
int hif_remove_key(struct wfx_dev *wdev, int idx);
|
||||
int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
|
||||
const struct ieee80211_tx_queue_params *arg);
|
||||
int hif_start(struct wfx_vif *wvif, const struct hif_req_start *arg);
|
||||
int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
|
||||
const struct ieee80211_channel *channel);
|
||||
int hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
|
||||
int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id);
|
||||
int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame,
|
||||
|
|
|
@ -740,38 +740,24 @@ static void wfx_set_cts_work(struct work_struct *work)
|
|||
static int wfx_start_ap(struct wfx_vif *wvif)
|
||||
{
|
||||
int ret;
|
||||
struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf;
|
||||
struct hif_req_start start = {
|
||||
.channel_number = wvif->channel->hw_value,
|
||||
.beacon_interval = conf->beacon_int,
|
||||
.dtim_period = conf->dtim_period,
|
||||
.short_preamble = conf->use_short_preamble,
|
||||
.basic_rate_set = wfx_rate_mask_to_hw(wvif->wdev,
|
||||
conf->basic_rates),
|
||||
};
|
||||
|
||||
memset(start.ssid, 0, sizeof(start.ssid));
|
||||
if (!conf->hidden_ssid) {
|
||||
start.ssid_length = conf->ssid_len;
|
||||
memcpy(start.ssid, conf->ssid, start.ssid_length);
|
||||
}
|
||||
|
||||
wvif->beacon_int = conf->beacon_int;
|
||||
wvif->dtim_period = conf->dtim_period;
|
||||
wvif->beacon_int = wvif->vif->bss_conf.beacon_int;
|
||||
wvif->dtim_period = wvif->vif->bss_conf.dtim_period;
|
||||
|
||||
memset(&wvif->link_id_db, 0, sizeof(wvif->link_id_db));
|
||||
|
||||
wvif->wdev->tx_burst_idx = -1;
|
||||
ret = hif_start(wvif, &start);
|
||||
if (!ret)
|
||||
ret = wfx_upload_keys(wvif);
|
||||
if (!ret) {
|
||||
if (wvif_count(wvif->wdev) <= 1)
|
||||
hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
|
||||
wvif->state = WFX_STATE_AP;
|
||||
wfx_update_filtering(wvif);
|
||||
}
|
||||
return ret;
|
||||
ret = hif_start(wvif, &wvif->vif->bss_conf, wvif->channel);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = wfx_upload_keys(wvif);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (wvif_count(wvif->wdev) <= 1)
|
||||
hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
|
||||
wvif->state = WFX_STATE_AP;
|
||||
wfx_update_filtering(wvif);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wfx_update_beaconing(struct wfx_vif *wvif)
|
||||
|
|
Загрузка…
Ссылка в новой задаче