linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, inga.stotland@intel.com, mike@mnmoran.org
Subject: [PATCH BlueZ] mesh: Add guard against wedging outbound queue
Date: Wed, 29 Jul 2020 08:52:34 -0700	[thread overview]
Message-ID: <20200729155234.547679-1-brian.gix@intel.com> (raw)

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


             reply	other threads:[~2020-07-29 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 15:52 Brian Gix [this message]
2020-07-29 19:00 ` [PATCH BlueZ] mesh: Add guard against wedging outbound queue Gix, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729155234.547679-1-brian.gix@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mike@mnmoran.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).