diff options
author | Jérôme Pouiller <jerome.pouiller@silabs.com> | 2020-04-01 13:03:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-13 08:55:35 +0200 |
commit | af72697196dcb9d23484ae32ea096955f715c1d1 (patch) | |
tree | 45b46109a3f583b9fc9e769efe059e1ad50917b3 /drivers/staging | |
parent | 062a6c410258ca2e66f377e54ee229c937504e22 (diff) |
staging: wfx: drop argument tx_allowed_mask since it is constant now
Following the remove of asleep_mask, the tx_allowed_mask argument passed
to various functions is now always the same. Drop this argument and
simplify the code.
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-14-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/wfx/queue.c | 48 | ||||
-rw-r--r-- | drivers/staging/wfx/queue.h | 2 |
2 files changed, 12 insertions, 38 deletions
diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index e66debd60e3f..cecf9aa7b3ca 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -144,22 +144,15 @@ void wfx_tx_queues_deinit(struct wfx_dev *wdev) wfx_tx_queues_clear(wdev); } -int wfx_tx_queue_get_num_queued(struct wfx_queue *queue, u32 link_id_map) +int wfx_tx_queue_get_num_queued(struct wfx_queue *queue) { int ret, i; - if (!link_id_map) - return 0; - + ret = 0; spin_lock_bh(&queue->queue.lock); - if (link_id_map == (u32)-1) { - ret = skb_queue_len(&queue->queue); - } else { - ret = 0; - for (i = 0; i < ARRAY_SIZE(queue->link_map_cache); i++) - if (link_id_map & BIT(i)) - ret += queue->link_map_cache[i]; - } + for (i = 0; i < ARRAY_SIZE(queue->link_map_cache); i++) + if (i != WFX_LINK_ID_AFTER_DTIM) + ret += queue->link_map_cache[i]; spin_unlock_bh(&queue->queue.lock); return ret; } @@ -354,7 +347,7 @@ static bool wfx_handle_tx_data(struct wfx_dev *wdev, struct sk_buff *skb) } } -static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) +static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif) { const struct ieee80211_tx_queue_params *edca; unsigned int score, best = -1; @@ -366,8 +359,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) int queued; edca = &wvif->edca_params[i]; - queued = wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[i], - tx_allowed_mask); + queued = wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[i]); if (!queued) continue; score = ((edca->aifs + edca->cw_min) << 16) + @@ -379,23 +371,9 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) } } - return winner; -} - -static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif, - u32 *tx_allowed_mask_p) -{ - int idx; - u32 tx_allowed_mask; - - tx_allowed_mask = BIT(WFX_LINK_ID_MAX) - 1; - tx_allowed_mask &= ~BIT(WFX_LINK_ID_AFTER_DTIM); - idx = wfx_get_prio_queue(wvif, tx_allowed_mask); - if (idx < 0) + if (winner < 0) return NULL; - - *tx_allowed_mask_p = tx_allowed_mask; - return &wvif->wdev->tx_queue[idx]; + return &wvif->wdev->tx_queue[winner]; } struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif) @@ -424,8 +402,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) struct hif_msg *hif = NULL; struct wfx_queue *queue = NULL; struct wfx_queue *vif_queue = NULL; - u32 tx_allowed_mask = 0; - u32 vif_tx_allowed_mask = 0; struct wfx_vif *wvif; int i; @@ -459,12 +435,10 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - vif_queue = wfx_tx_queue_mask_get(wvif, - &vif_tx_allowed_mask); + vif_queue = wfx_tx_queue_mask_get(wvif); if (vif_queue) { if (queue && queue != vif_queue) dev_info(wdev->dev, "vifs disagree about queue priority\n"); - tx_allowed_mask |= vif_tx_allowed_mask; queue = vif_queue; ret = 0; } @@ -475,7 +449,7 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) queue_num = queue - wdev->tx_queue; - skb = wfx_tx_queue_get(wdev, queue, tx_allowed_mask); + skb = wfx_tx_queue_get(wdev, queue, ~BIT(WFX_LINK_ID_AFTER_DTIM)); if (!skb) continue; diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 5a5aa38dbb2f..58da216d47dd 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -47,7 +47,7 @@ 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); -int wfx_tx_queue_get_num_queued(struct wfx_queue *queue, u32 link_id_map); +int wfx_tx_queue_get_num_queued(struct wfx_queue *queue); struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb); |