Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Add support for utilizing Fast Advertising Interval

Changes made to add support for fast advertising interval
as per core 4.1 specification, section 9.3.11.2.

A peripheral device entering any of the following GAP modes and
sending either non-connectable advertising events or scannable
undirected advertising events should use adv_fast_interval2
(100ms - 150ms) for adv_fast_period(30s).

- Non-Discoverable Mode
- Non-Connectable Mode
- Limited Discoverable Mode
- General Discoverable Mode

Signed-off-by: Spoorthi Ravishankar Koppad <spoorthix.k@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Spoorthi Ravishankar Koppad and committed by
Marcel Holtmann
ad4a6795 0e5b36bc

+24 -7
+2
include/net/bluetooth/hci_core.h
··· 1517 1517 #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 1518 1518 #define DISCOV_BREDR_INQUIRY_LEN 0x08 1519 1519 #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ 1520 + #define DISCOV_LE_FAST_ADV_INT_MIN 100 /* msec */ 1521 + #define DISCOV_LE_FAST_ADV_INT_MAX 150 /* msec */ 1520 1522 1521 1523 void mgmt_fill_version_info(void *ver); 1522 1524 int mgmt_new_settings(struct hci_dev *hdev);
+22 -7
net/bluetooth/hci_request.c
··· 1054 1054 struct hci_cp_le_set_adv_param cp; 1055 1055 u8 own_addr_type, enable = 0x01; 1056 1056 bool connectable; 1057 + u16 adv_min_interval, adv_max_interval; 1057 1058 u32 flags; 1058 1059 1059 1060 flags = get_adv_instance_flags(hdev, hdev->cur_adv_instance); ··· 1088 1087 return; 1089 1088 1090 1089 memset(&cp, 0, sizeof(cp)); 1091 - cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); 1092 - cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); 1093 1090 1094 - if (connectable) 1091 + if (connectable) { 1095 1092 cp.type = LE_ADV_IND; 1096 - else if (get_cur_adv_instance_scan_rsp_len(hdev)) 1097 - cp.type = LE_ADV_SCAN_IND; 1098 - else 1099 - cp.type = LE_ADV_NONCONN_IND; 1100 1093 1094 + adv_min_interval = hdev->le_adv_min_interval; 1095 + adv_max_interval = hdev->le_adv_max_interval; 1096 + } else { 1097 + if (get_cur_adv_instance_scan_rsp_len(hdev)) 1098 + cp.type = LE_ADV_SCAN_IND; 1099 + else 1100 + cp.type = LE_ADV_NONCONN_IND; 1101 + 1102 + if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE) || 1103 + hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) { 1104 + adv_min_interval = DISCOV_LE_FAST_ADV_INT_MIN; 1105 + adv_max_interval = DISCOV_LE_FAST_ADV_INT_MAX; 1106 + } else { 1107 + adv_min_interval = hdev->le_adv_min_interval; 1108 + adv_max_interval = hdev->le_adv_max_interval; 1109 + } 1110 + } 1111 + 1112 + cp.min_interval = cpu_to_le16(adv_min_interval); 1113 + cp.max_interval = cpu_to_le16(adv_max_interval); 1101 1114 cp.own_address_type = own_addr_type; 1102 1115 cp.channel_map = hdev->le_adv_channel_map; 1103 1116