Skip to content

Commit

Permalink
Bluetooth: handle priority change within quote
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luiz Augusto von Dentz authored and Gustavo F. Padovan committed Nov 7, 2011
1 parent 73d80de commit ec1cce2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ec1cce2

Please sign in to comment.