Bluetooth: Add MGMT capability flags for tx power and ext advertising
authorDaniel Winkler <danielwinkler@google.com>
Tue, 25 Aug 2020 23:31:51 +0000 (16:31 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 11 Sep 2020 07:17:26 +0000 (09:17 +0200)
For new advertising features, it will be important for userspace to
know the capabilities of the controller and kernel. If the controller
and kernel support extended advertising, we include flags indicating
hardware offloading support and support for setting tx power of adv
instances.

In the future, vendor-specific commands may allow the setting of tx
power in advertising instances, but for now this feature is only
marked available if extended advertising is supported.

This change is manually verified in userspace by ensuring the
advertising manager's supported_flags field is updated with new flags on
hatch chromebook (ext advertising supported).

Signed-off-by: Daniel Winkler <danielwinkler@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/mgmt.h
net/bluetooth/mgmt.c

index beae5c3980f03b0962e1872f57b003ee1aa5f1ea..9ad505b9e694e4974bc840d712e86677ac832ecb 100644 (file)
@@ -572,6 +572,8 @@ struct mgmt_rp_add_advertising {
 #define MGMT_ADV_FLAG_SEC_1M           BIT(7)
 #define MGMT_ADV_FLAG_SEC_2M           BIT(8)
 #define MGMT_ADV_FLAG_SEC_CODED        BIT(9)
+#define MGMT_ADV_FLAG_CAN_SET_TX_POWER BIT(10)
+#define MGMT_ADV_FLAG_HW_OFFLOAD       BIT(11)
 
 #define MGMT_ADV_FLAG_SEC_MASK (MGMT_ADV_FLAG_SEC_1M | MGMT_ADV_FLAG_SEC_2M | \
                                 MGMT_ADV_FLAG_SEC_CODED)
index e9f4ce2bbb94858cf8928a4c54862b0ee1311673..e1d12494d16e14d66b9a1f9de45bca3f45b61ad9 100644 (file)
@@ -7206,6 +7206,8 @@ static u32 get_supported_adv_flags(struct hci_dev *hdev)
 
        if (ext_adv_capable(hdev)) {
                flags |= MGMT_ADV_FLAG_SEC_1M;
+               flags |= MGMT_ADV_FLAG_HW_OFFLOAD;
+               flags |= MGMT_ADV_FLAG_CAN_SET_TX_POWER;
 
                if (hdev->le_features[1] & HCI_LE_PHY_2M)
                        flags |= MGMT_ADV_FLAG_SEC_2M;