Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp276507pxv; Wed, 21 Jul 2021 23:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcr12gAGylU8opICKc4pAGcAQzS3rCKwY3tf572Rc9Et0u2doqhMrkqqYtv3MkUZx5wWTe X-Received: by 2002:aa7:c782:: with SMTP id n2mr52359657eds.77.1626933678584; Wed, 21 Jul 2021 23:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626933678; cv=none; d=google.com; s=arc-20160816; b=r2OyhR2wrH6scgX86bApgsfu0DxcoPuD6lkiAL6s2YRK+MWwjmQSyCziUdm4DnNVRj 4W6hw7ZiqDJ0JbesYLcZpPluBVhwuhX8SzrPkZTLyDvUYF5KxCw0a4lj3B2aUfAtl2sk ayZ1Kht8+HgLrEXj3Nl8sskRY0tQqXLGtsj/6xsTKQjEa/NbLLmXVw1Bc4j2LImXtftE 7kmnpXAs8s1qe8wrClFrNpwf9i6amtbEefftJUGJaJkifC88Z2sF3cPn0dCLnAmLp18m Dw8A+KmFcnkrxeMa71FcQeSFX+nBjCqHK1f/D7kN3usY/0fwSra8xZAUKvgZbeGuMDH6 4fdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=gLi5izO2emW1/Xuquhpo4cj7f9PNlRDquW1Z4C/UgsY=; b=vsNgsNlcxwkK0nvw9nrdhlAgyNEKQzVvJm7BxN6YM/EcWsUnnfdEMN3Aa42O+6/NLQ ULv9D5pkGJkZMRHs6aZoVEe+W0/H0I+ALaNQ1QbP4xyJOxCyqxfp3Ve5hkbFCBQx+2x7 Lw8pj63Su8niIq0jq7jAiWgvYqHcuWmJDzy4WZi6HqAknOy6KaPHnzDC5m6aft04+UeB pOsP7TkLlUkN1qy8jPDkKLXEDx84Wy+bU3ucSN3jFVZ4n32JJoS4VtLFAhSFvsjTv4ku szsz2IRzR5GB7/3yYky6x/YXzCGbwd8/p1n7sxsGu+Pe4ez0S/PM4JE2Ju4KOu/CFT3B 3pMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TEdaBFLa; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si10718997ejm.492.2021.07.21.23.00.55; Wed, 21 Jul 2021 23:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TEdaBFLa; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbhGVFTS (ORCPT + 99 others); Thu, 22 Jul 2021 01:19:18 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:44113 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhGVFTS (ORCPT ); Thu, 22 Jul 2021 01:19:18 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210722055952epoutp0441bd2f7540c2b032e7012684a2074b80~UB3uglv-10482404824epoutp04c for ; Thu, 22 Jul 2021 05:59:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210722055952epoutp0441bd2f7540c2b032e7012684a2074b80~UB3uglv-10482404824epoutp04c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933592; bh=gLi5izO2emW1/Xuquhpo4cj7f9PNlRDquW1Z4C/UgsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TEdaBFLaotVuNE+8ocJdI90Blv6qty5EBJ9mzRExaJ2+zhUKIbB96/whqHcuXGEz0 +IJteh8Rs0FkT4NTXYRbCn4PWxCeGP4JhTRJfXSVRMeN7k754FSX9iavpGC5eTqil1 SCj+mkwo3jHsqJfR96UI6Vh/rO4Yk7HfJNHvC+2o= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210722055952epcas5p263d136220bf91e26f153cb81471528f8~UB3uFaSU-0624506245epcas5p2o; Thu, 22 Jul 2021 05:59:52 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D9.7A.09595.85909F06; Thu, 22 Jul 2021 14:59:52 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722053859epcas5p4b9441d43196ee1111b33b7c8d4827262~UBlfeAX5k2579925799epcas5p4F; Thu, 22 Jul 2021 05:38:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722053859epsmtrp2e2816c99467e7f80a3617885c652dd17~UBlfS4Uyn0680906809epsmtrp2p; Thu, 22 Jul 2021 05:38:59 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-68-60f90958aa51 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6E.C2.08394.37409F06; Thu, 22 Jul 2021 14:38:59 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722053858epsmtip25b95660dc4369213d87375de0496c47c~UBleXzwbA1183911839epsmtip2b; Thu, 22 Jul 2021 05:38:58 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH 1/4] Bluetooth: Fix incorrect parsing of LE_PHY params Date: Thu, 22 Jul 2021 11:08:40 +0530 Message-Id: <20210722053843.6691-2-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722053843.6691-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7bCmpm4E588Eg8XPOCzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mo4tqSPreC9YMWrx4vYGxiv8nUxcnBI CJhI9E1S7WLk4hAS2M0oseP0LCYI5xOjREffBCjnG6PE/s59zF2MnGAdG47tYoFI7GWUeLOs gxWu5cHKj2wgVWwCmhKvP35hArFFBJQlnu07DGYzC+hKnHm/DqxGWMBNYv/2dYwgNouAqsTu 9TvBNvAKWElMa5rJCLFNXmL1hgNgcU4Ba4k5jfPZQJZJCExnl7i28h4bRJGLxKFrE6FsYYlX x7ewQ9hSEp/f7YVqaAb6bvNGdginB+jUH91QHfYS55qesYKCgxno7PW79CHCshJTT62DuppP ovf3EyaIOK/EjnkwtorEhlWdcMs+HlsIDSMPiQ3rNrNDgqWPUWJi91G2CYxysxBWLGBkXMUo mVpQnJueWmxaYJSXWq5XnJhbXJqXrpecn7uJERzPWl47GB8++KB3iJGJg/EQowQHs5IIr0rR 1wQh3pTEyqrUovz4otKc1OJDjNIcLErivOzxQCmB9MSS1OzU1ILUIpgsEwenVAOTb9Dlo3GC pZnMWzX/LPmtOT8rls/odJrYhvltS4JFg9dF9Kjn8hsVep96FcNbP+fWoU/yxufbd3ls2Blv s9fH46H2wqC1PGGfTyVd2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Q1b5lVolMIlfeRCibzl8o 91GIu2TNBWudPZW3Ty/9Xam2/SLXjmn212bnuutHvFFiKc5INNRiLipOBAANeaEFhAIAAA== X-CMS-MailID: 20210722053859epcas5p4b9441d43196ee1111b33b7c8d4827262 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722053859epcas5p4b9441d43196ee1111b33b7c8d4827262 References: <20210722053843.6691-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change is fixing the parsing of PHY LE CODED which is represented with value 0x03 instead of 0x04 in LE PHY Update Complete event. > HCI Event: LE Meta Event (0x3e) plen 6 LE PHY Update Complete (0x0c) Status: Success (0x00) Handle: 0 TX PHY: LE Coded (0x03) RX PHY: LE Coded (0x03) Reviewed-by: Anupam Roy Signed-off-by: Ayush Garg --- include/net/bluetooth/hci.h | 4 ++++ net/bluetooth/hci_conn.c | 21 +++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b80415011dcd..56542a09ec43 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -1681,6 +1681,10 @@ struct hci_cp_le_set_default_phy { #define HCI_LE_SET_PHY_2M 0x02 #define HCI_LE_SET_PHY_CODED 0x04 +#define HCI_LE_READ_PHY_1M 0x01 +#define HCI_LE_READ_PHY_2M 0x02 +#define HCI_LE_READ_PHY_CODED 0x03 + #define HCI_OP_LE_SET_EXT_SCAN_PARAMS 0x2041 struct hci_cp_le_set_ext_scan_params { __u8 own_addr_type; diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 2b5059a56cda..383efd969840 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1915,22 +1915,19 @@ u32 hci_conn_get_phy(struct hci_conn *conn) break; case LE_LINK: - if (conn->le_tx_phy & HCI_LE_SET_PHY_1M) - phys |= BT_PHY_LE_1M_TX; - - if (conn->le_rx_phy & HCI_LE_SET_PHY_1M) - phys |= BT_PHY_LE_1M_RX; - if (conn->le_tx_phy & HCI_LE_SET_PHY_2M) + if (conn->le_tx_phy == HCI_LE_READ_PHY_1M) + phys |= BT_PHY_LE_1M_TX; + else if (conn->le_tx_phy == HCI_LE_READ_PHY_2M) phys |= BT_PHY_LE_2M_TX; - - if (conn->le_rx_phy & HCI_LE_SET_PHY_2M) - phys |= BT_PHY_LE_2M_RX; - - if (conn->le_tx_phy & HCI_LE_SET_PHY_CODED) + else if (conn->le_tx_phy == HCI_LE_READ_PHY_CODED) phys |= BT_PHY_LE_CODED_TX; - if (conn->le_rx_phy & HCI_LE_SET_PHY_CODED) + if (conn->le_rx_phy == HCI_LE_READ_PHY_1M) + phys |= BT_PHY_LE_1M_RX; + else if (conn->le_rx_phy == HCI_LE_READ_PHY_2M) + phys |= BT_PHY_LE_2M_RX; + else if (conn->le_rx_phy == HCI_LE_READ_PHY_CODED) phys |= BT_PHY_LE_CODED_RX; break; -- 2.17.1