aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-04-06 05:58:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-08 15:24:09 -0400
commit46baa1a24945b5813097af5a632db721f9c9d03b (patch)
tree5d25196c55cc0c9223ef2500f5065b70d5115447 /drivers/net/wireless/ath/ath9k
parent62c33447fa720d71b05bbc626b01351a4889c2d7 (diff)
ath9k_htc: Protect RX stream variables
Use a spin lock to prevent concurrent access to variables dealing with RX stream mode handling. Currently, no protection is implemented - which causes problems in RX. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 3afc747ccfbf..8838cdfcc497 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -330,6 +330,8 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
330 u16 pkt_len, pkt_tag, pool_index = 0; 330 u16 pkt_len, pkt_tag, pool_index = 0;
331 u8 *ptr; 331 u8 *ptr;
332 332
333 spin_lock(&hif_dev->rx_lock);
334
333 rx_remain_len = hif_dev->rx_remain_len; 335 rx_remain_len = hif_dev->rx_remain_len;
334 rx_pkt_len = hif_dev->rx_transfer_len; 336 rx_pkt_len = hif_dev->rx_transfer_len;
335 337
@@ -356,6 +358,8 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
356 } 358 }
357 } 359 }
358 360
361 spin_unlock(&hif_dev->rx_lock);
362
359 while (index < len) { 363 while (index < len) {
360 ptr = (u8 *) skb->data; 364 ptr = (u8 *) skb->data;
361 365
@@ -373,6 +377,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
373 index = index + 4 + pkt_len + pad_len; 377 index = index + 4 + pkt_len + pad_len;
374 378
375 if (index > MAX_RX_BUF_SIZE) { 379 if (index > MAX_RX_BUF_SIZE) {
380 spin_lock(&hif_dev->rx_lock);
376 hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; 381 hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
377 hif_dev->rx_transfer_len = 382 hif_dev->rx_transfer_len =
378 MAX_RX_BUF_SIZE - chk_idx - 4; 383 MAX_RX_BUF_SIZE - chk_idx - 4;
@@ -384,6 +389,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
384 dev_err(&hif_dev->udev->dev, 389 dev_err(&hif_dev->udev->dev,
385 "ath9k_htc: RX memory allocation" 390 "ath9k_htc: RX memory allocation"
386 " error\n"); 391 " error\n");
392 spin_unlock(&hif_dev->rx_lock);
387 goto err; 393 goto err;
388 } 394 }
389 skb_reserve(nskb, 32); 395 skb_reserve(nskb, 32);
@@ -394,6 +400,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
394 400
395 /* Record the buffer pointer */ 401 /* Record the buffer pointer */
396 hif_dev->remain_skb = nskb; 402 hif_dev->remain_skb = nskb;
403 spin_unlock(&hif_dev->rx_lock);
397 } else { 404 } else {
398 nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); 405 nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
399 if (!nskb) { 406 if (!nskb) {
@@ -612,6 +619,7 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
612 int i, ret; 619 int i, ret;
613 620
614 init_usb_anchor(&hif_dev->rx_submitted); 621 init_usb_anchor(&hif_dev->rx_submitted);
622 spin_lock_init(&hif_dev->rx_lock);
615 623
616 for (i = 0; i < MAX_RX_URB_NUM; i++) { 624 for (i = 0; i < MAX_RX_URB_NUM; i++) {
617 625
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
index ea9257bdc411..ed9708cd4aa0 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.h
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
@@ -93,6 +93,7 @@ struct hif_device_usb {
93 int rx_pkt_len; 93 int rx_pkt_len;
94 int rx_transfer_len; 94 int rx_transfer_len;
95 int rx_pad_len; 95 int rx_pad_len;
96 spinlock_t rx_lock;
96 u8 flags; /* HIF_USB_* */ 97 u8 flags; /* HIF_USB_* */
97}; 98};
98 99