diff mbox series

Bluetooth: hci_h5: Complements reliable packet processing logic.

Message ID 20230403162928.118172-1-eddy.zhang@rock-chips.com
State Superseded
Headers show
Series Bluetooth: hci_h5: Complements reliable packet processing logic. | expand

Commit Message

Qiqi Zhang April 3, 2023, 4:29 p.m. UTC
As shown in the schematic diagram below.There may be a critical
scenario in the current code. If the device does not receive an
pure ack sent by the host due to insufficient receive buffer or
other reasons and triggers a retransmission, the host will always
be in an 'out-of-order' state.The state machine will get stuck.

       host                 device
     SEQ3,ACK4 --------->
               <--------- SEQ4,ACK4
     pure ACK  ---------> (not received)
(out-of-order) <--------- SEQ4,ACK4(retransmission)
		........
(out-of-order) <--------- SEQ4,ACK4(retransmission)

According to the description in the core specification: "whenever
a reliable packet is received, an acknowledgment shall be generated."
we should set H5_TX_ACK_REQ bit to trigger retransmission of pure ack
packet when "out-of-order" occurs.

Signed-off-by: Qiqi Zhang <eddy.zhang@rock-chips.com>
---
 drivers/bluetooth/hci_h5.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

bluez.test.bot@gmail.com April 3, 2023, 5:36 p.m. UTC | #1
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=736467

---Test result---

Test Summary:
CheckPatch                    PASS      0.60 seconds
GitLint                       FAIL      0.69 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      40.98 seconds
CheckAllWarning               PASS      44.42 seconds
CheckSparse                   PASS      50.07 seconds
CheckSmatch                   PASS      137.54 seconds
BuildKernel32                 PASS      39.45 seconds
TestRunnerSetup               PASS      569.34 seconds
TestRunner_l2cap-tester       PASS      19.17 seconds
TestRunner_iso-tester         PASS      20.88 seconds
TestRunner_bnep-tester        PASS      6.83 seconds
TestRunner_mgmt-tester        PASS      132.76 seconds
TestRunner_rfcomm-tester      PASS      10.48 seconds
TestRunner_sco-tester         PASS      9.60 seconds
TestRunner_ioctl-tester       PASS      11.50 seconds
TestRunner_mesh-tester        PASS      8.51 seconds
TestRunner_smp-tester         PASS      9.61 seconds
TestRunner_userchan-tester    PASS      7.11 seconds
IncrementalBuild              PASS      37.38 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: hci_h5: Complements reliable packet processing logic.

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T3 Title has trailing punctuation (.): "Bluetooth: hci_h5: Complements reliable packet processing logic."
14: B3 Line contains hard tab characters (\t): "		........"


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org April 6, 2023, 9 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue,  4 Apr 2023 00:29:28 +0800 you wrote:
> As shown in the schematic diagram below.There may be a critical
> scenario in the current code. If the device does not receive an
> pure ack sent by the host due to insufficient receive buffer or
> other reasons and triggers a retransmission, the host will always
> be in an 'out-of-order' state.The state machine will get stuck.
> 
>        host                 device
>      SEQ3,ACK4 --------->
>                <--------- SEQ4,ACK4
>      pure ACK  ---------> (not received)
> (out-of-order) <--------- SEQ4,ACK4(retransmission)
> 		........
> (out-of-order) <--------- SEQ4,ACK4(retransmission)
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_h5: Complements reliable packet processing logic.
    https://git.kernel.org/bluetooth/bluetooth-next/c/13a6ebae665d

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 6455bc4fb5bb..d05eaeaa4516 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -463,6 +463,8 @@  static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c)
 	if (H5_HDR_RELIABLE(hdr) && H5_HDR_SEQ(hdr) != h5->tx_ack) {
 		bt_dev_err(hu->hdev, "Out-of-order packet arrived (%u != %u)",
 			   H5_HDR_SEQ(hdr), h5->tx_ack);
+		set_bit(H5_TX_ACK_REQ, &h5->flags);
+		hci_uart_tx_wakeup(hu);
 		h5_reset_rx(h5);
 		return 0;
 	}