Commit 3deff760 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k_htc: Increase URB count for REG_IN pipe

Using a single URB for receiving WMI events is
insufficient, increase it to 64 to not lose
WMI events in high throughput situations.
Signed-off-by: default avatarSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 16c56ae8
...@@ -566,6 +566,9 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) ...@@ -566,6 +566,9 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
case -ESHUTDOWN: case -ESHUTDOWN:
goto free; goto free;
default: default:
skb_reset_tail_pointer(skb);
skb_trim(skb, 0);
goto resubmit; goto resubmit;
} }
...@@ -590,23 +593,15 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) ...@@ -590,23 +593,15 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
nskb->data, MAX_REG_IN_BUF_SIZE, nskb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, nskb); ath9k_hif_usb_reg_in_cb, nskb);
ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret) {
kfree_skb(nskb);
urb->context = NULL;
}
return;
} }
resubmit: resubmit:
skb_reset_tail_pointer(skb); usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
skb_trim(skb, 0);
ret = usb_submit_urb(urb, GFP_ATOMIC); ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret) if (ret) {
usb_unanchor_urb(urb);
goto free; goto free;
}
return; return;
free: free:
...@@ -747,43 +742,67 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) ...@@ -747,43 +742,67 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
return ret; return ret;
} }
static void ath9k_hif_usb_dealloc_reg_in_urb(struct hif_device_usb *hif_dev) static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)
{ {
if (hif_dev->reg_in_urb) { usb_kill_anchored_urbs(&hif_dev->reg_in_submitted);
usb_kill_urb(hif_dev->reg_in_urb);
if (hif_dev->reg_in_urb->context)
kfree_skb((void *)hif_dev->reg_in_urb->context);
usb_free_urb(hif_dev->reg_in_urb);
hif_dev->reg_in_urb = NULL;
}
} }
static int ath9k_hif_usb_alloc_reg_in_urb(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
{ {
struct sk_buff *skb; struct urb *urb = NULL;
struct sk_buff *skb = NULL;
int i, ret;
hif_dev->reg_in_urb = usb_alloc_urb(0, GFP_KERNEL); init_usb_anchor(&hif_dev->reg_in_submitted);
if (hif_dev->reg_in_urb == NULL)
return -ENOMEM; for (i = 0; i < MAX_REG_IN_URB_NUM; i++) {
/* Allocate URB */
urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) {
ret = -ENOMEM;
goto err_urb;
}
/* Allocate buffer */
skb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_KERNEL); skb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_KERNEL);
if (!skb) if (!skb) {
goto err; ret = -ENOMEM;
goto err_skb;
}
usb_fill_bulk_urb(hif_dev->reg_in_urb, hif_dev->udev, usb_fill_bulk_urb(urb, hif_dev->udev,
usb_rcvbulkpipe(hif_dev->udev, usb_rcvbulkpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
skb->data, MAX_REG_IN_BUF_SIZE, skb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, skb); ath9k_hif_usb_reg_in_cb, skb);
if (usb_submit_urb(hif_dev->reg_in_urb, GFP_KERNEL) != 0) /* Anchor URB */
goto err; usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
/* Submit URB */
ret = usb_submit_urb(urb, GFP_KERNEL);
if (ret) {
usb_unanchor_urb(urb);
goto err_submit;
}
/*
* Drop reference count.
* This ensures that the URB is freed when killing them.
*/
usb_free_urb(urb);
}
return 0; return 0;
err: err_submit:
ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); kfree_skb(skb);
return -ENOMEM; err_skb:
usb_free_urb(urb);
err_urb:
ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
return ret;
} }
static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)
...@@ -800,7 +819,7 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) ...@@ -800,7 +819,7 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)
goto err_rx; goto err_rx;
/* Register Read */ /* Register Read */
if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0) if (ath9k_hif_usb_alloc_reg_in_urbs(hif_dev) < 0)
goto err_reg; goto err_reg;
return 0; return 0;
...@@ -815,7 +834,7 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) ...@@ -815,7 +834,7 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)
static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev)
{ {
usb_kill_anchored_urbs(&hif_dev->regout_submitted); usb_kill_anchored_urbs(&hif_dev->regout_submitted);
ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
ath9k_hif_usb_dealloc_tx_urbs(hif_dev); ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
ath9k_hif_usb_dealloc_rx_urbs(hif_dev); ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define MAX_PKT_NUM_IN_TRANSFER 10 #define MAX_PKT_NUM_IN_TRANSFER 10
#define MAX_REG_OUT_URB_NUM 1 #define MAX_REG_OUT_URB_NUM 1
#define MAX_REG_OUT_BUF_NUM 8 #define MAX_REG_IN_URB_NUM 64
#define MAX_REG_IN_BUF_SIZE 64 #define MAX_REG_IN_BUF_SIZE 64
...@@ -90,9 +90,9 @@ struct hif_device_usb { ...@@ -90,9 +90,9 @@ struct hif_device_usb {
const struct firmware *firmware; const struct firmware *firmware;
struct htc_target *htc_handle; struct htc_target *htc_handle;
struct hif_usb_tx tx; struct hif_usb_tx tx;
struct urb *reg_in_urb;
struct usb_anchor regout_submitted; struct usb_anchor regout_submitted;
struct usb_anchor rx_submitted; struct usb_anchor rx_submitted;
struct usb_anchor reg_in_submitted;
struct sk_buff *remain_skb; struct sk_buff *remain_skb;
const char *fw_name; const char *fw_name;
int rx_remain_len; int rx_remain_len;
......
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