aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 6c8a33b6ee22..50590b1420a5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -61,7 +61,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp)
61 * at least 8 bytes bytes available in headroom for IV/EIV 61 * at least 8 bytes bytes available in headroom for IV/EIV
62 * and 8 bytes for ICV data as tailroon. 62 * and 8 bytes for ICV data as tailroon.
63 */ 63 */
64 if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) { 64 if (rt2x00_has_cap_hw_crypto(rt2x00dev)) {
65 head_size += 8; 65 head_size += 8;
66 tail_size += 8; 66 tail_size += 8;
67 } 67 }
@@ -1033,38 +1033,21 @@ EXPORT_SYMBOL_GPL(rt2x00queue_stop_queue);
1033 1033
1034void rt2x00queue_flush_queue(struct data_queue *queue, bool drop) 1034void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
1035{ 1035{
1036 bool started;
1037 bool tx_queue = 1036 bool tx_queue =
1038 (queue->qid == QID_AC_VO) || 1037 (queue->qid == QID_AC_VO) ||
1039 (queue->qid == QID_AC_VI) || 1038 (queue->qid == QID_AC_VI) ||
1040 (queue->qid == QID_AC_BE) || 1039 (queue->qid == QID_AC_BE) ||
1041 (queue->qid == QID_AC_BK); 1040 (queue->qid == QID_AC_BK);
1042 1041
1043 mutex_lock(&queue->status_lock);
1044 1042
1045 /* 1043 /*
1046 * If the queue has been started, we must stop it temporarily 1044 * If we are not supposed to drop any pending
1047 * to prevent any new frames to be queued on the device. If 1045 * frames, this means we must force a start (=kick)
1048 * we are not dropping the pending frames, the queue must 1046 * to the queue to make sure the hardware will
1049 * only be stopped in the software and not the hardware, 1047 * start transmitting.
1050 * otherwise the queue will never become empty on its own.
1051 */ 1048 */
1052 started = test_bit(QUEUE_STARTED, &queue->flags); 1049 if (!drop && tx_queue)
1053 if (started) { 1050 queue->rt2x00dev->ops->lib->kick_queue(queue);
1054 /*
1055 * Pause the queue
1056 */
1057 rt2x00queue_pause_queue(queue);
1058
1059 /*
1060 * If we are not supposed to drop any pending
1061 * frames, this means we must force a start (=kick)
1062 * to the queue to make sure the hardware will
1063 * start transmitting.
1064 */
1065 if (!drop && tx_queue)
1066 queue->rt2x00dev->ops->lib->kick_queue(queue);
1067 }
1068 1051
1069 /* 1052 /*
1070 * Check if driver supports flushing, if that is the case we can 1053 * Check if driver supports flushing, if that is the case we can
@@ -1080,14 +1063,6 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
1080 if (unlikely(!rt2x00queue_empty(queue))) 1063 if (unlikely(!rt2x00queue_empty(queue)))
1081 rt2x00_warn(queue->rt2x00dev, "Queue %d failed to flush\n", 1064 rt2x00_warn(queue->rt2x00dev, "Queue %d failed to flush\n",
1082 queue->qid); 1065 queue->qid);
1083
1084 /*
1085 * Restore the queue to the previous status
1086 */
1087 if (started)
1088 rt2x00queue_unpause_queue(queue);
1089
1090 mutex_unlock(&queue->status_lock);
1091} 1066}
1092EXPORT_SYMBOL_GPL(rt2x00queue_flush_queue); 1067EXPORT_SYMBOL_GPL(rt2x00queue_flush_queue);
1093 1068