Received: by 10.213.65.68 with SMTP id h4csp2116891imn; Sun, 8 Apr 2018 20:07:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Nrl9v/b7zlucgCwIk9Uxxahf45RAcr83+t2vlBuTpPPjzq/Mzc3xsfibJav6PPGL8fN9Z X-Received: by 10.101.72.133 with SMTP id n5mr1671100pgs.390.1523243273505; Sun, 08 Apr 2018 20:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243273; cv=none; d=google.com; s=arc-20160816; b=Uxqs9of+bU+6n4DC7muWnWVVAnXdi9p+fnpzD9AvdG0QrLs1jzp30QcYuiBUqXwGXm E8eKC3WW5254uYsQrpbVL5TQrdQ3KdkMnA5Wre5qfe5wYxIgpaFpXm5no7iHgrn3V7vY luVyxwnLKHPiH6ZQ6CkBvh/ivljB4Jg/+okEY/wzoxi5NhxOlHXhSeiWa3s6chynQUXF IhWp8UcTN2Zq3mNwckADkvdz5Qap+lPpJpLqF68Ahh+KJiJNOycT8gOhLXC2E/2q21kZ HhMzF8b2FSdGBlnaTLpQuC1x94tNGdknUF4ejfa/+vRWtcbdeQ3r/apM14BgXOv9QWD7 OfmA== 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=Wl8Xrp6iiBE3amHNCwzL6QFnRNvbBXwAONLGMnx54BE=; b=iNJcHkrz3ffFJssBdQjgsilbPh9NbIo/TshoNuAlJSXEccYSi9sS/nXxXdJpMKR1yt TGeZxOpYc//SMA4lWwvv8/C0YuxcSDbbIhhVyEmywuNgjl25XBFdSfKemm8R1Gt+L6sW 62COrf8UXpHzkQPSASmOs9z9ywt99oeJHJ7otujemvkfCqoh3cx0pJngLyb49UGTYyzt RviYhAmfXpVzA107J1uep9vv+q8BzBhl/cvZmG1VmL1bt8GJLCTLfeVrZ5ss2vrY8YPt ika6fDE14rM3dlmKh9gRHZBHoEDFLBR8cR/OcMnFrUrbH7niUVbaxKRC6SMTarRrkbqH NdhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=cguXGvjl; 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 p2si11637483pff.253.2018.04.08.20.07.16; Sun, 08 Apr 2018 20:07:53 -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=cguXGvjl; 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 S1756810AbeDIBhb (ORCPT + 99 others); Sun, 8 Apr 2018 21:37:31 -0400 Received: from mail-sn1nam02on0123.outbound.protection.outlook.com ([104.47.36.123]:10752 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932565AbeDIAfE (ORCPT ); Sun, 8 Apr 2018 20:35:04 -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=Wl8Xrp6iiBE3amHNCwzL6QFnRNvbBXwAONLGMnx54BE=; b=cguXGvjlRocyFi57Nsp8fE5nOpHhAfJm144Aogcrxlc0r4nI+3SVKT6u2Kn+rIHh2QLVWHlaqv10m/1yu2gbYH0dujl2xv4Wj9YQOw36up0KCELUbibuVpVcdzIXDr2R1NFUiWMF/BxjH0U+/hBqAjSw4wIvGG2SfmL2MJqXpKI= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) 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:34:59 +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:34:59 +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.4 016/162] Bluetooth: Send HCI Set Event Mask Page 2 command only when needed Thread-Topic: [PATCH AUTOSEL for 4.4 016/162] Bluetooth: Send HCI Set Event Mask Page 2 command only when needed Thread-Index: AQHTz5mZEkGWAD7mGUOHVFMmRlkyxg== Date: Mon, 9 Apr 2018 00:27:54 +0000 Message-ID: <20180409002738.163941-16-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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;DM5PR2101MB1013;7:YA2x9VIA7XupoAAUae6/LWgixzvqmrvXQI3FQHqeCL2wYiPdDErsExdsnt0h1mxiyyxgV7YSQj+NtLU3ePctX3zvoaz1NK+uJlwkeLqlf/OtwbmmTK0GdNnqQu65ZvcX1IOWxc6psncq2xEccAEWvp1VsejMsWiieEEcbjtS20Dzgj7a6g3UcUcsC4NcC8E5yx6/4ELOabcpkbRhieXMbhnLClRJO8Eh2eq1TBlkwHt4Qk6BSTCJv/zXEXGshv5D;20:Kyniiwi73teq+DJOtgFiqSlroPU/tccWZBqQBUwbgnP0QnvbuwAi/n54lNECvubTARFNlpt9Q/5Tg2cRhrfwCLq1bFJlRztdcOevl4YtV2vOx5ABEfH/hEyFias/VsD6JO+jkLsuLQdO7YuHvwY1ioVmFcKfStUbG9HDimZiT7M= X-MS-Office365-Filtering-Correlation-Id: 68032dee-ce05-4417-04d5-08d59db1b9c7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: 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)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(346002)(366004)(376002)(189003)(199004)(478600001)(10290500003)(6436002)(5250100002)(2501003)(14454004)(305945005)(4326008)(66066001)(99286004)(10090500001)(6506007)(36756003)(102836004)(54906003)(486006)(107886003)(76176011)(59450400001)(2900100001)(22452003)(316002)(110136005)(575784001)(86362001)(3660700001)(2906002)(81166006)(186003)(86612001)(81156014)(2616005)(8936002)(3280700002)(11346002)(53936002)(7736002)(476003)(446003)(72206003)(68736007)(6116002)(5660300001)(106356001)(6666003)(6486002)(8676002)(1076002)(105586002)(26005)(6512007)(3846002)(97736004)(25786009)(22906009)(217873001)(19627235001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;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: QlhBr0YJO7oInUxDZmhQxz3q6aPgGi4Hd/FXbq+MtM4DEB1iRbhDDZ72WNsbdnm+takvoVBYQS5pa1cxu/JY9AcO4yl6vYBy3Q/wuYPrT77h46L0pw61jHBWcSi6nppXPAYERapkr1Jidq1+HGwskRhag0PnQS+Wh31UoMorVK9D+qq9aqZdxyC1ziQ5lrf1v7QyMa0V8VlKFnIE/vGX3l5nJkVxfWAFoH7yuVX1YqFaaIEYseU1Lht45xVg6NJK4+sGczTgin3nbcE1p4I4DY5KFRmMc+ei3IO/XzGllZdjcJzq/gOKoQScEuYN9rZc0Y59OBN/cosQe5eDTP9ElznHFxJf5x1ErZNsdWjVXrXaNTN6vizBnlq4O/1GHzdat+fFIIPvVj/Cvx7HsEXdDWh6Uu+yEroWky2nEZ+bAs8= 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: 68032dee-ce05-4417-04d5-08d59db1b9c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:27:54.5672 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 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 62edbf1b114e..5d0b1358c754 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -716,6 +716,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. @@ -725,6 +726,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 @@ -735,13 +737,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 void hci_init3_req(struct hci_request *req, unsigned long opt) --=20 2.15.1