aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2011-11-02 15:52:02 +0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-07 17:24:56 -0200
commitec1cce24d5950e797f10650abf7890ead67c6e64 (patch)
tree832a18b8eaff406cc0f10669ac6b4c8f0b9008f6 /net/bluetooth/hci_core.c
parent73d80deb7bdf0171f22e76dc2429c1f99eff90e2 (diff)
downloadkernel_goldelico_gta04-ec1cce24d5950e797f10650abf7890ead67c6e64.zip
kernel_goldelico_gta04-ec1cce24d5950e797f10650abf7890ead67c6e64.tar.gz
kernel_goldelico_gta04-ec1cce24d5950e797f10650abf7890ead67c6e64.tar.bz2
Bluetooth: handle priority change within quote
The quote is calculated based on the first buffer in the queue so if the priority changes to something lower than the priority of the first skb the quote needs to be recalculated. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 631327d..19e4453 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2193,10 +2193,17 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
while (hdev->acl_cnt &&
(chan = hci_chan_sent(hdev, ACL_LINK, &quote))) {
- while (quote-- && (skb = skb_dequeue(&chan->data_q))) {
+ u32 priority = (skb_peek(&chan->data_q))->priority;
+ while (quote-- && (skb = skb_peek(&chan->data_q))) {
BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
skb->len, skb->priority);
+ /* Stop if priority has changed */
+ if (skb->priority < priority)
+ break;
+
+ skb = skb_dequeue(&chan->data_q);
+
hci_conn_enter_active_mode(chan->conn,
bt_cb(skb)->force_active);
@@ -2278,10 +2285,17 @@ static inline void hci_sched_le(struct hci_dev *hdev)
cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt;
while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, &quote))) {
- while (quote-- && (skb = skb_dequeue(&chan->data_q))) {
+ u32 priority = (skb_peek(&chan->data_q))->priority;
+ while (quote-- && (skb = skb_peek(&chan->data_q))) {
BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
skb->len, skb->priority);
+ /* Stop if priority has changed */
+ if (skb->priority < priority)
+ break;
+
+ skb = skb_dequeue(&chan->data_q);
+
hci_send_frame(skb);
hdev->le_last_tx = jiffies;