Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp169959ybb; Thu, 2 Apr 2020 23:57:40 -0700 (PDT) X-Google-Smtp-Source: APiQypIV7JHGP3Qz+0S7feSWKVbHzAuDzHUFQ7JF3yEJFvDkft5GCdenAZj6WkA08EHCKONPIokZ X-Received: by 2002:a9d:2056:: with SMTP id n80mr5526797ota.281.1585897060542; Thu, 02 Apr 2020 23:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585897060; cv=none; d=google.com; s=arc-20160816; b=tjcbep31ErVnJeHWf3cVNUAABcmWEqFWqG9dkSUx3nyikGRnmXPlAsbKk370oa/PiK 1P1eUd5oCo1mi+DA5fKKDe4hIRS6zZGGRbWJoNrQzhf7gPjFjE/d7+r5rPt5cidqrmF9 tiT1XKn1GthTq/8TQlUX5hIskeSjx+30Yu7zPxMahQlPe4ETm3mY5Olrv78MfJ2hZFW+ jy1zwsAadCCLb69CE5H4rkWgp6yUSAXIWLaGqsdxFRknqyOqt/jZ8x5RP9sFFI7kG+93 d6ZyP0yc/jI1TcdrWNo/klPDRKgwyWXaKbz6pnN5yHnxH8ArcPjtR6kKmAZPyB5MpLWv 8Mjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=jX+i06/KfEkRRlburIe3A2w8o2B65ZVaONAozsBWhTA=; b=EUDOGVUFXaMBUfCSkBOJi+QcgpfSp1GMLHLpVf8wmGs3DcwG177EtbXf943IT0FE63 0j2+lro2xxVC7qBLxSO2F6Um8XnD+OW+Zc62efs97QZnYqFJGEZ4wfJ4AoDcdk/L+S8D 3OAZWgpem7zw/9hvTE//pO8K6WRnTmzoM+muDrF1SlvXwm4czVvQnSfyWU33wXqq4YH1 Zz8sBuQJ7GHrt6LSXC924B5drPTO0uJ7XrglZcZF0bKCw5P66tqX+Nm8s8oF+135Xa// jwBntQYcC4tyKAHIARzC1FCCWhmEpD99gboL0eN0OXORY5ReqTW/d8UVKDgmO3NBg3yt 8m0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si3198977ota.17.2020.04.02.23.57.19; Thu, 02 Apr 2020 23:57:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730759AbgDCG4E convert rfc822-to-8bit (ORCPT + 99 others); Fri, 3 Apr 2020 02:56:04 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:37584 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729423AbgDCG4E (ORCPT ); Fri, 3 Apr 2020 02:56:04 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 7F820CECF9; Fri, 3 Apr 2020 09:05:35 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH v3 1/1] Bluetooth: Prioritize SCO traffic From: Marcel Holtmann In-Reply-To: <20200323124503.v3.1.I17e2220fd0c0822c76a15ef89b882fb4cfe3fe89@changeid> Date: Fri, 3 Apr 2020 08:56:01 +0200 Cc: Bluetooth Kernel Mailing List , ChromeOS Bluetooth Upstreaming , "David S. Miller" , Johan Hedberg , netdev , LKML , Jakub Kicinski Content-Transfer-Encoding: 8BIT Message-Id: <7FD50BDC-A4B5-4ED9-8DAB-887039735800@holtmann.org> References: <20200323194507.90944-1-abhishekpandit@chromium.org> <20200323124503.v3.1.I17e2220fd0c0822c76a15ef89b882fb4cfe3fe89@changeid> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Abhishek, > When scheduling TX packets, send all SCO/eSCO packets first, check for > pending SCO/eSCO packets after every ACL/LE packet and send them if any > are pending. This is done to make sure that we can meet SCO deadlines > on slow interfaces like UART. > > If we were to queue up multiple ACL packets without checking for a SCO > packet, we might miss the SCO timing. For example: > > The time it takes to send a maximum size ACL packet (1024 bytes): > t = 10/8 * 1024 bytes * 8 bits/byte * 1 packet / baudrate > where 10/8 is uart overhead due to start/stop bits per byte > > Replace t = 3.75ms (SCO deadline), which gives us a baudrate of 2730666. > > At a baudrate of 3000000, if we didn't check for SCO packets within 1024 > bytes, we would miss the 3.75ms timing window. > > Signed-off-by: Abhishek Pandit-Subedi > --- > > Changes in v3: > * Removed hci_sched_sync > > Changes in v2: > * Refactor to check for SCO/eSCO after each ACL/LE packet sent > * Enabled SCO priority all the time and removed the sched_limit variable > > net/bluetooth/hci_core.c | 106 +++++++++++++++++++++------------------ > 1 file changed, 57 insertions(+), 49 deletions(-) patch has been applied to bluetooth-next tree. However I have been a bit reluctant to apply this right away. I think when this code was originally written, we only had ACL and SCO packets. The world was pretty simple. And right now we also only have two packets types (ignoring ISO packets for now), but we added LE and eSCO as separate scheduling and thus “fake” packet types. I have the feeling that this serialized packet processing will get us into trouble since we prioritize BR/EDR packets over LE packets and SCO over eSCO. I think we should have looked at all packets based on SO_PRIORITY and with ISO packets we have to most likely re-design this. Anyway, just something to think about. Regards Marcel