Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp221494iol; Thu, 9 Jun 2022 02:30:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbykXIdrYkon5GyY+hGWorWhZfxwXKiYD0xl9boJ6XCvEmrUIsLw2G8V4H6HlxLaMpQQ77 X-Received: by 2002:a17:906:c2cb:b0:703:9e51:a3ea with SMTP id ch11-20020a170906c2cb00b007039e51a3eamr35573686ejb.130.1654767030297; Thu, 09 Jun 2022 02:30:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654767030; cv=pass; d=google.com; s=arc-20160816; b=iPaxG9/BCDPDyHZmp6xUkix9lUxYG7WtZO7NSHY+OBonjfW8atIiktQwZzvCWRjKDt Qb0Hx8A07NJ4+HDHl21/IH1XiYoYs2SDaVaJzYz+bn4PSN5VsQDVbyHemI5qeA6Rdm10 yrDAcdIj5JQZS9a8H/4PGf97q6VBaorq4lyYf3K0lZZ+Cne4RHqHnB7eBPGhpTHvlBVb IJP7p4+qjvAbaiq0vsdI2Swx+ZoM6KTutU1O5/7p4Wv8zeZ0SiTOOLlbx+crK1q9fGQp LOUKBcMobF5idGUWmUX0Wuyd5hC2JT34TARMczT0jKITYSfsANpOp0NkAMOq71PtB9d6 n5/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IWF+B3DIlCVfyfSUGRivFZRxPep+w1vQ7RPITZof3wQ=; b=k0+BLcUo5fxF2ic74Va8F9h1JaI4LVIqrRl0oGerJMJps4c4rqwtEQk54HUvp9qTNM g7KVUHodhOJ4Hqv6fIAlfacE64B6+jvQrWC3hZ0jyYDV1s69tJLtTCltVBbk3KFl9JNU SlSl5lRWtJcmO4wgj9yD0kqcsoEh8jIHXuDjgyU4M4wkb50P720LWy+fEPujuSSE9rfC uN3hbWgoQKIPP/Y/Notcxad9VuBrc7ZPhHPR7G2Dm6uqoH7a687UV9fBR3hvL0V6c6n8 dxwMB/UiQp7mTjbGUC7Lv4TqVeM+vHYYXsWoj8w/rU6yfJBhINZDs+RdyfY5oNcPvJf5 LmoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dptechnics.com header.s=zoho header.b="Q2YR/OKw"; arc=pass (i=1 spf=pass spfdomain=dptechnics.com dkim=pass dkdomain=dptechnics.com dmarc=pass fromdomain=dptechnics.com>); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd25-20020a1709076e1900b00711caf7c68bsi3335084ejc.959.2022.06.09.02.30.04; Thu, 09 Jun 2022 02:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dptechnics.com header.s=zoho header.b="Q2YR/OKw"; arc=pass (i=1 spf=pass spfdomain=dptechnics.com dkim=pass dkdomain=dptechnics.com dmarc=pass fromdomain=dptechnics.com>); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237153AbiFIJZx (ORCPT + 99 others); Thu, 9 Jun 2022 05:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238397AbiFIJZw (ORCPT ); Thu, 9 Jun 2022 05:25:52 -0400 Received: from sender4-op-o13.zoho.com (sender4-op-o13.zoho.com [136.143.188.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562C47A83A for ; Thu, 9 Jun 2022 02:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654765844; cv=none; d=zohomail.com; s=zohoarc; b=iraJ4h55if8le92v3dSsYETNBwqGm4AQJcosf4YXHJDCo8d07sPTkcCJMYJClOUXfV8fOJGlFlfofkDjpiSFg0WGpCb5buQWP9qt9j9EQG9Hic67xU3wm8ETXozJWXXQMqVCUfmn+oqV5BNtCPnwy5pB6UohUcIcluKWukilph0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654765844; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=IWF+B3DIlCVfyfSUGRivFZRxPep+w1vQ7RPITZof3wQ=; b=ABQ4vggGwg2d8AUnRajYth/VqrULHt4+cqGfAbFjhICB2aTjRe8bozSx4LXdmEPzATKCu8izvzVG+ATbaUm6s3adxqZsdJb060Jo1X3F6QNC3TU/glIe1cC8f4NN0OXLqt0SceR3uFHqwiMF3SUJJ1lXJePHd05lZ26a+7bhzHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=dptechnics.com; spf=pass smtp.mailfrom=jonas@dptechnics.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1654765844; s=zoho; d=dptechnics.com; i=jonas@dptechnics.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=IWF+B3DIlCVfyfSUGRivFZRxPep+w1vQ7RPITZof3wQ=; b=Q2YR/OKwelRAqMrRGvmMxc3RksrtSVjEhalShLEx9DNRHU+yZvkMJYT89vxF8hnu 06rF7UTXfcEyjOPxYso5ilpTjviCFIqho/fN2M4vA3gnx4liH6Hn9IS2uzrKtWiYH/+ gkwy1UevCeDGA2ggeUdPgfjpWrcDyX6CEsF6s1AA= Received: from lilith.dptechnics.local (178-116-74-88.access.telenet.be [178.116.74.88]) by mx.zohomail.com with SMTPS id 1654765841707981.9104936864159; Thu, 9 Jun 2022 02:10:41 -0700 (PDT) From: Jonas Maes To: linux-bluetooth@vger.kernel.org Cc: Jonas Maes Subject: [PATCH BlueZ 1/1] Fix bug where bluetooth-meshd stops sending Date: Thu, 9 Jun 2022 11:08:32 +0200 Message-Id: <20220609090832.9945-2-jonas@dptechnics.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220609090832.9945-1-jonas@dptechnics.com> References: <20220609090832.9945-1-jonas@dptechnics.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org When there is a backlog of mesh packets to be sent, the packet sender incorrectly infers that the tx worker thread is already running and therefore needn't be invoked. As a result, the mesh daemon will sometimes stop broadcasting while there are still packets in the queue. It will not resume broadcasting. This patch will invoke the tx worker thread correctly in that case. The logic to send packets at least twice when the transmitter is idle was slightly modified accordingly, and should behave the same way as before. --- mesh/mesh-io-generic.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c index 50a2a6a86..eed77a7a8 100644 --- a/mesh/mesh-io-generic.c +++ b/mesh/mesh-io-generic.c @@ -725,7 +725,6 @@ static bool send_tx(struct mesh_io *io, struct mesh_io_send_info *info, { struct mesh_io_private *pvt = io->pvt; struct tx_pkt *tx; - bool sending = false; if (!info || !data || !len || len > sizeof(tx->pkt)) return false; @@ -739,23 +738,20 @@ static bool send_tx(struct mesh_io *io, struct mesh_io_send_info *info, if (info->type == MESH_IO_TIMING_TYPE_POLL_RSP) l_queue_push_head(pvt->tx_pkts, tx); else { - if (pvt->tx) - sending = true; - else - 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 && + if (info->type == MESH_IO_TIMING_TYPE_GENERAL && !pvt->tx && + l_queue_isempty(pvt->tx_pkts) && tx->info.u.gen.cnt == 1) tx->info.u.gen.cnt++; + + l_queue_push_tail(pvt->tx_pkts, tx); } - if (!sending) { + /* If not already sending, schedule the tx worker */ + if (!pvt->tx) { l_timeout_remove(pvt->tx_timeout); pvt->tx_timeout = NULL; l_idle_oneshot(tx_worker, pvt, NULL); -- 2.34.1