Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2230775rwd; Sun, 28 May 2023 10:48:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iI8ayWA9DhLL12DjOv4yDGiVGrgksJ49q7FGXRQAKCu4jIPXMiGMctuCyF2HsJFzCK6uM X-Received: by 2002:a05:6a00:2e94:b0:625:efa4:4c01 with SMTP id fd20-20020a056a002e9400b00625efa44c01mr12419934pfb.3.1685296088968; Sun, 28 May 2023 10:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685296088; cv=none; d=google.com; s=arc-20160816; b=O32DKjklb7mC6VLwTsNhd6p2xUzrOn45P5NfjWMKiuvG8RJAlMUBYkJ1x66jfUPIvA jKKAgFo9PG/apDdhp3RCnBHlhTFUKz8DHHOR+WjZU7aPIOuQI5TTDCRSQUuG+Cmk9edg U3mOM4k2Ta4kKqFbfrmgb+l7WGs0egs3e5cKAbOJTLsMIbQB5nn+fpw+j7S9uO1gFoi3 wyz6Zeq8G+7aHtYsOSONZavOqGRqUQhISK1UaA67QhlQTVJR6yQSafJZYZeyeq9ST7lL mKGvAymwXub2f2t5a/NTeyLvk+TkW39izLajNTa2iTEB296Y1DATFAd19nfF93ayuhZM kkZA== ARC-Message-Signature: i=1; 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; bh=eNbwLXB4wP+oZ+J8fCei3E0evI97pdG+uhLuelHnMlM=; b=UWhm6ZusSRAEq1TeKbD0ddIe5oi0y0Rbw28EE8E9foR/4VklclnjAAoz/MdOV5J4sR 6vupaOinZU5mXOi1hIsvd+ACYMIdun+fb2pDLjGQEdfgL+D3NbeaZM0OtQ+etmS5Affh hrJjwN89g0T6zPjpc00gUBtHeFDPy4XkNPyJrSAuN7tAo/xbJeBPBPDi9U7IlixbaEFQ EhCy2lpLmjNsnEakZhcTf70x9rgBDRgx7BDoPi2gXiPToCayR+/hlnIhGGyY5zyviDtw YeExhlWsWRZ6D8Paj5Qa7Ksgpv+2TcOHwf8aXlR0scYUMvcIbcF7MwfRL4CoMmT3kC5s Prmg== ARC-Authentication-Results: i=1; mx.google.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 i130-20020a639d88000000b0053eef42c758si7220896pgd.341.2023.05.28.10.47.54; Sun, 28 May 2023 10:48:08 -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; 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 S229544AbjE1RoW (ORCPT + 99 others); Sun, 28 May 2023 13:44:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjE1RoU (ORCPT ); Sun, 28 May 2023 13:44:20 -0400 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1FABAB for ; Sun, 28 May 2023 10:44:18 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 8AAB524002A for ; Sun, 28 May 2023 19:44:17 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QTmHj1FCDz6tw8; Sun, 28 May 2023 19:44:17 +0200 (CEST) From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH 3/6] Bluetooth: ISO: don't try to do Set CIG Parameters if CIG known busy Date: Sun, 28 May 2023 17:44:11 +0000 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE 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 Don't try to do set CIG parameters if we know the CIG is busy, because we drop all connections on command failure in hci_cc_le_set_cig_params. Trying to connect new CIS while CIG is not configurable shall not cause other active CIS connections to fail. Check the CIG is not busy before trying to emit the Set CIG Parameters command. Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections") Signed-off-by: Pauli Virtanen --- net/bluetooth/hci_conn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 182dba4a19b5..47a8ec796d97 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1815,6 +1815,19 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos) /* Update CIG */ qos->ucast.cig = data.cig; + } else { + /* If CIG is busy, fail early because cmd error closes conns */ + data.cig = qos->ucast.cig; + data.count = 0; + + hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, + BT_CONNECT, &data); + if (data.count) + return false; + hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, + BT_CONNECTED, &data); + if (data.count) + return false; } data.pdu.cp.cig_id = qos->ucast.cig; -- 2.40.1