staging: wfx: replace wfx_tx_queues_get_after_dtim() by wfx_tx_queues_has_cab()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Wed, 1 Apr 2020 11:03:53 +0000 (13:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Apr 2020 06:55:36 +0000 (08:55 +0200)
It is not necessary to return a skb. Just getting the information if
there is traffic to be sent after DTIM is sufficient.

In add, the acronym "cab" (Content After (DTIM) Beacon) is used in
mac80211 to designate this kind of traffic.

So, make wfx_tx_queues_get_after_dtim() return a boolean and rename
accordingly.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200401110405.80282-21-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/queue.c
drivers/staging/wfx/queue.h
drivers/staging/wfx/sta.c

index 046aba77618a0b5d1117522383688da085e01b8a..4ddb2c7370cdbb7f0a6fe5cd87a0d11e34a5cbb0 100644 (file)
@@ -264,6 +264,26 @@ unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev,
        return ktime_us_delta(now, tx_priv->xmit_timestamp);
 }
 
+bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
+{
+       struct wfx_dev *wdev = wvif->wdev;
+       struct ieee80211_tx_info *tx_info;
+       struct hif_msg *hif;
+       struct sk_buff *skb;
+       int i;
+
+       for (i = 0; i < IEEE80211_NUM_ACS; ++i) {
+               skb_queue_walk(&wdev->tx_queue[i].queue, skb) {
+                       tx_info = IEEE80211_SKB_CB(skb);
+                       hif = (struct hif_msg *)skb->data;
+                       if ((tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) &&
+                           (hif->interface == wvif->id))
+                               return true;
+               }
+       }
+       return false;
+}
+
 bool wfx_tx_queues_empty(struct wfx_dev *wdev)
 {
        int i;
@@ -344,26 +364,6 @@ static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif)
        return &wvif->wdev->tx_queue[winner];
 }
 
-struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif)
-{
-       struct wfx_dev *wdev = wvif->wdev;
-       struct ieee80211_tx_info *tx_info;
-       struct hif_msg *hif;
-       struct sk_buff *skb;
-       int i;
-
-       for (i = 0; i < IEEE80211_NUM_ACS; ++i) {
-               skb_queue_walk(&wdev->tx_queue[i].queue, skb) {
-                       tx_info = IEEE80211_SKB_CB(skb);
-                       hif = (struct hif_msg *)skb->data;
-                       if ((tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) &&
-                           (hif->interface == wvif->id))
-                               return (struct hif_msg *)skb->data;
-               }
-       }
-       return NULL;
-}
-
 struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
 {
        struct sk_buff *skb;
index 39c265e4b86ef90aaf44fcce9dc3e41b65c63892..2c4724699ed038eb74a4912d24219d201b8e90b4 100644 (file)
@@ -36,9 +36,9 @@ void wfx_tx_queues_init(struct wfx_dev *wdev);
 void wfx_tx_queues_deinit(struct wfx_dev *wdev);
 void wfx_tx_queues_clear(struct wfx_dev *wdev);
 bool wfx_tx_queues_empty(struct wfx_dev *wdev);
+bool wfx_tx_queues_has_cab(struct wfx_vif *wvif);
 void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif);
 struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev);
-struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif);
 
 void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
                      struct sk_buff *skb);
index 5c5b52dc7bdd4b02a809edadd30c2ec320ea6efc..e1d7a0670c9db8d1a4a51e1bc20546f264cfa9a0 100644 (file)
@@ -857,7 +857,7 @@ static int wfx_update_tim(struct wfx_vif *wvif)
                tim_ptr[2] = 0;
 
                /* Set/reset aid0 bit */
-               if (wfx_tx_queues_get_after_dtim(wvif))
+               if (wfx_tx_queues_has_cab(wvif))
                        tim_ptr[4] |= 1;
                else
                        tim_ptr[4] &= ~1;
@@ -888,7 +888,7 @@ int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set)
 
 void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd)
 {
-       WARN(!wfx_tx_queues_get_after_dtim(wvif), "incorrect sequence");
+       WARN(!wfx_tx_queues_has_cab(wvif), "incorrect sequence");
        WARN(wvif->after_dtim_tx_allowed, "incorrect sequence");
        wvif->after_dtim_tx_allowed = true;
        wfx_bh_request_tx(wvif->wdev);