Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17653574ybl; Thu, 2 Jan 2020 09:25:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyrwbVmUbjreECIbvGqHAEVpssV+dVhkGPQX/dflm+HsQCsU1amnYpnNMQNk/D+5PTYPJpf X-Received: by 2002:a05:6830:2102:: with SMTP id i2mr90899807otc.123.1577985956218; Thu, 02 Jan 2020 09:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577985956; cv=none; d=google.com; s=arc-20160816; b=YHGzBJwHKy7VVgGHuwQpqzVvL4pMWey49KnOUaRWeFZdMztgPCLjh64c04rSkm+zSv 89Cx3AY6La8y1qsLTASzSeLdepSR3hV+zPSKUPtAYca0270MZDqgL6+SUG5QMTHNiVHc YzrHS+ub+n5kVUecfpINRW8UDLckjgA3CVKi1b+gdiH+0GlSOMOdDP0dZTk6ejy0Nh/E rm8hGCSil/akMWXKQpV73Gcw90kFTz4ru0MIbEuiBBFEWlhIzG8+Munxa3bf8T8Ei6Sy V/3s7LRrMXKm72q1yoU9DEGH8ZSYG/Mr97a/6IsDdfC1YWq3KNSqJN8pRNlcpGK+BGRn sqXg== 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 :message-id:date:subject:to:from:dkim-signature; bh=r26ZGSJQEt3FmkInwqJEPLO1xlgFwY2lZaHaRg6lYwg=; b=cycYYzug8xFgLBFysOIkKYz9rT/kARqnZRqI4V+k3147Dqr3AOkEmPkr6YnEQb3RuB SgKGbPJghb0plfr+kea1pUKbq9efucJFua1KynOpOUmCFNxqxrH1L6SAjzWO9/L01CHK SpPgofhTepYYozui0BhqoPwZgYPIEUM6hY49cvM/d7ezzk+nlzpefuXNVp8LFu+b5PwP 0gCKLB4OdNMB577fV/yJpC0eDyZ1t12JKImY92MTvPwwmdLs8+xOwJz9vHdPmhTCbioi 7yzcMmA013KDlCcDpbzUm+vpYYx8VfYKaOWS4T1b4I4W/3JwyYZ4WCID8e/PAeLGLMgT +MsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="aY8/HbOT"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si27822642otn.294.2020.01.02.09.25.31; Thu, 02 Jan 2020 09:25:56 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b="aY8/HbOT"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728069AbgABRYu (ORCPT + 99 others); Thu, 2 Jan 2020 12:24:50 -0500 Received: from mail-pj1-f46.google.com ([209.85.216.46]:36456 "EHLO mail-pj1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728056AbgABRYt (ORCPT ); Thu, 2 Jan 2020 12:24:49 -0500 Received: by mail-pj1-f46.google.com with SMTP id n59so3609860pjb.1 for ; Thu, 02 Jan 2020 09:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=r26ZGSJQEt3FmkInwqJEPLO1xlgFwY2lZaHaRg6lYwg=; b=aY8/HbOTKde4UsPJ3UEF8emBVCWj1k4yia5z2ffIv7g9oP3cfQYRo/VTm2lUZpBvFk KvxK7s65/j1QyKcG+eBrkpnjodEfZ84IHgJc8c3k71Tmr5dAeaWcKGhQhIXFvCqy7zU+ 6Z+JaUXv7e3Mk5UkOgXbK+2zqybRH7yzm6D+ZrT42GJfTvicFtmaFLTd65jl1ceu1o8r on4U0Ew1qK2WR+xRYdkrMSlcSmQwwLvuStW0ON51GYR/sp/d0ip2N+1hu8YM63ptkpLW aZ2talx3IIKSttYARaT8Gjcg0MQG19V6ZtzUEdtQ1go9Bge6IOiLfG8Sw9CVaLquYASD s64w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=r26ZGSJQEt3FmkInwqJEPLO1xlgFwY2lZaHaRg6lYwg=; b=bPeI2n3PaKOcougWaC7zntEQYuKhquGGMh9D84p7kyUshxUmWw1BTyI2asMcyanzoW Lh+YOsYyAa+12Q8Cjyc/PTv98WyejaSiY7LtlE5P/Wz4Bgfn7kADgaCEK7I834o6FFKj xJPDm8RraIYQqX6KiK4Z/3kXIcemzpVSy6up7tGu5GIOHDcvhmEXStlcaOUkgAaCDFZB XB3m1I0c7nLu8YE26qsOo+ixBREVCt6Fdm/EOxGkyjvPruBj1/omLzYPeco5ry79u7Dy 7/eTx2n9GUzVTUY9pW3OkNGsSS4br5Rhu+S4llwfWI3umk6nPOfJKXNpHWGCsgeH5MeW gdQg== X-Gm-Message-State: APjAAAV0BkAVi14kQgMK8yUhlW02eY4pqcBYEnIgMQJ10kTKTQ2Hyi7N PEo7pTwc2euW9+ZlfsJNYG8p4FSo1tA= X-Received: by 2002:a17:902:7004:: with SMTP id y4mr86266450plk.263.1577985888822; Thu, 02 Jan 2020 09:24:48 -0800 (PST) Received: from vudentzs-t460s.hsd1.or.comcast.net ([2601:1c0:6800:1640::3287]) by smtp.gmail.com with ESMTPSA id o6sm59041087pgg.37.2020.01.02.09.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2020 09:24:48 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [RFC 1/2] Bluetooth: HCI: Add support for LE PHY Update Complete event Date: Thu, 2 Jan 2020 09:24:46 -0800 Message-Id: <20200102172447.18574-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This handles LE PHY Update Complete event and store both tx_phy and rx_phy into hci_conn. Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/hci.h | 8 ++++++++ include/net/bluetooth/hci_core.h | 2 ++ net/bluetooth/hci_event.c | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 5bc1e30dedde..07b6ecedc6ce 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -2186,6 +2186,14 @@ struct hci_ev_le_direct_adv_info { __s8 rssi; } __packed; +#define HCI_EV_LE_PHY_UPDATE_COMPLETE 0x0c +struct hci_ev_le_phy_update_complete { + __u8 status; + __u16 handle; + __u8 tx_phy; + __u8 rx_phy; +} __packed; + #define HCI_EV_LE_EXT_ADV_REPORT 0x0d struct hci_ev_le_ext_adv_report { __le16 evt_type; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b689aceb636b..faebe3859931 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -493,6 +493,8 @@ struct hci_conn { __u16 le_supv_timeout; __u8 le_adv_data[HCI_MAX_AD_LENGTH]; __u8 le_adv_data_len; + __u8 le_tx_phy; + __u8 le_rx_phy; __s8 rssi; __s8 tx_power; __s8 max_tx_power; diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 1941f120a376..6ddc4a74a5e4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5718,6 +5718,29 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev, hci_dev_unlock(hdev); } +static void hci_le_phy_update_evt(struct hci_dev *hdev, struct sk_buff *skb) +{ + struct hci_ev_le_phy_update_complete *ev = (void *) skb->data; + struct hci_conn *conn; + + BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); + + if (!ev->status) + return; + + hci_dev_lock(hdev); + + conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); + if (!conn) + goto unlock; + + conn->le_tx_phy = ev->tx_phy; + conn->le_rx_phy = ev->rx_phy; + +unlock: + hci_dev_unlock(hdev); +} + static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_le_meta *le_ev = (void *) skb->data; @@ -5753,6 +5776,10 @@ static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_le_direct_adv_report_evt(hdev, skb); break; + case HCI_EV_LE_PHY_UPDATE_COMPLETE: + hci_le_phy_update_evt(hdev, skb); + break; + case HCI_EV_LE_EXT_ADV_REPORT: hci_le_ext_adv_report_evt(hdev, skb); break; -- 2.21.0