aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/tx.c')
-rw-r--r--drivers/net/wireless/libertas/tx.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 131ef3fe0337..4cb39d33003c 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -64,11 +64,11 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
64 u8 *p802x_hdr; 64 u8 *p802x_hdr;
65 struct tx_radiotap_hdr *pradiotap_hdr; 65 struct tx_radiotap_hdr *pradiotap_hdr;
66 u32 new_rate; 66 u32 new_rate;
67 u8 *ptr = priv->adapter->tmptxbuf; 67 u8 *ptr = priv->tmptxbuf;
68 68
69 lbs_deb_enter(LBS_DEB_TX); 69 lbs_deb_enter(LBS_DEB_TX);
70 70
71 if (priv->adapter->surpriseremoved) 71 if (priv->surpriseremoved)
72 return -1; 72 return -1;
73 73
74 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { 74 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
@@ -86,7 +86,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
86 plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); 86 plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
87 87
88 p802x_hdr = skb->data; 88 p802x_hdr = skb->data;
89 if (priv->adapter->monitormode != LBS_MONITOR_OFF) { 89 if (priv->monitormode != LBS_MONITOR_OFF) {
90 90
91 /* locate radiotap header */ 91 /* locate radiotap header */
92 pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data; 92 pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data;
@@ -106,7 +106,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
106 106
107 } 107 }
108 /* copy destination address from 802.3 or 802.11 header */ 108 /* copy destination address from 802.3 or 802.11 header */
109 if (priv->adapter->monitormode != LBS_MONITOR_OFF) 109 if (priv->monitormode != LBS_MONITOR_OFF)
110 memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); 110 memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN);
111 else 111 else
112 memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); 112 memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN);
@@ -124,7 +124,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
124 lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); 124 lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
125 memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); 125 memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
126 ret = priv->hw_host_to_card(priv, MVMS_DAT, 126 ret = priv->hw_host_to_card(priv, MVMS_DAT,
127 priv->adapter->tmptxbuf, 127 priv->tmptxbuf,
128 le16_to_cpu(plocaltxpd->tx_packet_length) + 128 le16_to_cpu(plocaltxpd->tx_packet_length) +
129 sizeof(struct txpd)); 129 sizeof(struct txpd));
130 130
@@ -144,7 +144,7 @@ done:
144 priv->stats.tx_errors++; 144 priv->stats.tx_errors++;
145 } 145 }
146 146
147 if (!ret && priv->adapter->monitormode != LBS_MONITOR_OFF) { 147 if (!ret && priv->monitormode != LBS_MONITOR_OFF) {
148 /* Keep the skb to echo it back once Tx feedback is 148 /* Keep the skb to echo it back once Tx feedback is
149 received from FW */ 149 received from FW */
150 skb_orphan(skb); 150 skb_orphan(skb);
@@ -154,7 +154,7 @@ done:
154 netif_stop_queue(priv->mesh_dev); 154 netif_stop_queue(priv->mesh_dev);
155 155
156 /* Keep the skb around for when we get feedback */ 156 /* Keep the skb around for when we get feedback */
157 priv->adapter->currenttxskb = skb; 157 priv->currenttxskb = skb;
158 } else { 158 } else {
159 dev_kfree_skb_any(skb); 159 dev_kfree_skb_any(skb);
160 } 160 }
@@ -166,29 +166,27 @@ done:
166 166
167void lbs_tx_runqueue(struct lbs_private *priv) 167void lbs_tx_runqueue(struct lbs_private *priv)
168{ 168{
169 struct lbs_adapter *adapter = priv->adapter;
170 int i; 169 int i;
171 170
172 spin_lock(&adapter->txqueue_lock); 171 spin_lock(&priv->txqueue_lock);
173 for (i = 0; i < adapter->tx_queue_idx; i++) { 172 for (i = 0; i < priv->tx_queue_idx; i++) {
174 struct sk_buff *skb = adapter->tx_queue_ps[i]; 173 struct sk_buff *skb = priv->tx_queue_ps[i];
175 spin_unlock(&adapter->txqueue_lock); 174 spin_unlock(&priv->txqueue_lock);
176 SendSinglePacket(priv, skb); 175 SendSinglePacket(priv, skb);
177 spin_lock(&adapter->txqueue_lock); 176 spin_lock(&priv->txqueue_lock);
178 } 177 }
179 adapter->tx_queue_idx = 0; 178 priv->tx_queue_idx = 0;
180 spin_unlock(&adapter->txqueue_lock); 179 spin_unlock(&priv->txqueue_lock);
181} 180}
182 181
183static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) 182static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb)
184{ 183{
185 struct lbs_adapter *adapter = priv->adapter;
186 184
187 spin_lock(&adapter->txqueue_lock); 185 spin_lock(&priv->txqueue_lock);
188 186
189 WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); 187 WARN_ON(priv->tx_queue_idx >= NR_TX_QUEUE);
190 adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; 188 priv->tx_queue_ps[priv->tx_queue_idx++] = skb;
191 if (adapter->tx_queue_idx == NR_TX_QUEUE) { 189 if (priv->tx_queue_idx == NR_TX_QUEUE) {
192 netif_stop_queue(priv->dev); 190 netif_stop_queue(priv->dev);
193 if (priv->mesh_dev) 191 if (priv->mesh_dev)
194 netif_stop_queue(priv->mesh_dev); 192 netif_stop_queue(priv->mesh_dev);
@@ -198,7 +196,7 @@ static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb)
198 netif_start_queue(priv->mesh_dev); 196 netif_start_queue(priv->mesh_dev);
199 } 197 }
200 198
201 spin_unlock(&adapter->txqueue_lock); 199 spin_unlock(&priv->txqueue_lock);
202} 200}
203 201
204/** 202/**
@@ -221,8 +219,8 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb)
221 goto done; 219 goto done;
222 } 220 }
223 221
224 if ((priv->adapter->psstate == PS_STATE_SLEEP) || 222 if ((priv->psstate == PS_STATE_SLEEP) ||
225 (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) { 223 (priv->psstate == PS_STATE_PRE_SLEEP)) {
226 lbs_tx_queue(priv, skb); 224 lbs_tx_queue(priv, skb);
227 return ret; 225 return ret;
228 } 226 }
@@ -244,17 +242,16 @@ done:
244 */ 242 */
245void lbs_send_tx_feedback(struct lbs_private *priv) 243void lbs_send_tx_feedback(struct lbs_private *priv)
246{ 244{
247 struct lbs_adapter *adapter = priv->adapter;
248 struct tx_radiotap_hdr *radiotap_hdr; 245 struct tx_radiotap_hdr *radiotap_hdr;
249 u32 status = adapter->eventcause; 246 u32 status = priv->eventcause;
250 int txfail; 247 int txfail;
251 int try_count; 248 int try_count;
252 249
253 if (adapter->monitormode == LBS_MONITOR_OFF || 250 if (priv->monitormode == LBS_MONITOR_OFF ||
254 adapter->currenttxskb == NULL) 251 priv->currenttxskb == NULL)
255 return; 252 return;
256 253
257 radiotap_hdr = (struct tx_radiotap_hdr *)adapter->currenttxskb->data; 254 radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data;
258 255
259 txfail = (status >> 24); 256 txfail = (status >> 24);
260 257
@@ -267,14 +264,14 @@ void lbs_send_tx_feedback(struct lbs_private *priv)
267#endif 264#endif
268 try_count = (status >> 16) & 0xff; 265 try_count = (status >> 16) & 0xff;
269 radiotap_hdr->data_retries = (try_count) ? 266 radiotap_hdr->data_retries = (try_count) ?
270 (1 + adapter->txretrycount - try_count) : 0; 267 (1 + priv->txretrycount - try_count) : 0;
271 lbs_upload_rx_packet(priv, adapter->currenttxskb); 268 lbs_upload_rx_packet(priv, priv->currenttxskb);
272 adapter->currenttxskb = NULL; 269 priv->currenttxskb = NULL;
273 270
274 if (adapter->connect_status == LBS_CONNECTED) 271 if (priv->connect_status == LBS_CONNECTED)
275 netif_wake_queue(priv->dev); 272 netif_wake_queue(priv->dev);
276 273
277 if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) 274 if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED))
278 netif_wake_queue(priv->mesh_dev); 275 netif_wake_queue(priv->mesh_dev);
279} 276}
280EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); 277EXPORT_SYMBOL_GPL(lbs_send_tx_feedback);