diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-helpers.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-helpers.h | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 1aaef70deae..3f5bedd8875 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h | |||
@@ -44,15 +44,6 @@ static inline struct ieee80211_conf *ieee80211_get_hw_conf( | |||
44 | return &hw->conf; | 44 | return &hw->conf; |
45 | } | 45 | } |
46 | 46 | ||
47 | static inline unsigned long elapsed_jiffies(unsigned long start, | ||
48 | unsigned long end) | ||
49 | { | ||
50 | if (end >= start) | ||
51 | return end - start; | ||
52 | |||
53 | return end + (MAX_JIFFY_OFFSET - start) + 1; | ||
54 | } | ||
55 | |||
56 | /** | 47 | /** |
57 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning | 48 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning |
58 | * @index -- current index | 49 | * @index -- current index |
@@ -104,42 +95,36 @@ static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, | |||
104 | * | | | | | | | | | 95 | * | | | | | | | | |
105 | * | | | | | | +-+-------- AC queue (0-3) | 96 | * | | | | | | +-+-------- AC queue (0-3) |
106 | * | | | | | | | 97 | * | | | | | | |
107 | * | +-+-+-+-+------------ HW A-MPDU queue | 98 | * | +-+-+-+-+------------ HW queue ID |
108 | * | | 99 | * | |
109 | * +---------------------- indicates agg queue | 100 | * +---------------------- unused |
110 | */ | 101 | */ |
111 | static inline u8 iwl_virtual_agg_queue_num(u8 ac, u8 hwq) | 102 | static inline void iwl_set_swq_id(struct iwl_tx_queue *txq, u8 ac, u8 hwq) |
112 | { | 103 | { |
113 | BUG_ON(ac > 3); /* only have 2 bits */ | 104 | BUG_ON(ac > 3); /* only have 2 bits */ |
114 | BUG_ON(hwq > 31); /* only have 5 bits */ | 105 | BUG_ON(hwq > 31); /* only use 5 bits */ |
115 | 106 | ||
116 | return 0x80 | (hwq << 2) | ac; | 107 | txq->swq_id = (hwq << 2) | ac; |
117 | } | 108 | } |
118 | 109 | ||
119 | static inline void iwl_wake_queue(struct iwl_priv *priv, u8 queue) | 110 | static inline void iwl_wake_queue(struct iwl_priv *priv, |
111 | struct iwl_tx_queue *txq) | ||
120 | { | 112 | { |
121 | u8 ac = queue; | 113 | u8 queue = txq->swq_id; |
122 | u8 hwq = queue; | 114 | u8 ac = queue & 3; |
123 | 115 | u8 hwq = (queue >> 2) & 0x1f; | |
124 | if (queue & 0x80) { | ||
125 | ac = queue & 3; | ||
126 | hwq = (queue >> 2) & 0x1f; | ||
127 | } | ||
128 | 116 | ||
129 | if (test_and_clear_bit(hwq, priv->queue_stopped)) | 117 | if (test_and_clear_bit(hwq, priv->queue_stopped)) |
130 | if (atomic_dec_return(&priv->queue_stop_count[ac]) <= 0) | 118 | if (atomic_dec_return(&priv->queue_stop_count[ac]) <= 0) |
131 | ieee80211_wake_queue(priv->hw, ac); | 119 | ieee80211_wake_queue(priv->hw, ac); |
132 | } | 120 | } |
133 | 121 | ||
134 | static inline void iwl_stop_queue(struct iwl_priv *priv, u8 queue) | 122 | static inline void iwl_stop_queue(struct iwl_priv *priv, |
123 | struct iwl_tx_queue *txq) | ||
135 | { | 124 | { |
136 | u8 ac = queue; | 125 | u8 queue = txq->swq_id; |
137 | u8 hwq = queue; | 126 | u8 ac = queue & 3; |
138 | 127 | u8 hwq = (queue >> 2) & 0x1f; | |
139 | if (queue & 0x80) { | ||
140 | ac = queue & 3; | ||
141 | hwq = (queue >> 2) & 0x1f; | ||
142 | } | ||
143 | 128 | ||
144 | if (!test_and_set_bit(hwq, priv->queue_stopped)) | 129 | if (!test_and_set_bit(hwq, priv->queue_stopped)) |
145 | if (atomic_inc_return(&priv->queue_stop_count[ac]) > 0) | 130 | if (atomic_inc_return(&priv->queue_stop_count[ac]) > 0) |