Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17111846rwd; Mon, 26 Jun 2023 21:13:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Sdj6WrLmjgfnSHxRe6AlPTLcCbdD/6fWZhe5RhY2Ce3woqhGz4tl8ZPDslkUhVgw2JA9n X-Received: by 2002:a17:902:f552:b0:1b5:1e24:8a76 with SMTP id h18-20020a170902f55200b001b51e248a76mr10696901plf.65.1687839212062; Mon, 26 Jun 2023 21:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687839212; cv=none; d=google.com; s=arc-20160816; b=ceIXVvuMdySWT+bCgV9FFN7j42hQ5ZmSkQ3+8CGRShMxUH+W/gxo2P9Jy1MLdJXn5m cWLsDq0xATb0uJ0V7EJughVZhFtbMe6tWYqm4T1CmyojDUXtyKwVVbxrAnSyVzyyD1KN bEIbKdqSd6tKB6XBd/Aid8WsgG0aUyxBEjN5GpkTBah211UYI4pxfeSzt1XubSk2489Y hJnFRiywhC1QMSsrEkDhGRZjVOWbrK2Lr3/Nnd/kKOY6AlB+rPNgwHPRmJKL9KwUes1w qJeYW1bjsfjONX+/H7No3Y2NaZtJbb5CkIeXhAm4+RnxfmZM+E+LpeNrxGA2lGkesmMy hp1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :content-language:references:to:subject:user-agent:mime-version:date :message-id; bh=zU2Ps/InilJDL6sgJ3cOJkunXqc5F8Pcnn/wze8aFeE=; fh=v4Z3N2Htbr8NtGqMLkQjkIE/EbeUcf6lhEWEAm07n3g=; b=E9/SwQH9hhuScYB9WwJMOyiM0K5hxLJ2V77JM0KBX9VQauTCGbmhv0OpsfjQdNqlrT wGPrryaUH2DJG7HDv6GYEwfLtuzKBYSAwEllOjWd+zSczq7XVTawypIz4UheVdt2nTVt JmD7fdoD7PBD6rjSx/1K0Ey6W0TmS5/7HFEte5sj3aCtNOCtwnjmaiR3u3ndSLVtOv/K RF6CrEflnupT8xgyjtZJUBNKBxMUrj2k+eET67SQjzAo3blWYMbB39Q0/N1bjQUE2xtp iGQW1YhmsscnpFnaYCYfP7gS9pGss1FWabG4EHfYfkDE7YAVS/DMUK0YQY6d49uxbMzK 4qBQ== 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 l10-20020a170903120a00b001a64fa4eb27si6672436plh.230.2023.06.26.21.13.05; Mon, 26 Jun 2023 21:13:31 -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 S229666AbjF0DtQ (ORCPT + 99 others); Mon, 26 Jun 2023 23:49:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjF0Ds6 (ORCPT ); Mon, 26 Jun 2023 23:48:58 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7D501BFB for ; Mon, 26 Jun 2023 20:47:56 -0700 (PDT) Received: from [192.168.0.2] (ip5f5aeb05.dynamic.kabel-deutschland.de [95.90.235.5]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 3B02061E5FE01; Tue, 27 Jun 2023 05:47:47 +0200 (CEST) Message-ID: <0d8ecb01-e998-e28d-1eb8-d286bdaccecd@molgen.mpg.de> Date: Tue, 27 Jun 2023 05:47:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v5] Bluetooth: hci_event: Fix parsing of CIS Established Event To: Luiz Augusto von Dentz References: <20230627003142.2274828-1-luiz.dentz@gmail.com> Content-Language: en-US Cc: linux-bluetooth@vger.kernel.org From: Paul Menzel In-Reply-To: <20230627003142.2274828-1-luiz.dentz@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,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 Dear Luiz, Thank you for your patch. Am 27.06.23 um 02:31 schrieb Luiz Augusto von Dentz: > From: Luiz Augusto von Dentz > > The ISO Interval on CIS Established Event uses 1.25 ms slots: > > BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E > page 2304: > > Time = N * 1.25 ms > > In addition to that this always update the QoS settings based on CIS > Established Event. update*s* Does “always” mean, it wasn’t set for the master role before, and that is done now? Kind regards, Paul > Signed-off-by: Luiz Augusto von Dentz > --- > net/bluetooth/hci_event.c | 45 ++++++++++++++++++++++++++++----------- > 1 file changed, 32 insertions(+), 13 deletions(-) > > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index b1aefe4bb751..77cbf13037b3 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -6822,6 +6822,7 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, > { > struct hci_evt_le_cis_established *ev = data; > struct hci_conn *conn; > + struct bt_iso_qos *qos; > bool pending = false; > u16 handle = __le16_to_cpu(ev->handle); > > @@ -6846,21 +6847,39 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, > > pending = test_and_clear_bit(HCI_CONN_CREATE_CIS, &conn->flags); > > - if (conn->role == HCI_ROLE_SLAVE) { > - __le32 interval; > + qos = &conn->iso_qos; > > - memset(&interval, 0, sizeof(interval)); > + /* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */ > + qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250; > + qos->ucast.out.interval = qos->ucast.in.interval; > > - memcpy(&interval, ev->c_latency, sizeof(ev->c_latency)); > - conn->iso_qos.ucast.in.interval = le32_to_cpu(interval); > - memcpy(&interval, ev->p_latency, sizeof(ev->p_latency)); > - conn->iso_qos.ucast.out.interval = le32_to_cpu(interval); > - conn->iso_qos.ucast.in.latency = le16_to_cpu(ev->interval); > - conn->iso_qos.ucast.out.latency = le16_to_cpu(ev->interval); > - conn->iso_qos.ucast.in.sdu = le16_to_cpu(ev->c_mtu); > - conn->iso_qos.ucast.out.sdu = le16_to_cpu(ev->p_mtu); > - conn->iso_qos.ucast.in.phy = ev->c_phy; > - conn->iso_qos.ucast.out.phy = ev->p_phy; > + switch (conn->role) { > + case HCI_ROLE_SLAVE: > + /* Convert Transport Latency (us) to Latency (msec) */ > + qos->ucast.in.latency = > + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), > + 1000); > + qos->ucast.out.latency = > + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), > + 1000); > + qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu); > + qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu); > + qos->ucast.in.phy = ev->c_phy; > + qos->ucast.out.phy = ev->p_phy; > + break; > + case HCI_ROLE_MASTER: > + /* Convert Transport Latency (us) to Latency (msec) */ > + qos->ucast.out.latency = > + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), > + 1000); > + qos->ucast.in.latency = > + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), > + 1000); > + qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu); > + qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu); > + qos->ucast.out.phy = ev->c_phy; > + qos->ucast.in.phy = ev->p_phy; > + break; > } > > if (!ev->status) {