]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
staging: wfx: implement cancel_hw_scan()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Tue, 17 Dec 2019 16:15:41 +0000 (16:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 14:56:33 +0000 (15:56 +0100)
The device provides an API to abort a scan request. Expose this feature
to mac80211.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20191217161318.31402-55-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/main.c
drivers/staging/wfx/scan.c
drivers/staging/wfx/scan.h
drivers/staging/wfx/wfx.h

index cf4bcb14a12d20b828888f0d7c0aabcff5ce6145..45c9939b7e620d9b420fd5b7ca334609cae56544 100644 (file)
@@ -135,6 +135,7 @@ static const struct ieee80211_ops wfx_ops = {
        .tx                     = wfx_tx,
        .conf_tx                = wfx_conf_tx,
        .hw_scan                = wfx_hw_scan,
+       .cancel_hw_scan         = wfx_cancel_hw_scan,
        .sta_add                = wfx_sta_add,
        .sta_remove             = wfx_sta_remove,
        .sta_notify             = wfx_sta_notify,
index dde2f8868147f76f206a2658d171810a9642e3c7..24061d09c40482f76af1f0bd3c5ea064e6626097 100644 (file)
@@ -54,6 +54,7 @@ static int send_scan_req(struct wfx_vif *wvif,
                        break;
        }
        wfx_tx_lock_flush(wvif->wdev);
+       wvif->scan_abort = false;
        reinit_completion(&wvif->scan_complete);
        ret = hif_scan(wvif, req, start_idx, i - start_idx);
        if (ret < 0)
@@ -68,6 +69,10 @@ static int send_scan_req(struct wfx_vif *wvif,
                hif_stop_scan(wvif);
                return -ETIMEDOUT;
        }
+       if (wvif->scan_abort) {
+               dev_notice(wvif->wdev->dev, "scan abort\n");
+               return -ECONNABORTED;
+       }
        return i - start_idx;
 }
 
@@ -115,6 +120,14 @@ int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        return 0;
 }
 
+void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+       struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+
+       wvif->scan_abort = true;
+       hif_stop_scan(wvif);
+}
+
 void wfx_scan_complete(struct wfx_vif *wvif,
                       const struct hif_ind_scan_cmpl *arg)
 {
index b547f1927d72f0f24e11cf958acfd90e666b01d8..bba9f15a9ff5fde7c0d0e393451bea0ef106878e 100644 (file)
@@ -18,6 +18,7 @@ struct wfx_vif;
 void wfx_hw_scan_work(struct work_struct *work);
 int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                struct ieee80211_scan_request *req);
+void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 void wfx_scan_complete(struct wfx_vif *wvif,
                       const struct hif_ind_scan_cmpl *ind);
 
index db433bee87aff21823ca08c8da3ff0c0221d6b7a..0a3df382af03c289174b2426b4c5f8145efa7c51 100644 (file)
@@ -127,6 +127,7 @@ struct wfx_vif {
        struct mutex            scan_lock;
        struct work_struct      scan_work;
        struct completion       scan_complete;
+       bool                    scan_abort;
        struct ieee80211_scan_request *scan_req;
 
        struct completion       set_pm_mode_complete;