* [PATCH] Bluetooth: hci_h5: Complements reliable packet processing logic.
@ 2023-04-03 16:29 Qiqi Zhang
2023-04-04 2:27 ` [PATCH v2] " Qiqi Zhang
2023-04-06 21:00 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 4+ messages in thread
From: Qiqi Zhang @ 2023-04-03 16:29 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz
Cc: linux-bluetooth, linux-kernel, Qiqi Zhang
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(+)
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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] Bluetooth: hci_h5: Complements reliable packet processing logic
2023-04-03 16:29 [PATCH] Bluetooth: hci_h5: Complements reliable packet processing logic Qiqi Zhang
@ 2023-04-04 2:27 ` Qiqi Zhang
2023-04-06 21:00 ` patchwork-bot+bluetooth
2023-04-06 21:00 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 1 reply; 4+ messages in thread
From: Qiqi Zhang @ 2023-04-04 2:27 UTC (permalink / raw)
To: eddy.zhang
Cc: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel
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."
So 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>
---
Changes in v2:
- Fixed build bot warning.
---
---
drivers/bluetooth/hci_h5.c | 2 ++
1 file changed, 2 insertions(+)
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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hci_h5: Complements reliable packet processing logic.
2023-04-03 16:29 [PATCH] Bluetooth: hci_h5: Complements reliable packet processing logic Qiqi Zhang
2023-04-04 2:27 ` [PATCH v2] " Qiqi Zhang
@ 2023-04-06 21:00 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-04-06 21:00 UTC (permalink / raw)
To: Qiqi Zhang
Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Bluetooth: hci_h5: Complements reliable packet processing logic
2023-04-04 2:27 ` [PATCH v2] " Qiqi Zhang
@ 2023-04-06 21:00 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-04-06 21:00 UTC (permalink / raw)
To: Qiqi Zhang
Cc: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel
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 10:27:11 +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:
- [v2] Bluetooth: hci_h5: Complements reliable packet processing logic
https://git.kernel.org/bluetooth/bluetooth-next/c/13a6ebae665d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-06 21:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 16:29 [PATCH] Bluetooth: hci_h5: Complements reliable packet processing logic Qiqi Zhang
2023-04-04 2:27 ` [PATCH v2] " Qiqi Zhang
2023-04-06 21:00 ` patchwork-bot+bluetooth
2023-04-06 21:00 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox