Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH BlueZ] mesh: Add guard against wedging outbound queue
@ 2020-07-29 15:52 Brian Gix
  2020-07-29 19:00 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Gix @ 2020-07-29 15:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, inga.stotland, mike

When using HCI command chains, the first packet send that starts an
outbound sequence needs to still exist when command chain completes, or
the outbound queue will wedge.  The simplest solution is to send packets
at least twice on an empty queue, if there is a chance it could be canceled.
---
 mesh/mesh-io-generic.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
index 86952516e..4b26b1181 100644
--- a/mesh/mesh-io-generic.c
+++ b/mesh/mesh-io-generic.c
@@ -714,6 +714,14 @@ static bool send_tx(struct mesh_io *io, struct mesh_io_send_info *info,
 			sending = !l_queue_isempty(pvt->tx_pkts);
 
 		l_queue_push_tail(pvt->tx_pkts, tx);
+
+		/*
+		 * If transmitter is idle, send packets at least twice to
+		 * guard against in-line cancelation of HCI command chain.
+		 */
+		if (info->type == MESH_IO_TIMING_TYPE_GENERAL && !sending &&
+							tx->info.u.gen.cnt == 1)
+			tx->info.u.gen.cnt++;
 	}
 
 	if (!sending) {
-- 
2.25.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh: Add guard against wedging outbound queue
  2020-07-29 15:52 [PATCH BlueZ] mesh: Add guard against wedging outbound queue Brian Gix
@ 2020-07-29 19:00 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2020-07-29 19:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: mike, Stotland, Inga

Applied
On Wed, 2020-07-29 at 08:52 -0700, Brian Gix wrote:
> When using HCI command chains, the first packet send that starts an
> outbound sequence needs to still exist when command chain completes, or
> the outbound queue will wedge.  The simplest solution is to send packets
> at least twice on an empty queue, if there is a chance it could be canceled.
> ---
>  mesh/mesh-io-generic.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
> index 86952516e..4b26b1181 100644
> --- a/mesh/mesh-io-generic.c
> +++ b/mesh/mesh-io-generic.c
> @@ -714,6 +714,14 @@ static bool send_tx(struct mesh_io *io, struct mesh_io_send_info *info,
>  			sending = !l_queue_isempty(pvt->tx_pkts);
>  
>  		l_queue_push_tail(pvt->tx_pkts, tx);
> +
> +		/*
> +		 * If transmitter is idle, send packets at least twice to
> +		 * guard against in-line cancelation of HCI command chain.
> +		 */
> +		if (info->type == MESH_IO_TIMING_TYPE_GENERAL && !sending &&
> +							tx->info.u.gen.cnt == 1)
> +			tx->info.u.gen.cnt++;
>  	}
>  
>  	if (!sending) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 15:52 [PATCH BlueZ] mesh: Add guard against wedging outbound queue Brian Gix
2020-07-29 19:00 ` Gix, Brian

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git