From patchwork Tue Nov 2 07:19:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12598003 X-Patchwork-Delegate: marcel@holtmann.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9AC5C433EF for ; Tue, 2 Nov 2021 07:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EE7161051 for ; Tue, 2 Nov 2021 07:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231165AbhKBHWL (ORCPT ); Tue, 2 Nov 2021 03:22:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbhKBHWL (ORCPT ); Tue, 2 Nov 2021 03:22:11 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B13C061766 for ; Tue, 2 Nov 2021 00:19:36 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id v20so14611280plo.7 for ; Tue, 02 Nov 2021 00:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=13hwNJhXlqX8JgwEFp5btGd3IwvyshzRtY7S25HF1qw=; b=BPhvzgTwlZ7Qm0RyfCGd9rZvJLsOUTM6VKeVo1esXSU+M5dLJx7kBKTpLV1k2/8+21 OhHc6N36a9Nqr9SUV3dxmCldra070wcKEeAmmBrsAVhevWELaLMi2Ytb5h0mPXN6euWL wSH0CCJ5Ccc3PK9weYfwX7nFiftqo4RzjKTsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=13hwNJhXlqX8JgwEFp5btGd3IwvyshzRtY7S25HF1qw=; b=yqxU2N/aty5Qqogc1r2Jnp1mRbuz1ctjhz23Zn39QSLUIdxfSkh1398PJT6zYmWxJ1 Ud2z4+o7pY70mmZYtInkJVTqspOhQhQUlu6+gktuN7W//RYfjUlw8hUEROMkBFVfxkMY SRHZDGjVy5umAlKU1Vw8f0gVCDnr3YwxaRzlwPLEsoJsX38Eh8d9Gc5oq+ucSu8GXz4f +cHLvG7gnYsJEUvvAgZWcxCXn+mwfFh8HLFjkv5mEdPw8XbBCB8rycieYhwS0fjgldLY vTMwJ9ipIXkcgYAbCk64l38Ka7m+AE8wDoO9P5pDspJ0W4JV8uXIZrpVc2ahjW61gklm RstA== X-Gm-Message-State: AOAM530ZJlZkgZORWh29DPRoBv20X9Ok2ipsVbVyVTh5p/FDG2OCJ+3q DnZ6yx8qx7EIHAsJlMUxbcOu7O2EvsBMhA== X-Google-Smtp-Source: ABdhPJwQBUfENhnIvKd37TimZ4NnOPVuIT54Tuf6+ai+5Z3rnRqReGJXsd3zQzQ7DfvfkENGreEpyA== X-Received: by 2002:a17:90b:1bd2:: with SMTP id oa18mr4628798pjb.212.1635837575410; Tue, 02 Nov 2021 00:19:35 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:df29:c6df:4e78:cf45]) by smtp.gmail.com with ESMTPSA id b13sm7165243pfv.186.2021.11.02.00.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 00:19:34 -0700 (PDT) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com, pali@kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, josephsih@google.com, Joseph Hwang , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v7 1/2] Bluetooth: Add struct of reading AOSP vendor capabilities Date: Tue, 2 Nov 2021 15:19:28 +0800 Message-Id: <20211102151908.v7.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the struct of reading AOSP vendor capabilities. New capabilities are added incrementally. Note that the version_supported octets will be used to determine whether a capability has been defined for the version. Signed-off-by: Joseph Hwang --- Changes in v7: - Use the full struct aosp_rp_le_get_vendor_capa. If the version_supported is >= 98, check bluetooth_quality_report_support. - Use __le16 and __le32. - Use proper bt_dev_err and bt_dev_warn per review comments. - Skip unnecessary bt_dev_dbg. - Remove unnecessary rp->status check. - Skip unnecessary check about version_supported on versions that we do not care about. For now, we only care about quality report support. - Add the define for the length of the struct. - Mediatek will submit a separate patch to enable aosp. Changes in v6: - Add historical versions of struct aosp_rp_le_get_vendor_capabilities. - Perform the basic check about the struct length. - Through the version, bluetooth_quality_report_support can be checked. Changes in v5: - This is a new patch. - Add struct aosp_rp_le_get_vendor_capabilities so that next patch can determine whether a particular capability is supported or not. include/net/bluetooth/hci_core.h | 1 + net/bluetooth/aosp.c | 83 +++++++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 53a8c7d3a4bf..b5f061882c10 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -603,6 +603,7 @@ struct hci_dev { #if IS_ENABLED(CONFIG_BT_AOSPEXT) bool aosp_capable; + bool aosp_quality_report; #endif int (*open)(struct hci_dev *hdev); diff --git a/net/bluetooth/aosp.c b/net/bluetooth/aosp.c index a1b7762335a5..0d4f1702ce35 100644 --- a/net/bluetooth/aosp.c +++ b/net/bluetooth/aosp.c @@ -8,9 +8,43 @@ #include "aosp.h" +/* Command complete parameters of LE_Get_Vendor_Capabilities_Command + * The parameters grow over time. The base version that declares the + * version_supported field is v0.95. Refer to + * https://cs.android.com/android/platform/superproject/+/master:system/ + * bt/gd/hci/controller.cc;l=452?q=le_get_vendor_capabilities_handler + */ +struct aosp_rp_le_get_vendor_capa { + /* v0.95: 15 octets */ + __u8 status; + __u8 max_advt_instances; + __u8 offloaded_resolution_of_private_address; + __le16 total_scan_results_storage; + __u8 max_irk_list_sz; + __u8 filtering_support; + __u8 max_filter; + __u8 activity_energy_info_support; + __le16 version_supported; + __le16 total_num_of_advt_tracked; + __u8 extended_scan_support; + __u8 debug_logging_supported; + /* v0.96: 16 octets */ + __u8 le_address_generation_offloading_support; + /* v0.98: 21 octets */ + __le32 a2dp_source_offload_capability_mask; + __u8 bluetooth_quality_report_support; + /* v1.00: 25 octets */ + __le32 dynamic_audio_buffer_support; +} __packed; + +#define VENDOR_CAPA_BASE_SIZE 15 +#define VENDOR_CAPA_0_98_SIZE 21 + void aosp_do_open(struct hci_dev *hdev) { struct sk_buff *skb; + struct aosp_rp_le_get_vendor_capa *rp; + u16 version_supported; if (!hdev->aosp_capable) return; @@ -20,9 +54,56 @@ void aosp_do_open(struct hci_dev *hdev) /* LE Get Vendor Capabilities Command */ skb = __hci_cmd_sync(hdev, hci_opcode_pack(0x3f, 0x153), 0, NULL, HCI_CMD_TIMEOUT); - if (IS_ERR(skb)) + if (IS_ERR(skb)) { + bt_dev_err(hdev, "AOSP get vendor capabilities (%ld)", + PTR_ERR(skb)); return; + } + + /* A basic length check */ + if (skb->len < VENDOR_CAPA_BASE_SIZE) + goto length_error; + + rp = (struct aosp_rp_le_get_vendor_capa *)skb->data; + + version_supported = le16_to_cpu(rp->version_supported); + /* AOSP displays the verion number like v0.98, v1.00, etc. */ + bt_dev_info(hdev, "AOSP version v%u.%02u", + version_supported >> 8, version_supported & 0xff); + + /* Do not support very old versions. */ + if (version_supported < 95) { + bt_dev_warn(hdev, "AOSP capabilities version %u too old", + version_supported); + goto done; + } + + if (version_supported >= 95 && version_supported < 98) { + bt_dev_warn(hdev, "AOSP quality report is not supported"); + goto done; + } + + if (version_supported >= 98) { + if (skb->len < VENDOR_CAPA_0_98_SIZE) + goto length_error; + + /* The bluetooth_quality_report_support is defined at version + * v0.98. Refer to + * https://cs.android.com/android/platform/superproject/+/ + * master:system/bt/gd/hci/controller.cc;l=477 + */ + if (rp->bluetooth_quality_report_support) { + hdev->aosp_quality_report = true; + bt_dev_info(hdev, "AOSP quality report is supported"); + } + } + + goto done; + +length_error: + bt_dev_err(hdev, "AOSP capabilities length %d too short", skb->len); +done: kfree_skb(skb); } From patchwork Tue Nov 2 07:19:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12598005 X-Patchwork-Delegate: marcel@holtmann.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CCBEC433FE for ; Tue, 2 Nov 2021 07:19:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB85760E08 for ; Tue, 2 Nov 2021 07:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbhKBHWO (ORCPT ); Tue, 2 Nov 2021 03:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbhKBHWN (ORCPT ); Tue, 2 Nov 2021 03:22:13 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3DB5C0613F5 for ; Tue, 2 Nov 2021 00:19:38 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id m14so18666836pfc.9 for ; Tue, 02 Nov 2021 00:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cgyXjx0gXRTTArRKWdfD1fjcZA324YBVKhkfrxGPSvE=; b=l5LWGV70ZJit/F/xY3XjwzwrtNg5O/I0p4wXWhLclKn9lw9rPzhfChkkPQsvCLzJbF lrTkFtjGHAJZwc2bMP7ePWjCioOJ7Ri5Vc6bsouc2KH0Y8MvjWCJbGeNSQu783AQqnJX XXyfuTwgUmzoWRidamXtZtMjeRffYdNZs8H6U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cgyXjx0gXRTTArRKWdfD1fjcZA324YBVKhkfrxGPSvE=; b=VLj8uujoyoeHFc4CrDkS7wwlfiw83UUy1cnUJ/Pn+deY5NARxqhCEqcdc9hs1ZXy4c VgzpoAG+VzSR1oBMxgBdbcJeoNayS7eVW++UAN8+OkMV79gu+yNSLiBz5XsxQY6qGfNK JKcc79WXCqdcXWIOgKoj8ZAhDRQo/kZDS3dhDp1tYNPhOrKG28s9OyXbVL6weqvJaJUD n0D4jz96gnIJ2nVZCnIlzfUBJCxAa5Ir0JkerVZFGMomQbnviCAIkaqjay97efYb8pwQ vYrgJoG+0BUEsu82yBN4O1gCzlx4UUlzIuETZwcUj4OgwPAAR+cmcgBBAiPJ7NWIIOgT 5m0A== X-Gm-Message-State: AOAM531iDeuQPvtODLLoxpBBzlyZGh4CvHQ24gQ4AErkxesxm/D2zXOH 0oDef4TjTFjsovQGQzQbKHihzeBx4Br71g== X-Google-Smtp-Source: ABdhPJylA4ADw4xRpcASRGdAttO3S093E8CMBNUb0KRJllFg/lOiR16iBsCX+gIsydVPvkhOR9MS+A== X-Received: by 2002:a05:6a00:24d2:b0:481:e44:beb3 with SMTP id d18-20020a056a0024d200b004810e44beb3mr11393270pfv.86.1635837578074; Tue, 02 Nov 2021 00:19:38 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:df29:c6df:4e78:cf45]) by smtp.gmail.com with ESMTPSA id b13sm7165243pfv.186.2021.11.02.00.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 00:19:37 -0700 (PDT) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com, pali@kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, josephsih@google.com, Joseph Hwang , Miao-chen Chou , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v7 2/2] Bluetooth: aosp: Support AOSP Bluetooth Quality Report Date: Tue, 2 Nov 2021 15:19:29 +0800 Message-Id: <20211102151908.v7.2.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog In-Reply-To: <20211102151908.v7.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> References: <20211102151908.v7.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the support of the AOSP Bluetooth Quality Report (BQR) events. Multiple vendors have supported the AOSP Bluetooth Quality Report. When a Bluetooth controller supports the capability, it can enable the aosp capability through hci_set_aosp_capable. Then hci_core will set up the hdev->aosp_set_quality_report callback through aosp_do_open if the controller responds to support the quality report capability. Note that Intel also supports a distinct telemetry quality report specification. Intel sets up the hdev->set_quality_report callback in the btusb driver module. Reviewed-by: Miao-chen Chou Signed-off-by: Joseph Hwang --- Changes in v7: - Remove the unnecessary debug print. Changes in v6: - Use the decimal version instead of hexadecimal version to be consistent with the AOSP specification. - Move the code of checking the bluetooth_quality_report_support field to the previous patch. Changes in v5: - Fix the patch per [RFC PATCH] Bluetooth: Add framework for AOSP quality report setting - Declare aosp_set_quality_report. - Use aosp_do_open() to set hdev->aosp_set_quality_report. - Add aosp_has_quality_report(). - In mgmt, use hdev->aosp_set_quality_report and hdev->set_quality_report separately. Changes in v4: - Move the AOSP BQR support from the driver level to net/bluetooth/aosp. - Fix the drivers to use hci_set_aosp_capable to enable aosp. - Add Mediatek to support the capability too. Changes in v3: - Fix the auto build test ERROR "undefined symbol: btandroid_set_quality_report" that occurred with some kernel configs. - Note that the mgmt-tester "Read Exp Feature - Success" failed. But on my test device, the same test passed. Please kindly let me know what may be going wrong. These patches do not actually modify read/set experimental features. - As to CheckPatch failed. No need to modify the MAINTAINERS file. Thanks. Changes in v2: - Fix the titles of patches 2/3 and 3/3 and reduce their lengths. net/bluetooth/aosp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ net/bluetooth/aosp.h | 13 +++++++ net/bluetooth/mgmt.c | 17 ++++++--- 3 files changed, 112 insertions(+), 5 deletions(-) diff --git a/net/bluetooth/aosp.c b/net/bluetooth/aosp.c index 0d4f1702ce35..86ac6e92ae3d 100644 --- a/net/bluetooth/aosp.c +++ b/net/bluetooth/aosp.c @@ -114,3 +114,90 @@ void aosp_do_close(struct hci_dev *hdev) bt_dev_dbg(hdev, "Cleanup of AOSP extension"); } + +/* BQR command */ +#define BQR_OPCODE hci_opcode_pack(0x3f, 0x015e) + +/* BQR report action */ +#define REPORT_ACTION_ADD 0x00 +#define REPORT_ACTION_DELETE 0x01 +#define REPORT_ACTION_CLEAR 0x02 + +/* BQR event masks */ +#define QUALITY_MONITORING BIT(0) +#define APPRAOCHING_LSTO BIT(1) +#define A2DP_AUDIO_CHOPPY BIT(2) +#define SCO_VOICE_CHOPPY BIT(3) + +#define DEFAULT_BQR_EVENT_MASK (QUALITY_MONITORING | APPRAOCHING_LSTO | \ + A2DP_AUDIO_CHOPPY | SCO_VOICE_CHOPPY) + +/* Reporting at milliseconds so as not to stress the controller too much. + * Range: 0 ~ 65535 ms + */ +#define DEFALUT_REPORT_INTERVAL_MS 5000 + +struct aosp_bqr_cp { + __u8 report_action; + __u32 event_mask; + __u16 min_report_interval; +} __packed; + +static int enable_quality_report(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct aosp_bqr_cp cp; + + cp.report_action = REPORT_ACTION_ADD; + cp.event_mask = DEFAULT_BQR_EVENT_MASK; + cp.min_report_interval = DEFALUT_REPORT_INTERVAL_MS; + + skb = __hci_cmd_sync(hdev, BQR_OPCODE, sizeof(cp), &cp, + HCI_CMD_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Enabling Android BQR failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + kfree_skb(skb); + return 0; +} + +static int disable_quality_report(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct aosp_bqr_cp cp = { 0 }; + + cp.report_action = REPORT_ACTION_CLEAR; + + skb = __hci_cmd_sync(hdev, BQR_OPCODE, sizeof(cp), &cp, + HCI_CMD_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Disabling Android BQR failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + kfree_skb(skb); + return 0; +} + +bool aosp_has_quality_report(struct hci_dev *hdev) +{ + return hdev->aosp_quality_report; +} + +int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + if (!aosp_has_quality_report(hdev)) + return -EOPNOTSUPP; + + bt_dev_dbg(hdev, "quality report enable %d", enable); + + /* Enable or disable the quality report feature. */ + if (enable) + return enable_quality_report(hdev); + else + return disable_quality_report(hdev); +} diff --git a/net/bluetooth/aosp.h b/net/bluetooth/aosp.h index 328fc6d39f70..2fd8886d51b2 100644 --- a/net/bluetooth/aosp.h +++ b/net/bluetooth/aosp.h @@ -8,9 +8,22 @@ void aosp_do_open(struct hci_dev *hdev); void aosp_do_close(struct hci_dev *hdev); +bool aosp_has_quality_report(struct hci_dev *hdev); +int aosp_set_quality_report(struct hci_dev *hdev, bool enable); + #else static inline void aosp_do_open(struct hci_dev *hdev) {} static inline void aosp_do_close(struct hci_dev *hdev) {} +static inline bool aosp_has_quality_report(struct hci_dev *hdev) +{ + return false; +} + +static inline int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + return -EOPNOTSUPP; +} + #endif diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index a7d35c138713..06384d761928 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -39,6 +39,7 @@ #include "mgmt_config.h" #include "msft.h" #include "eir.h" +#include "aosp.h" #define MGMT_VERSION 1 #define MGMT_REVISION 21 @@ -3934,7 +3935,8 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, idx++; } - if (hdev && hdev->set_quality_report) { + if (hdev && (aosp_has_quality_report(hdev) || + hdev->set_quality_report)) { if (hci_dev_test_flag(hdev, HCI_QUALITY_REPORT)) flags = BIT(0); else @@ -4198,7 +4200,7 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, val = !!cp->param[0]; changed = (val != hci_dev_test_flag(hdev, HCI_QUALITY_REPORT)); - if (!hdev->set_quality_report) { + if (!aosp_has_quality_report(hdev) && !hdev->set_quality_report) { err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, MGMT_STATUS_NOT_SUPPORTED); @@ -4206,13 +4208,18 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, } if (changed) { - err = hdev->set_quality_report(hdev, val); + if (hdev->set_quality_report) + err = hdev->set_quality_report(hdev, val); + else + err = aosp_set_quality_report(hdev, val); + if (err) { err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, MGMT_STATUS_FAILED); goto unlock_quality_report; } + if (val) hci_dev_set_flag(hdev, HCI_QUALITY_REPORT); else @@ -4224,8 +4231,8 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, memcpy(rp.uuid, quality_report_uuid, 16); rp.flags = cpu_to_le32(val ? BIT(0) : 0); hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); - err = mgmt_cmd_complete(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, 0, + + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, 0, &rp, sizeof(rp)); if (changed)