staging: wfx: simplify hif_set_bss_params()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Mon, 20 Apr 2020 16:03:03 +0000 (18:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 11:26:04 +0000 (13:26 +0200)
The structure hif_req_set_bss_params come from hardware API. It is not
intended to be manipulated in upper layers of the driver.

In add, current code for hif_req_set_bss_params() 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/20200420160311.57323-9-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/hif_tx.c
drivers/staging/wfx/hif_tx.h
drivers/staging/wfx/sta.c

index f49ab67e1a6deaac9a03c8e4d831666157067a15..17721cf9e2a3fb6bb9cf8f57f8f59e2fdd5d65ef 100644 (file)
@@ -321,17 +321,15 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
        return ret;
 }
 
-int hif_set_bss_params(struct wfx_vif *wvif,
-                      const struct hif_req_set_bss_params *arg)
+int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count)
 {
        int ret;
        struct hif_msg *hif;
-       struct hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body),
-                                                           &hif);
+       struct hif_req_set_bss_params *body =
+               wfx_alloc_hif(sizeof(*body), &hif);
 
-       memcpy(body, arg, sizeof(*body));
-       cpu_to_le16s(&body->aid);
-       cpu_to_le32s(&body->operational_rate_set);
+       body->aid = cpu_to_le16(aid);
+       body->beacon_lost_count = beacon_lost_count;
        wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS,
                        sizeof(*body));
        ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
index f8520a14c14cdeae03dbb9334567df7ad40700ac..038ea54e25748e5fd997f3a8e48dece199752220 100644 (file)
@@ -48,8 +48,7 @@ int hif_stop_scan(struct wfx_vif *wvif);
 int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
             struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);
 int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout);
-int hif_set_bss_params(struct wfx_vif *wvif,
-                      const struct hif_req_set_bss_params *arg);
+int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count);
 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,
index 6cdb40a059917e8e28fab3d2514db207124fb8cc..1cc437f0bc81473d86d5173f193a7c82bb90a541 100644 (file)
@@ -470,16 +470,11 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 static void wfx_join_finalize(struct wfx_vif *wvif,
                              struct ieee80211_bss_conf *info)
 {
-       struct hif_req_set_bss_params bss_params = {
-               // beacon_loss_count is defined to 7 in net/mac80211/mlme.c.
-               // Let's use the same value.
-               .beacon_lost_count = 7,
-               .aid = info->aid,
-       };
-
        hif_set_association_mode(wvif, info);
        hif_keep_alive_period(wvif, 0);
-       hif_set_bss_params(wvif, &bss_params);
+       // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
+       // the same value.
+       hif_set_bss_params(wvif, info->aid, 7);
        hif_set_beacon_wakeup_period(wvif, 1, 1);
        wfx_update_pm(wvif);