Commit b6ef1549 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman
Browse files

staging: wfx: replace wfx_tx_queues_get_after_dtim() by wfx_tx_queues_has_cab()



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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200401110405.80282-21-Jerome.Pouiller@silabs.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bf325bef
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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);