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

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: 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-14-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 062a6c41
...@@ -144,22 +144,15 @@ void wfx_tx_queues_deinit(struct wfx_dev *wdev) ...@@ -144,22 +144,15 @@ void wfx_tx_queues_deinit(struct wfx_dev *wdev)
wfx_tx_queues_clear(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; int ret, i;
if (!link_id_map) ret = 0;
return 0;
spin_lock_bh(&queue->queue.lock); spin_lock_bh(&queue->queue.lock);
if (link_id_map == (u32)-1) { for (i = 0; i < ARRAY_SIZE(queue->link_map_cache); i++)
ret = skb_queue_len(&queue->queue); if (i != WFX_LINK_ID_AFTER_DTIM)
} else { ret += queue->link_map_cache[i];
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];
}
spin_unlock_bh(&queue->queue.lock); spin_unlock_bh(&queue->queue.lock);
return ret; return ret;
} }
...@@ -354,7 +347,7 @@ static bool wfx_handle_tx_data(struct wfx_dev *wdev, struct sk_buff *skb) ...@@ -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; const struct ieee80211_tx_queue_params *edca;
unsigned int score, best = -1; unsigned int score, best = -1;
...@@ -366,8 +359,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) ...@@ -366,8 +359,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask)
int queued; int queued;
edca = &wvif->edca_params[i]; edca = &wvif->edca_params[i];
queued = wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[i], queued = wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[i]);
tx_allowed_mask);
if (!queued) if (!queued)
continue; continue;
score = ((edca->aifs + edca->cw_min) << 16) + 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) ...@@ -379,23 +371,9 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask)
} }
} }
return winner; if (winner < 0)
}
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)
return NULL; return NULL;
return &wvif->wdev->tx_queue[winner];
*tx_allowed_mask_p = tx_allowed_mask;
return &wvif->wdev->tx_queue[idx];
} }
struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif) 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) ...@@ -424,8 +402,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
struct hif_msg *hif = NULL; struct hif_msg *hif = NULL;
struct wfx_queue *queue = NULL; struct wfx_queue *queue = NULL;
struct wfx_queue *vif_queue = NULL; struct wfx_queue *vif_queue = NULL;
u32 tx_allowed_mask = 0;
u32 vif_tx_allowed_mask = 0;
struct wfx_vif *wvif; struct wfx_vif *wvif;
int i; int i;
...@@ -459,12 +435,10 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) ...@@ -459,12 +435,10 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
wvif = NULL; wvif = NULL;
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
vif_queue = wfx_tx_queue_mask_get(wvif, vif_queue = wfx_tx_queue_mask_get(wvif);
&vif_tx_allowed_mask);
if (vif_queue) { if (vif_queue) {
if (queue && queue != vif_queue) if (queue && queue != vif_queue)
dev_info(wdev->dev, "vifs disagree about queue priority\n"); dev_info(wdev->dev, "vifs disagree about queue priority\n");
tx_allowed_mask |= vif_tx_allowed_mask;
queue = vif_queue; queue = vif_queue;
ret = 0; ret = 0;
} }
...@@ -475,7 +449,7 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) ...@@ -475,7 +449,7 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
queue_num = queue - wdev->tx_queue; 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) if (!skb)
continue; continue;
......
...@@ -47,7 +47,7 @@ struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif); ...@@ -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, void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff *skb); 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); 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); int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment