* [PATCH] Bluetooth: Fix inconsistent LE packet sending behaviors
@ 2024-03-05 18:23 Yuxin Wang
2024-03-05 18:57 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Yuxin Wang @ 2024-03-05 18:23 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, Yuxin Wang
In the `hci_sched_le` function, the calculation of `quote` within
`hci_chan_sent` may become incorrect after breaking from the inner
while loop. The issue stems from `hci_chan_sent` using `hdev->le_cnt`
instead of the updated `cnt`. As a result, `quote` may exceed `cnt`,
leading to a negative `cnt` and causing further inconsistent behaviors.
This patch modifies `cnt` to be a pointer, aligning with the pattern
used in the nearby `hci_sched_iso` function.
Signed-off-by: Yuxin Wang <yuxinwang9999@gmail.com>
---
net/bluetooth/hci_core.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2821a42ce..785a6dde9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3750,19 +3750,19 @@ static void hci_sched_le(struct hci_dev *hdev)
{
struct hci_chan *chan;
struct sk_buff *skb;
- int quote, cnt, tmp;
+ int quote, *cnt, tmp;
BT_DBG("%s", hdev->name);
if (!hci_conn_num(hdev, LE_LINK))
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;
- while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) {
+ tmp = *cnt;
+ while (*cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) {
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,
@@ -3777,7 +3777,7 @@ static void hci_sched_le(struct hci_dev *hdev)
hci_send_frame(hdev, skb);
hdev->le_last_tx = jiffies;
- cnt--;
+ (*cnt)--;
chan->sent++;
chan->conn->sent++;
@@ -3787,12 +3787,7 @@ static void hci_sched_le(struct hci_dev *hdev)
}
}
- if (hdev->le_pkts)
- hdev->le_cnt = cnt;
- else
- hdev->acl_cnt = cnt;
-
- if (cnt != tmp)
+ if (*cnt != tmp)
hci_prio_recalculate(hdev, LE_LINK);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: Bluetooth: Fix inconsistent LE packet sending behaviors
2024-03-05 18:23 [PATCH] Bluetooth: Fix inconsistent LE packet sending behaviors Yuxin Wang
@ 2024-03-05 18:57 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2024-03-05 18:57 UTC (permalink / raw)
To: linux-bluetooth, yuxinwang9999
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=832651
---Test result---
Test Summary:
CheckPatch PASS 0.66 seconds
GitLint PASS 0.39 seconds
SubjectPrefix PASS 0.12 seconds
BuildKernel PASS 28.46 seconds
CheckAllWarning PASS 32.23 seconds
CheckSparse PASS 37.71 seconds
CheckSmatch PASS 101.28 seconds
BuildKernel32 PASS 28.33 seconds
TestRunnerSetup PASS 509.11 seconds
TestRunner_l2cap-tester PASS 18.12 seconds
TestRunner_iso-tester FAIL 32.80 seconds
TestRunner_bnep-tester PASS 4.85 seconds
TestRunner_mgmt-tester PASS 111.60 seconds
TestRunner_rfcomm-tester PASS 7.40 seconds
TestRunner_sco-tester PASS 14.96 seconds
TestRunner_ioctl-tester PASS 7.87 seconds
TestRunner_mesh-tester PASS 5.88 seconds
TestRunner_smp-tester PASS 6.88 seconds
TestRunner_userchan-tester PASS 4.99 seconds
IncrementalBuild PASS 26.17 seconds
Details
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 117, Passed: 116 (99.1%), Failed: 1, Not Run: 0
Failed Test Cases
ISO Connect Suspend - Success Failed 4.189 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-05 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 18:23 [PATCH] Bluetooth: Fix inconsistent LE packet sending behaviors Yuxin Wang
2024-03-05 18:57 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).