Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp113898rwb; Tue, 4 Oct 2022 01:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7E20aBJmMOasIetwI4V2A7EYvJrrBW44PtxWtXRDgZoggD1oy0QFlrDhQOKRRjtxBmxBNp X-Received: by 2002:a17:902:8bc3:b0:178:8563:8e42 with SMTP id r3-20020a1709028bc300b0017885638e42mr25921203plo.0.1664871060397; Tue, 04 Oct 2022 01:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664871060; cv=none; d=google.com; s=arc-20160816; b=O4t8+yDfgdYF45rGyKIuNxn2SbYTUOcmc/B6sUmaoeEx1Onlvu7uHB6G34/xe9t/vR lk+moXcFNj5zDPZ+B9Vnq+embpEr9yU7bp27wQ49BqPwy/0A+CaWnybXlfAXwlWwCTHP L7xN0jh+ea/HnX5IX3Z+GjzOtXZgvnLstj3z9qNJAaZCjD7kilTGYN8RB8D8pOCN9oV9 8JRx09MrL9J9n755Qo8Jw0IDrvx0LcHyofeSVYzy5zMzu9pb1FO8YKsSjSC6ptM/ELxH Y19Cu3e0pLSRJ3GSbIOcUacp/u8dirYiYiLFFXqDCpTcLS/QU72lWPLhHTCudOvsulA7 J+jg== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=PYd1hkaqjbi1L03XJjqZ4Y5d1XbdKppQ6/NKsr+kPtw=; b=0apmx5+P03ZP5OdNhYBEkVR4Xfi6bMM+u5KQs9kfwzlgMIuAH4Ql+1JQGLf+iFYBdm brjSi0tB1mOpFA5V7YVFjDg/rAOzTE9P14edBKbDpjWVT7/9JjWID6PGtbqxL1RlVWaD KTDbb/plvh/ZW69OH7HBJ7wRZxT3YFYTJcA+la2kmh8PV6ffuwmEO3vZQOSzw2SlFd8y OYqtYwq8LiK/3RIlsrGr5BlFV5e5bgA5fCxsUYTZo4ZUNQ5cYUwYDdyoKmulJQ8OpRrs b/rc5CLxovIDE1PA82JqRNBOqwsdYfAkccysyoFcc6eUEFXIg+UchyB967X+aHCmMj2d 59cg== 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 c17-20020a170903235100b00176e9d42441si14041331plh.157.2022.10.04.01.09.57; Tue, 04 Oct 2022 01:11:00 -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 S229635AbiJDIEV (ORCPT + 99 others); Tue, 4 Oct 2022 04:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbiJDIEU (ORCPT ); Tue, 4 Oct 2022 04:04:20 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D1B2E69A for ; Tue, 4 Oct 2022 01:04:18 -0700 (PDT) Received: from [192.168.0.243] ([151.127.53.97]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.119]) with ESMTPSA (Nemesis) id 1MulVd-1pVOWa207X-00rsOX; Tue, 04 Oct 2022 10:02:39 +0200 Message-ID: <4fc40766-6e8d-1683-b370-1417aeab1db7@green-communications.fr> Date: Tue, 4 Oct 2022 10:02:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [RFC PATCH] Bluetooth: Add a workaround for SCO over USB HCI design defect To: Paul Menzel Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org References: <20221003142558.17914-1-nicolas.cavallari@green-communications.fr> Content-Language: fr From: Nicolas Cavallari In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:NKpXDTZuFtYJfr7xC4usihWHelHNkyKV+MVC9fccrl5WTmSUnl3 gbs4k+kc4T35Pl9s6NmhaZkvzR+t4Sd0S5SkPLJXDf/PloVZgvupCjCF1b56RvaAxZziDtF yYdOZAhTUIE70anzu6moeuAC346GnUBFeZcqtgB0ZxhUsThdiV2UTYdxQ3zwOdN3gAc/O1a 4X6H3s9b0DQfjdym56Q3A== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z4aWIQ0p9zU=:aSOLid1Uu87nGYSuv3Y8N7 VGGrFo6wqRJ9RJFVgAjSYEy9eCb3VXZ8r1KEqjkvknt4pthdXOk5mGeX4KYA4cZcTriKhQwC0 rX3dVUsmMXtiCAU0dIFQzwXUaKx0R+zURAkQXVnPojW5AG4sZf3sxVJzkOi1ONeoGo2FiFMuS pX49NeyOREK2xIgf66HRGHekHBEu4TYwAet76L3WPILnItac/aGV8G0OtF7KPyeUFwN60gMEM NZL0o6n0os1EzlRoWgwWTVz/ZcWyrvOzHMkgQUkzfJOsmfDyzLSrIehJuYvR8zAkdjkN85UDL 5Y1U1IhMlqAiMygLsSoMYsF8UPbFbHTn83BDeM36uL4YPaBvwcSLy1NWZfKeOvZo2rkaQ46IP VP7Ra/UWA6990IrTWOqMAd/j5Z2hoxKKW+MryaJ2yAaq82o0ZHpz/Dd00ZLYe6I6JiMor8K1F Dnrng3kHIoQ1616x8QQdBxyWEE1IuVDuhSHBHbnv1MvcSGElTEOv0DcgjnVZJrNLEEJbQtun2 VvKEoD+qpBkLJL+kkaPOtyDssAtPzXEzmoLyYBpCF7XHEiwFaVmXOk/+/ZBBWdcsXD9RBW3q/ Bg+4CRa366H4cc+N2oXdJZMVa7QiweKXKR6AlseuEaEbrfGgxBJcgq7h6cBeU+KovAzYVfr2q YirkszpPhu6yFrcjrQkyub4AACeGoHTHqNySgS6bWniwMmJq+07GrPPedkeeiefipQaSz6+jS eZ9NjZC8wHkXjiQbn6E4Mo576UoVjCtHpsJvvUGsWkdPJVJqrDponaUl8ApUuwiXdBXUmp2VL fAZIHO+x93wyPAtZOYUcLH2G0LmP5OZqpbk9XBIKqOkajODePA= X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 On 03/10/2022 17:14, Paul Menzel wrote: > Dear Nicolas, > > > Thank you for the patch. Just a small suggestion to make the > summary/title shorter: > > Work around SCO over USB HCI design defect > > Am 03.10.22 um 16:25 schrieb Nicolas Cavallari: >> The USB interface between the host and the bluetooth adapter used for >> SCO packets uses an USB isochronous endpoint with a fragmentation scheme >> that does not tolerate errors.  Except USB isochronous transfers do >> not provide a reliable stream with guaranteed delivery (There is no >> retry on error, see USB spec v2.0 5.6 and 8.5.5). > > I’d put the dot/period after delivery, and inside the brackets after 8.5.5. > >> To fragment a packet, the bluetooth HCI simply split it in parts and > > split*s* > >> transfer them as-is.  The receiver is expected to reconstruct the packet >> by assuming the first fragment contains the header and parsing its size >> field.  There is no error detection either. >> >> If a fragment is lost, the end result is that the kernel is no longer >> synchronized and will pass malformed data to the upper layers, since it >> has no way to tell if the first fragment is an actual first fragment or >> a continuation fragment.  Resynchronization can only happen by luck and >> requires an unbounded amount of time. >> >> The typical symptom for a HSP/HFP bluetooth headset is that the >> microphone stops working and dmesg contains piles of rate-limited >> "Bluetooth: hci0: SCO packet for unknown connection handle XXXX" >> errors for an undeterminate amount of time, until the kernel accidently > > indeterminate, accidentally > Thanks for the typos, will fix them in v2. >> resynchronize. >> >> A workaround is to ask the upper layer to prevalidate the first fragment >> header.  This is not possible with user channels so this workaround is >> disabled in this case. > > Please document your test setup. My current worst case is a ath3k (AR3012) on an imx6 board (GW52xx) running 5.19.8. The issue does not depend on the hfp/hsp headset. It should be noted that the AR3012 is an USB1 device and it is plugged into a USB2 root hub. This is already a special case for USB. What happens when looking at the usbmon traces is that around every ~2s-3s, what should be a 9 byte fragment is replaced by a 0 byte fragment, which is still reported as successfully transfered. > Please excuse my ignorance, but I have a few more questions: > > 1.  Does that also happen with Android? I haven't tested to run android on this platform, but is the android kernel that different from a vanilla linux ? > 2.  Is it possible to reproduce in QEMU for example? This platform is probably not powerful enough to run qemu.