2021-08-03 15:28:53

by Joseph Hwang

[permalink] [raw]
Subject: [PATCH v5 1/4] Bluetooth: btusb: disable Intel link statistics telemetry events

To avoid the overhead on both the controller and the host, the
Intel link statistics telemetry events are disabled by default.

Reviewed-by: Miao-chen Chou <[email protected]>
Signed-off-by: Chethan T N <[email protected]>
Signed-off-by: Kiran K <[email protected]>
Signed-off-by: Joseph Hwang <[email protected]>
---

Changes in v5:
- Rebase this patch 1/4 to resolve conflicts.
- There are changes in patches 3/4 and 4/4.

Changes in v4:
- The original 2 patches in Series-version 3 are split into
2 patches from each patch per reviewers' comments. There are
A total of 4 patches in this series now.
- The callback function is renamed from hdev->set_vs_dbg_evt to
hdev->set_quality_report. Note that there are two different
specifications which will be integrated soon and enabled/disabled
with the same callback. One is Android Bluetooth Quality Report
(BQR), and the other Intel link statistics telemetry events here.
While most Bluetooth controller vendors have supported or are
supporting the Android specification in their controllers, it looks
making sense to use set_quality_report as the callback name.
- Similarly, the config option BT_FEATURE_VS_DBG_EVT is renamed as
BT_FEATURE_QUALITY_REPORT which depends on BT now.
- The BQR is controller specific. There needs to be a valid hdev in the
first place. This is fixed in set_exp_feature().
- In set_exp_feature(), bluez will only set experimental feature to set
BQR when the feature is supported. Please refer to bluez CLs.
- Also refer to bluez patches for the decoding support of btmon.

Changes in v3:
- fix the long line in the commit message

Changes in v2:
- take care of intel_newgen as well as intel_new
- fix the long lines in mgmt.c

drivers/bluetooth/btusb.c | 20 --------------------
1 file changed, 20 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index b1a05bb9f4bf..97414746c029 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2865,7 +2865,6 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
u32 boot_param;
char ddcname[64];
int err;
- struct intel_debug_features features;

BT_DBG("%s", hdev->name);

@@ -2919,15 +2918,6 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
btintel_load_ddc_config(hdev, ddcname);
}

- /* Read the Intel supported features and if new exception formats
- * supported, need to load the additional DDC config to enable.
- */
- err = btintel_read_debug_features(hdev, &features);
- if (!err) {
- /* Set DDC mask for available debug features */
- btintel_set_debug_features(hdev, &features);
- }
-
/* Read the Intel version information after loading the FW */
err = btintel_read_version(hdev, &ver);
if (err)
@@ -2966,7 +2956,6 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev)
u32 boot_param;
char ddcname[64];
int err;
- struct intel_debug_features features;
struct intel_version_tlv version;

bt_dev_dbg(hdev, "");
@@ -3016,15 +3005,6 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev)
*/
btintel_load_ddc_config(hdev, ddcname);

- /* Read the Intel supported features and if new exception formats
- * supported, need to load the additional DDC config to enable.
- */
- err = btintel_read_debug_features(hdev, &features);
- if (!err) {
- /* Set DDC mask for available debug features */
- btintel_set_debug_features(hdev, &features);
- }
-
/* Read the Intel version information after loading the FW */
err = btintel_read_version_tlv(hdev, &version);
if (err)
--
2.32.0.554.ge1b32706d8-goog



2021-08-03 15:29:44

by Joseph Hwang

[permalink] [raw]
Subject: [PATCH v5 2/4] Bluetooth: btintel: support link statistics telemetry events

From: Chethan T N <[email protected]>

This patch supports the link statistics telemetry events for
intel controllers

Reviewed-by: Miao-chen Chou <[email protected]>
Signed-off-by: Chethan T N <[email protected]>
Signed-off-by: Kiran K <[email protected]>
Signed-off-by: Joseph Hwang <[email protected]>
---

(no changes since v1)

drivers/bluetooth/btintel.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index e44b6993cf91..fd21ddb76928 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1248,8 +1248,10 @@ EXPORT_SYMBOL_GPL(btintel_read_debug_features);
int btintel_set_debug_features(struct hci_dev *hdev,
const struct intel_debug_features *features)
{
- u8 mask[11] = { 0x0a, 0x92, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,
+ u8 mask[11] = { 0x0a, 0x92, 0x02, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
+ u8 period[5] = { 0x04, 0x91, 0x02, 0x05, 0x00 };
+ u8 trace_enable = 0x02;
struct sk_buff *skb;

if (!features)
@@ -1266,8 +1268,24 @@ int btintel_set_debug_features(struct hci_dev *hdev,
PTR_ERR(skb));
return PTR_ERR(skb);
}
+ kfree_skb(skb);
+
+ skb = __hci_cmd_sync(hdev, 0xfc8b, 5, period, HCI_INIT_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Setting periodicity for link statistics traces failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+ kfree_skb(skb);

+ skb = __hci_cmd_sync(hdev, 0xfca1, 1, &trace_enable, HCI_INIT_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Enable tracing of link statistics events failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
kfree_skb(skb);
+
return 0;
}
EXPORT_SYMBOL_GPL(btintel_set_debug_features);
--
2.32.0.554.ge1b32706d8-goog