[RFC v2 5/5] Bluetooth: Don't schedule tx tasklet if no work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Upon receipt of the Num_Completed_Pkts event, do not schedule the
tx tasklet if there's no work to perform. Normally, the tx tasklet
will be scheduled whenever packets are queued for tx. Further
scheduling is necessary only if the tx tasklet was unable to
send all queued packets because a host buffer count dropped to 0.
While it is possible that no further packets are queued if a
buffer count is zero (and thus the tx tasklet will be needlessly
scheduled), this condition is much less frequent.

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
 net/bluetooth/hci_event.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index d9bcf7e..e6c3a94 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1947,7 +1947,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
 {
 	struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
 	__le16 *ptr;
-	int i;
+	int i, schedule = 0;
 
 	skb_pull(skb, sizeof(*ev));
 
@@ -1960,6 +1960,9 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
 
 	tasklet_disable(&hdev->tx_task);
 
+	if (!hdev->acl_cnt || !hdev->sco_cnt || (hdev->le_pkts && !hdev->le_cnt))
+		schedule++;
+
 	for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) {
 		struct hci_conn *conn;
 		__u16  handle, count;
@@ -1993,7 +1996,8 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
 		}
 	}
 
-	tasklet_schedule(&hdev->tx_task);
+	if (schedule)
+		tasklet_schedule(&hdev->tx_task);
 
 	tasklet_enable(&hdev->tx_task);
 }
-- 
1.7.4.1

��.n��������+%������w��{.n�����{����^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux