Received: by 10.213.65.68 with SMTP id h4csp2119357imn; Sun, 8 Apr 2018 20:11:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49eRwskZpKcLLkFwrvNGqIKqigmMPOZkj2FByH9IXeF/NVa5T8JvfhxI1Ch8O336xkycqlm X-Received: by 10.98.214.152 with SMTP id a24mr27573548pfl.159.1523243380037; Sun, 08 Apr 2018 20:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243379; cv=none; d=google.com; s=arc-20160816; b=Xuf9SenBtS817aGh5vicSucnl/LFbN8r/33i0DT3ooJNDeP1uvh8fx+QystvjitZ9I ZmY9juPjFeJ56sBCKBei4ViJ5llnEqx8gZrC14V23P7S7jmbgdkxKoGX7doIncG1wUF8 +XqUHX+M5zE1dW5g/NM9QxkAwvmxsLX/7HjBBGeBTnYr6jAlma9+d7WaMbEtz2c8IqBQ k2xM88CnSU3D99nfOdEQAGjA4pVzTRpK2idkqNfRz1rPkcihA27tKvLK3B6afl39xK0y E6eJTFLhOEqLQdqKjcQM1viKozSwNnB0JJBqDrrSkq4d90+9nMbdbBQSy+3Ojx1XJNbi AUcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ICx+GXyAVJcMXkguJWGeaXv2uN3V1dc1Z14U3l3Q06k=; b=tkZwR7QeAY3wvfulyJQ5DpxyhZwKss6N8cz3L5v9c29j3ej2eIo+2Z8RnT/5zkyfbY eMTaI+zYMyK4pTWvQtzMXu/gOsNSz/nVjKDjWUFgLsWP91YKPvEQ4T+fLaqMkFO7ZNSY 9MXxA56h1GDkmnxdm1rFaxFCJHVunPScqWO+j2gdM555JmU7Z15PPzTVwBNEAnjNBgS2 YyoN0/FYcsJ3MBrCCVWaFSjat58D8fOiu6o3U2hAUkpm5Gg7x4fP/xLpjknh8CoxkpxL V3akg+MCMDIrDpoTEdJfbbNqK/DaYxUcdNEcx0J1xpXaSqq/wHi42ydrKDOCjHSQzb1J D7nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HQrIAnCA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si10582286pgp.431.2018.04.08.20.09.02; Sun, 08 Apr 2018 20:09:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HQrIAnCA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756262AbeDICjw (ORCPT + 99 others); Sun, 8 Apr 2018 22:39:52 -0400 Received: from mail-cys01nam02on0094.outbound.protection.outlook.com ([104.47.37.94]:22752 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755561AbeDIA10 (ORCPT ); Sun, 8 Apr 2018 20:27:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ICx+GXyAVJcMXkguJWGeaXv2uN3V1dc1Z14U3l3Q06k=; b=HQrIAnCAek/i78qL+mxcfpR6arDVkUkDb3FrYulON70OK1tM4gpuYNi5rHgTrALRWvqMaghxDr4la+CTTMoo+7Arwl9U8zKCrukgrBUQWPp+PFCD3hHKf4Tso15KQ8YZznxLO1lLs+A/ZCI6kIR3iqp9MEefi91z6obL2quRpPQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:27:21 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:27:21 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Marcel Holtmann , Szymon Janc , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 038/293] Bluetooth: Send HCI Set Event Mask Page 2 command only when needed Thread-Topic: [PATCH AUTOSEL for 4.9 038/293] Bluetooth: Send HCI Set Event Mask Page 2 command only when needed Thread-Index: AQHTz5j25TxXBdaOQkWMi0rvJBf+AQ== Date: Mon, 9 Apr 2018 00:23:19 +0000 Message-ID: <20180409002239.163177-38-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1031;7:yF+7cZwexJxhJqOXUYbM5OFuUOJoo/L/I4vJHifTlt6TGuxvMbGtDWwDKUH2+Cl8+NdxT+MjHjAYeMPi9kDJKBu6L5GcZtVslVeGDyG3DKujjhoajTjQqLnd41krj/f8fFh1l07PoG8TJGXeK1RMCeIyCXeBhbJkTqAWzQNJGbY2wnqrJoU4T2yXQhQm2y7nqD16G1GufDKlhC1NMrJbMDX50mPpSUCsqDr3/+wtUPHfBqG6DV1IW+Qfjsinz0p/;20:qEdxiDuU2cXsM2cboX69Syy9ZDvCIK33BKxHjSCkga5NQk+fkrlDajJG0ubZHFNgm8w0o7UGyRvNqewzowJL27vI7A7hsBjVwSa0pHMq6oosjqV094kQGgmTbyXjKhWdOETvcAu4hZvTSaNkpHl8qYHfGITDuh17NhUoSnwnKhs= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 2a514c59-e7d5-49c8-7760-08d59db0a8f7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1031;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1031; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(2900100001)(10290500003)(99286004)(76176011)(14454004)(7736002)(11346002)(26005)(86612001)(72206003)(478600001)(36756003)(106356001)(66066001)(2616005)(186003)(575784001)(22452003)(86362001)(68736007)(305945005)(54906003)(102836004)(486006)(59450400001)(110136005)(316002)(6506007)(446003)(107886003)(53936002)(4326008)(105586002)(6436002)(6486002)(476003)(6512007)(5660300001)(5250100002)(25786009)(3846002)(6116002)(1076002)(97736004)(3280700002)(2501003)(2906002)(81156014)(8676002)(10090500001)(81166006)(8936002)(3660700001)(22906009)(217873001)(19627235001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1031;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yJK/H8OE1ozHhlxSLr1QPZjEkiY08kX+815uXQWjvnRCVSKPkWs9Os4f3+GL7DAQHpu6dsEViXNu4S4rfvpzCuOgiYBCVe/ZwTT8IyyqE0bS/DnVdM8tpSs7BjipmzhdBXxUrBO1SBhkhjRHnAqLizg1cxDjgVYsbTWyK2rS/9GC5rJIIVNZ4gPRjqy0dQ+yMksFXidWLU7y21uE9Wc2lglpcTB6Jb/9292P6tetBvqMXn60GMAI1ocXXwwV7rxtfMbvWd67D4ZaJR5+PFME7K3/PFtAETdewWflIa+T2GZC1o7P0rJ5RiAv+KjkmMoloD+XAzqFCEdFSZh/KHwwZmn9hln6xZloMUCJ7aNxEaLuinA4kNibSMmhPo3Yyrk9oVqqw/n4/vs4Qh4LnO4pr1nKmMtRA0U+LO9uSnb1x4M= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a514c59-e7d5-49c8-7760-08d59db0a8f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:19.6748 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marcel Holtmann [ Upstream commit 313f6888c8fbb1bc8b36c9012ce4e1de848df696 ] The Broadcom BCM20702 Bluetooth controller in ThinkPad-T530 devices report support for the Set Event Mask Page 2 command, but actually do return an error when trying to use it. < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 162 entries ... Set Event Mask Page 2 (Octet 22 - Bit 2) ... < HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8 Mask: 0x0000000000000000 > HCI Event: Command Complete (0x0e) plen 4 Set Event Mask Page 2 (0x03|0x0063) ncmd 1 Status: Unknown HCI Command (0x01) Since these controllers do not support any feature that would require the event mask page 2 to be modified, it is safe to not send this command at all. The default value is all bits set to zero. T: Bus=3D01 Lev=3D02 Prnt=3D02 Port=3D03 Cnt=3D03 Dev#=3D 9 Spd=3D12 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D0a5c ProdID=3D21e6 Rev=3D 1.12 S: Manufacturer=3DBroadcom Corp S: Product=3DBCM20702A0 S: SerialNumber=3DF82FA8E8CFC0 C:* #Ifs=3D 4 Cfg#=3D 1 Atr=3De0 MxPwr=3D 0mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D81(I) Atr=3D03(Int.) MxPS=3D 16 Ivl=3D1ms E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 64 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 64 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 0 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 0 Ivl=3D1ms I: If#=3D 1 Alt=3D 1 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 9 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 9 Ivl=3D1ms I: If#=3D 1 Alt=3D 2 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 17 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 17 Ivl=3D1ms I: If#=3D 1 Alt=3D 3 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 25 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 25 Ivl=3D1ms I: If#=3D 1 Alt=3D 4 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 33 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 33 Ivl=3D1ms I: If#=3D 1 Alt=3D 5 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D01 Prot=3D01 Driver= =3Dbtusb E: Ad=3D83(I) Atr=3D01(Isoc) MxPS=3D 49 Ivl=3D1ms E: Ad=3D03(O) Atr=3D01(Isoc) MxPS=3D 49 Ivl=3D1ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dbtusb E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 32 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 32 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 0 Cls=3Dfe(app. ) Sub=3D01 Prot=3D01 Driver= =3D(none) Signed-off-by: Marcel Holtmann Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Szymon Janc Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3ac89e9ace71..4bd72d2fe415 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -548,6 +548,7 @@ static void hci_set_event_mask_page_2(struct hci_reques= t *req) { struct hci_dev *hdev =3D req->hdev; u8 events[8] =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + bool changed =3D false; =20 /* If Connectionless Slave Broadcast master role is supported * enable all necessary events for it. @@ -557,6 +558,7 @@ static void hci_set_event_mask_page_2(struct hci_reques= t *req) events[1] |=3D 0x80; /* Synchronization Train Complete */ events[2] |=3D 0x10; /* Slave Page Response Timeout */ events[2] |=3D 0x20; /* CSB Channel Map Change */ + changed =3D true; } =20 /* If Connectionless Slave Broadcast slave role is supported @@ -567,13 +569,24 @@ static void hci_set_event_mask_page_2(struct hci_requ= est *req) events[2] |=3D 0x02; /* CSB Receive */ events[2] |=3D 0x04; /* CSB Timeout */ events[2] |=3D 0x08; /* Truncated Page Complete */ + changed =3D true; } =20 /* Enable Authenticated Payload Timeout Expired event if supported */ - if (lmp_ping_capable(hdev) || hdev->le_features[0] & HCI_LE_PING) + if (lmp_ping_capable(hdev) || hdev->le_features[0] & HCI_LE_PING) { events[2] |=3D 0x80; + changed =3D true; + } =20 - hci_req_add(req, HCI_OP_SET_EVENT_MASK_PAGE_2, sizeof(events), events); + /* Some Broadcom based controllers indicate support for Set Event + * Mask Page 2 command, but then actually do not support it. Since + * the default value is all bits set to zero, the command is only + * required if the event mask has to be changed. In case no change + * to the event mask is needed, skip this command. + */ + if (changed) + hci_req_add(req, HCI_OP_SET_EVENT_MASK_PAGE_2, + sizeof(events), events); } =20 static int hci_init3_req(struct hci_request *req, unsigned long opt) --=20 2.15.1