wifi: wfx: introduce hif_scan_uniq()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Wed, 4 Oct 2023 17:28:39 +0000 (19:28 +0200)
committerKalle Valo <kvalo@kernel.org>
Mon, 9 Oct 2023 06:53:07 +0000 (09:53 +0300)
Like hof_scan(), hif_scan_uniq() invoke HIF_SCAN. However, it only
allows to probe one channel and disable probe requests. It works very
well to implement Remain-On-Channel.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231004172843.195332-5-jerome.pouiller@silabs.com
drivers/net/wireless/silabs/wfx/hif_tx.c
drivers/net/wireless/silabs/wfx/hif_tx.h

index de5a31482df389c9285443dc44e8ee1d440e9741..9f403d275cb136c6e7e18d156fe56ce038a4ab84 100644 (file)
@@ -238,6 +238,31 @@ int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, s
        return ret;
 }
 
+/* Hijack scan request to implement Remain-On-Channel */
+int wfx_hif_scan_uniq(struct wfx_vif *wvif, struct ieee80211_channel *chan, int duration)
+{
+       int ret;
+       struct wfx_hif_msg *hif;
+       size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + sizeof(u8);
+       struct wfx_hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif);
+
+       if (!hif)
+               return -ENOMEM;
+       body->num_of_ssids = HIF_API_MAX_NB_SSIDS;
+       body->maintain_current_bss = 1;
+       body->disallow_ps = 1;
+       body->tx_power_level = cpu_to_le32(chan->max_power);
+       body->num_of_channels = 1;
+       body->channel_list[0] = chan->hw_value;
+       body->max_transmit_rate = API_RATE_INDEX_B_1MBPS;
+       body->min_channel_time = cpu_to_le32(duration);
+       body->max_channel_time = cpu_to_le32(duration * 110 / 100);
+       wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len);
+       ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
+       kfree(hif);
+       return ret;
+}
+
 int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
                 int chan_start_idx, int chan_num)
 {
index 71817a6571f0bec8a9869c743ead1ec07b135212..aab54df6aafa6696a8d6869785d186b3933a9bd8 100644 (file)
@@ -54,6 +54,7 @@ int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
 int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len);
 int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211,
                 int chan_start, int chan_num);
+int wfx_hif_scan_uniq(struct wfx_vif *wvif, struct ieee80211_channel *chan, int duration);
 int wfx_hif_stop_scan(struct wfx_vif *wvif);
 int wfx_hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len);
 int wfx_hif_shutdown(struct wfx_dev *wdev);