mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
Bluetooth: hci_core: Fix LE quote calculation
[ Upstream commit 932021a11805b9da4bd6abf66fe233cccd59fe0e ]
Function hci_sched_le needs to update the respective counter variable
inplace other the likes of hci_quote_sent would attempt to use the
possible outdated value of conn->{le_cnt,acl_cnt}.
Link: https://github.com/bluez/bluez/issues/915
Fixes: 73d80deb7b ("Bluetooth: prioritizing data over HCI")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
09b8a11cbe
commit
1232921f2b
@@ -3744,19 +3744,19 @@ static void hci_sched_le(struct hci_dev *hdev)
|
|||||||
{
|
{
|
||||||
struct hci_chan *chan;
|
struct hci_chan *chan;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
int quote, cnt, tmp;
|
int quote, *cnt, tmp;
|
||||||
|
|
||||||
BT_DBG("%s", hdev->name);
|
BT_DBG("%s", hdev->name);
|
||||||
|
|
||||||
if (!hci_conn_num(hdev, LE_LINK))
|
if (!hci_conn_num(hdev, LE_LINK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt;
|
cnt = hdev->le_pkts ? &hdev->le_cnt : &hdev->acl_cnt;
|
||||||
|
|
||||||
__check_timeout(hdev, cnt, LE_LINK);
|
__check_timeout(hdev, *cnt, LE_LINK);
|
||||||
|
|
||||||
tmp = cnt;
|
tmp = *cnt;
|
||||||
while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) {
|
while (*cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) {
|
||||||
u32 priority = (skb_peek(&chan->data_q))->priority;
|
u32 priority = (skb_peek(&chan->data_q))->priority;
|
||||||
while (quote-- && (skb = skb_peek(&chan->data_q))) {
|
while (quote-- && (skb = skb_peek(&chan->data_q))) {
|
||||||
BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
|
BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
|
||||||
@@ -3771,7 +3771,7 @@ static void hci_sched_le(struct hci_dev *hdev)
|
|||||||
hci_send_frame(hdev, skb);
|
hci_send_frame(hdev, skb);
|
||||||
hdev->le_last_tx = jiffies;
|
hdev->le_last_tx = jiffies;
|
||||||
|
|
||||||
cnt--;
|
(*cnt)--;
|
||||||
chan->sent++;
|
chan->sent++;
|
||||||
chan->conn->sent++;
|
chan->conn->sent++;
|
||||||
|
|
||||||
@@ -3781,12 +3781,7 @@ static void hci_sched_le(struct hci_dev *hdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdev->le_pkts)
|
if (*cnt != tmp)
|
||||||
hdev->le_cnt = cnt;
|
|
||||||
else
|
|
||||||
hdev->acl_cnt = cnt;
|
|
||||||
|
|
||||||
if (cnt != tmp)
|
|
||||||
hci_prio_recalculate(hdev, LE_LINK);
|
hci_prio_recalculate(hdev, LE_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user