From b6ef154973384439c663f8c5fde0eafa51e54309 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Wed, 1 Apr 2020 13:03:53 +0200 Subject: [PATCH] staging: wfx: replace wfx_tx_queues_get_after_dtim() by wfx_tx_queues_has_cab() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200401110405.80282-21-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/queue.c | 40 ++++++++++++++++++++-------------------- drivers/staging/wfx/queue.h | 2 +- drivers/staging/wfx/sta.c | 4 ++-- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 046aba7..4ddb2c7 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -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; diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 39c265e..2c47246 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -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); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 5c5b52d..e1d7a06 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -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); -- 2.7.4