Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2907479ybl; Mon, 19 Aug 2019 09:10:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmf9eysSJrGQxca3LAW6EwqBkEYg/VUpJnSFKV56c2RjEAq8bXiL6pe/i+y+6obFN1Gv/9 X-Received: by 2002:a17:902:aa08:: with SMTP id be8mr23698390plb.144.1566231010784; Mon, 19 Aug 2019 09:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566231010; cv=none; d=google.com; s=arc-20160816; b=pWFMRIikPYgqRTNt7Pw3/hoSowAxtVNiBZfRLDcZI7gzuwtWOWP8AtPLTE+gFHGXq5 xmE/nLDveniOmAmOOFzoJZMmKV215c4QJmjIuiO5Q9LEG9sfKFge/U/FMMupvJwLChw5 5js1GcCJXhZ0F11pkiTMAPL5wumw7opwFsN3mGfJsJ/elQcuQsMvUl6+ogaxDh5oNMuh 6Bwv24YVYjV2Rp6H/r3S3YQfRp642xZ8ue9UBeGje98FxzQCZ5eW5VGb6jyiwGdYCHL/ yMTzEWaNeaTgK6Kqyejd/+D8g8Gs4bAzQQJGnuBE+oWWlTJLN85Ih29WSF4XcD1aCZ2e AFTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=M8IGGelqJ9oCBv1s/6h8taTm9q5IfnPtn5/ZoqCg56Y=; b=1JCsMUl1JMkYGGdIUcMXghku/au3Z2wMM+bVI0xXfGXx3oUy0yzU/E+PUjlMCSu27h c27Z8p1HYboznC2fzUDDR0amtQ6V/kY8Au0h3c9D3GgSZD0nX42jMWVYijo+KpHTz3zB vnVLt4I1WFtVUYL8uAURilVdwzZEkgLbFYnTixfh7jctczhhS6uMHsiwBp9llvdXLMr/ c6Ku25NFmmS6HuyzhLmVAPFyxhmNZWvPldC5kNjTd4h4AzxntSaIlC2SQtfFhbkd9cam /Afa6o1m4L+9bvFVv3Bga/lJ9PZ8YSrNy/54KGGKQtzQEd0tZcNjSIgSy96smz77mKgQ euUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=mk0s9Q+p; 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 x11si10013218pll.343.2019.08.19.09.09.39; Mon, 19 Aug 2019 09:10:10 -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; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=mk0s9Q+p; 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 S1726879AbfHSQIV (ORCPT + 99 others); Mon, 19 Aug 2019 12:08:21 -0400 Received: from mail.andi.de1.cc ([85.214.55.253]:55150 "EHLO mail.andi.de1.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbfHSQIV (ORCPT ); Mon, 19 Aug 2019 12:08:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=M8IGGelqJ9oCBv1s/6h8taTm9q5IfnPtn5/ZoqCg56Y=; b=mk0s9Q+pEl+0TtOk5b5Y6YjFvv yHqGZcR1u6Fmtqirq1CZMRPCQ5tQBh8sMgmIBA7nhLNxNwcV2bUE9ZH6+A8syGlpUkJi2ggN37abE LsH0sJddWSZQ/w6LTcEXmYLO9MoxfFFhOPMDTpvM5oi7en4dRGi3bWqNrARomt68SuAQ=; Received: from p200300ccff07d0007ee9d3fffe1fa246.dip0.t-ipconnect.de ([2003:cc:ff07:d000:7ee9:d3ff:fe1f:a246] helo=eeepc) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hzkCg-0003im-5d; Mon, 19 Aug 2019 18:08:19 +0200 Received: from [::1] (helo=localhost) by eeepc with esmtp (Exim 4.89) (envelope-from ) id 1hzkCd-00044d-Hh; Mon, 19 Aug 2019 18:08:15 +0200 Date: Mon, 19 Aug 2019 18:08:13 +0200 From: Andreas Kemnade To: Carey Sonsino Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, Sasha Levin Subject: Re: [PATCH 1/1] bluetooth: validate BLE connection interval updates Message-ID: <20190819180813.04a8e771@kemnade.info> In-Reply-To: <0cda8242-304e-a073-90d8-63e656e3600c@gmail.com> References: <138296C5-49FA-475D-9618-FC8D241B8823@holtmann.org> <20190815104419.161177fa@kemnade.info> <0cda8242-304e-a073-90d8-63e656e3600c@gmail.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.0 (-) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Carey, On Mon, 19 Aug 2019 07:58:19 -0600 Carey Sonsino wrote: > This seems like the exact "downside" situation that I described in the=20 > patch writeup. >=20 > I would still claim that as a Linux system administrator, I should have=20 > control over my system.=A0 If I am operating in a low power environment, = I=20 > do not want to allow a remote device to apply a setting which causes me=20 > to use more power without any say in the matter. >=20 In principle I agree here. High connection interval has its downsides, low connection interval also. Just curios: What are the numbers about power consumption here? A few mA? I have only compared these values on peripherals running on low-power SoCs like e.g. the nrf stuff from nordic. I see around 1 mA difference there with a power consumption besides of that= =20 usually measured in the =B5A range. Never tested these things on a linux ma= chine. The point here is that with this patch there is insufficient control about this. Yes, there is the debugfs interface. But if you want to provide a driver to a gatt service living on top of bluetoothd dbus api? Ask people to not use distribution kernels? What options do you have? using the monitor interface to sniff the connection handle and then call hci_le_conn_update() to set things? > The connection min/max interval settings are configuration options that=20 > control how my bluetooth device operates.=A0 Why are these down in debugf= s=20 > anyway?=A0 I think that a much more appropriate fix would be to migrate=20 > some of the BLE configuration options to sysconfdir (some place like=20 > /etc/bluetooth/ble.conf).=A0 That would also help in the persistence of=20 > these configuration settings, which is kind of a pain with the debugfs=20 > mechanism that gets wiped out and recreated on bootup. >=20 I think that these things should be part of the dbus api provided by bluetoothd so that a driver could decide and having defaults outside of such a dark corner like the debug fs. > A quicker fix would be to simply set the default connection min interval= =20 > and connection max interval values to the full range (6, 3200). Or just maybe a flag allowing such behavior? > *think* that this could be done by simply updating the values in=20 > hci_core.c, the hci_alloc_dev() function: >=20 > =A0=A0=A0 hdev->le_conn_min_interval =3D 0x0018; > =A0=A0=A0 hdev->le_conn_max_interval =3D 0x0028; >=20 > would become: >=20 > =A0=A0=A0 hdev->le_conn_min_interval =3D 0x0006; > =A0=A0=A0 hdev->le_conn_max_interval =3D 0x0c80; >=20 > This should allow all devices to negotiate whatever connection interval=20 > they want by default.=A0 If I'm running on a device with debugfs (which I= =20 > happen to be most of the time), then I can still override these defaults= =20 > to control my system. >=20 > Please let me know if you would like me to do any further work towards=20 > resolving this issue.=A0 I'd be happy to test and submit a patch that=20 > changes the default connection min/max interval values- I could probably= =20 > get that done in the next day or two.=A0 If you would like me to=20 > investigate migrating configuration settings to /etc then I'd be happy=20 > to do that as well, but it might take a bit more effort and time. >=20 Well, all these things are important, but are new features but there is a problem: The kernel patch has gone into the stable trees and from there into distrib= utions, so how can these new features flow down the same path. Regards, Andreas