hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/net/bluetooth/hci_request.c
....@@ -367,13 +367,11 @@
367367 /* 160 msec page scan interval */
368368 acp.interval = cpu_to_le16(0x0100);
369369 } else {
370
- type = PAGE_SCAN_TYPE_STANDARD; /* default */
371
-
372
- /* default 1.28 sec page scan */
373
- acp.interval = cpu_to_le16(0x0800);
370
+ type = hdev->def_page_scan_type;
371
+ acp.interval = cpu_to_le16(hdev->def_page_scan_int);
374372 }
375373
376
- acp.window = cpu_to_le16(0x0012);
374
+ acp.window = cpu_to_le16(hdev->def_page_scan_window);
377375
378376 if (__cpu_to_le16(hdev->page_scan_interval) != acp.interval ||
379377 __cpu_to_le16(hdev->page_scan_window) != acp.window)
....@@ -419,18 +417,22 @@
419417 */
420418 hci_discovery_filter_clear(hdev);
421419
420
+ BT_DBG("%s ADV monitoring is %s", hdev->name,
421
+ hci_is_adv_monitoring(hdev) ? "on" : "off");
422
+
422423 if (list_empty(&hdev->pend_le_conns) &&
423
- list_empty(&hdev->pend_le_reports)) {
424
+ list_empty(&hdev->pend_le_reports) &&
425
+ !hci_is_adv_monitoring(hdev)) {
424426 /* If there is no pending LE connections or devices
425
- * to be scanned for, we should stop the background
426
- * scanning.
427
+ * to be scanned for or no ADV monitors, we should stop the
428
+ * background scanning.
427429 */
428430
429431 /* If controller is not scanning we are done. */
430432 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
431433 return;
432434
433
- hci_req_add_le_scan_disable(req);
435
+ hci_req_add_le_scan_disable(req, false);
434436
435437 BT_DBG("%s stopping background scanning", hdev->name);
436438 } else {
....@@ -449,7 +451,7 @@
449451 * don't miss any advertising (due to duplicates filter).
450452 */
451453 if (hci_dev_test_flag(hdev, HCI_LE_SCAN))
452
- hci_req_add_le_scan_disable(req);
454
+ hci_req_add_le_scan_disable(req, false);
453455
454456 hci_req_add_le_passive_scan(req);
455457
....@@ -654,9 +656,14 @@
654656 hci_req_add(req, HCI_OP_WRITE_EIR, sizeof(cp), &cp);
655657 }
656658
657
-void hci_req_add_le_scan_disable(struct hci_request *req)
659
+void hci_req_add_le_scan_disable(struct hci_request *req, bool rpa_le_conn)
658660 {
659661 struct hci_dev *hdev = req->hdev;
662
+
663
+ if (hdev->scanning_paused) {
664
+ bt_dev_dbg(hdev, "Scanning is paused for suspend");
665
+ return;
666
+ }
660667
661668 if (use_ext_scan(hdev)) {
662669 struct hci_cp_le_set_ext_scan_enable cp;
....@@ -672,17 +679,107 @@
672679 cp.enable = LE_SCAN_DISABLE;
673680 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
674681 }
682
+
683
+ /* Disable address resolution */
684
+ if (use_ll_privacy(hdev) &&
685
+ hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
686
+ hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && !rpa_le_conn) {
687
+ __u8 enable = 0x00;
688
+
689
+ hci_req_add(req, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE, 1, &enable);
690
+ }
675691 }
676692
677
-static void add_to_white_list(struct hci_request *req,
678
- struct hci_conn_params *params)
693
+static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
694
+ u8 bdaddr_type)
695
+{
696
+ struct hci_cp_le_del_from_white_list cp;
697
+
698
+ cp.bdaddr_type = bdaddr_type;
699
+ bacpy(&cp.bdaddr, bdaddr);
700
+
701
+ bt_dev_dbg(req->hdev, "Remove %pMR (0x%x) from whitelist", &cp.bdaddr,
702
+ cp.bdaddr_type);
703
+ hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
704
+
705
+ if (use_ll_privacy(req->hdev) &&
706
+ hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
707
+ struct smp_irk *irk;
708
+
709
+ irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
710
+ if (irk) {
711
+ struct hci_cp_le_del_from_resolv_list cp;
712
+
713
+ cp.bdaddr_type = bdaddr_type;
714
+ bacpy(&cp.bdaddr, bdaddr);
715
+
716
+ hci_req_add(req, HCI_OP_LE_DEL_FROM_RESOLV_LIST,
717
+ sizeof(cp), &cp);
718
+ }
719
+ }
720
+}
721
+
722
+/* Adds connection to white list if needed. On error, returns -1. */
723
+static int add_to_white_list(struct hci_request *req,
724
+ struct hci_conn_params *params, u8 *num_entries,
725
+ bool allow_rpa)
679726 {
680727 struct hci_cp_le_add_to_white_list cp;
728
+ struct hci_dev *hdev = req->hdev;
681729
730
+ /* Already in white list */
731
+ if (hci_bdaddr_list_lookup(&hdev->le_white_list, &params->addr,
732
+ params->addr_type))
733
+ return 0;
734
+
735
+ /* Select filter policy to accept all advertising */
736
+ if (*num_entries >= hdev->le_white_list_size)
737
+ return -1;
738
+
739
+ /* White list can not be used with RPAs */
740
+ if (!allow_rpa &&
741
+ !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
742
+ hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
743
+ return -1;
744
+ }
745
+
746
+ /* During suspend, only wakeable devices can be in whitelist */
747
+ if (hdev->suspended && !hci_conn_test_flag(HCI_CONN_FLAG_REMOTE_WAKEUP,
748
+ params->current_flags))
749
+ return 0;
750
+
751
+ *num_entries += 1;
682752 cp.bdaddr_type = params->addr_type;
683753 bacpy(&cp.bdaddr, &params->addr);
684754
755
+ bt_dev_dbg(hdev, "Add %pMR (0x%x) to whitelist", &cp.bdaddr,
756
+ cp.bdaddr_type);
685757 hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
758
+
759
+ if (use_ll_privacy(hdev) &&
760
+ hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
761
+ struct smp_irk *irk;
762
+
763
+ irk = hci_find_irk_by_addr(hdev, &params->addr,
764
+ params->addr_type);
765
+ if (irk) {
766
+ struct hci_cp_le_add_to_resolv_list cp;
767
+
768
+ cp.bdaddr_type = params->addr_type;
769
+ bacpy(&cp.bdaddr, &params->addr);
770
+ memcpy(cp.peer_irk, irk->val, 16);
771
+
772
+ if (hci_dev_test_flag(hdev, HCI_PRIVACY))
773
+ memcpy(cp.local_irk, hdev->irk, 16);
774
+ else
775
+ memset(cp.local_irk, 0, 16);
776
+
777
+ hci_req_add(req, HCI_OP_LE_ADD_TO_RESOLV_LIST,
778
+ sizeof(cp), &cp);
779
+ }
780
+ }
781
+
782
+ return 0;
686783 }
687784
688785 static u8 update_white_list(struct hci_request *req)
....@@ -690,7 +787,18 @@
690787 struct hci_dev *hdev = req->hdev;
691788 struct hci_conn_params *params;
692789 struct bdaddr_list *b;
693
- uint8_t white_list_entries = 0;
790
+ u8 num_entries = 0;
791
+ bool pend_conn, pend_report;
792
+ /* We allow whitelisting even with RPAs in suspend. In the worst case,
793
+ * we won't be able to wake from devices that use the privacy1.2
794
+ * features. Additionally, once we support privacy1.2 and IRK
795
+ * offloading, we can update this to also check for those conditions.
796
+ */
797
+ bool allow_rpa = hdev->suspended;
798
+
799
+ if (use_ll_privacy(hdev) &&
800
+ hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY))
801
+ allow_rpa = true;
694802
695803 /* Go through the current white list programmed into the
696804 * controller one by one and check if that address is still
....@@ -699,29 +807,29 @@
699807 * command to remove it from the controller.
700808 */
701809 list_for_each_entry(b, &hdev->le_white_list, list) {
702
- /* If the device is neither in pend_le_conns nor
703
- * pend_le_reports then remove it from the whitelist.
810
+ pend_conn = hci_pend_le_action_lookup(&hdev->pend_le_conns,
811
+ &b->bdaddr,
812
+ b->bdaddr_type);
813
+ pend_report = hci_pend_le_action_lookup(&hdev->pend_le_reports,
814
+ &b->bdaddr,
815
+ b->bdaddr_type);
816
+
817
+ /* If the device is not likely to connect or report,
818
+ * remove it from the whitelist.
704819 */
705
- if (!hci_pend_le_action_lookup(&hdev->pend_le_conns,
706
- &b->bdaddr, b->bdaddr_type) &&
707
- !hci_pend_le_action_lookup(&hdev->pend_le_reports,
708
- &b->bdaddr, b->bdaddr_type)) {
709
- struct hci_cp_le_del_from_white_list cp;
710
-
711
- cp.bdaddr_type = b->bdaddr_type;
712
- bacpy(&cp.bdaddr, &b->bdaddr);
713
-
714
- hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST,
715
- sizeof(cp), &cp);
820
+ if (!pend_conn && !pend_report) {
821
+ del_from_white_list(req, &b->bdaddr, b->bdaddr_type);
716822 continue;
717823 }
718824
719
- if (hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
720
- /* White list can not be used with RPAs */
825
+ /* White list can not be used with RPAs */
826
+ if (!allow_rpa &&
827
+ !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
828
+ hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
721829 return 0x00;
722830 }
723831
724
- white_list_entries++;
832
+ num_entries++;
725833 }
726834
727835 /* Since all no longer valid white list entries have been
....@@ -735,48 +843,26 @@
735843 * white list.
736844 */
737845 list_for_each_entry(params, &hdev->pend_le_conns, action) {
738
- if (hci_bdaddr_list_lookup(&hdev->le_white_list,
739
- &params->addr, params->addr_type))
740
- continue;
741
-
742
- if (white_list_entries >= hdev->le_white_list_size) {
743
- /* Select filter policy to accept all advertising */
846
+ if (add_to_white_list(req, params, &num_entries, allow_rpa))
744847 return 0x00;
745
- }
746
-
747
- if (hci_find_irk_by_addr(hdev, &params->addr,
748
- params->addr_type)) {
749
- /* White list can not be used with RPAs */
750
- return 0x00;
751
- }
752
-
753
- white_list_entries++;
754
- add_to_white_list(req, params);
755848 }
756849
757850 /* After adding all new pending connections, walk through
758851 * the list of pending reports and also add these to the
759
- * white list if there is still space.
852
+ * white list if there is still space. Abort if space runs out.
760853 */
761854 list_for_each_entry(params, &hdev->pend_le_reports, action) {
762
- if (hci_bdaddr_list_lookup(&hdev->le_white_list,
763
- &params->addr, params->addr_type))
764
- continue;
765
-
766
- if (white_list_entries >= hdev->le_white_list_size) {
767
- /* Select filter policy to accept all advertising */
855
+ if (add_to_white_list(req, params, &num_entries, allow_rpa))
768856 return 0x00;
769
- }
770
-
771
- if (hci_find_irk_by_addr(hdev, &params->addr,
772
- params->addr_type)) {
773
- /* White list can not be used with RPAs */
774
- return 0x00;
775
- }
776
-
777
- white_list_entries++;
778
- add_to_white_list(req, params);
779857 }
858
+
859
+ /* Once the controller offloading of advertisement monitor is in place,
860
+ * the if condition should include the support of MSFT extension
861
+ * support. If suspend is ongoing, whitelist should be the default to
862
+ * prevent waking by random advertisements.
863
+ */
864
+ if (!idr_is_empty(&hdev->adv_monitors_idr) && !hdev->suspended)
865
+ return 0x00;
780866
781867 /* Select filter policy to use white list */
782868 return 0x01;
....@@ -788,9 +874,23 @@
788874 }
789875
790876 static void hci_req_start_scan(struct hci_request *req, u8 type, u16 interval,
791
- u16 window, u8 own_addr_type, u8 filter_policy)
877
+ u16 window, u8 own_addr_type, u8 filter_policy,
878
+ bool addr_resolv)
792879 {
793880 struct hci_dev *hdev = req->hdev;
881
+
882
+ if (hdev->scanning_paused) {
883
+ bt_dev_dbg(hdev, "Scanning is paused for suspend");
884
+ return;
885
+ }
886
+
887
+ if (use_ll_privacy(hdev) &&
888
+ hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
889
+ addr_resolv) {
890
+ u8 enable = 0x01;
891
+
892
+ hci_req_add(req, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE, 1, &enable);
893
+ }
794894
795895 /* Use ext scanning if set ext scan param and ext scan enable is
796896 * supported
....@@ -865,11 +965,44 @@
865965 }
866966 }
867967
968
+/* Returns true if an le connection is in the scanning state */
969
+static inline bool hci_is_le_conn_scanning(struct hci_dev *hdev)
970
+{
971
+ struct hci_conn_hash *h = &hdev->conn_hash;
972
+ struct hci_conn *c;
973
+
974
+ rcu_read_lock();
975
+
976
+ list_for_each_entry_rcu(c, &h->list, list) {
977
+ if (c->type == LE_LINK && c->state == BT_CONNECT &&
978
+ test_bit(HCI_CONN_SCANNING, &c->flags)) {
979
+ rcu_read_unlock();
980
+ return true;
981
+ }
982
+ }
983
+
984
+ rcu_read_unlock();
985
+
986
+ return false;
987
+}
988
+
989
+/* Ensure to call hci_req_add_le_scan_disable() first to disable the
990
+ * controller based address resolution to be able to reconfigure
991
+ * resolving list.
992
+ */
868993 void hci_req_add_le_passive_scan(struct hci_request *req)
869994 {
870995 struct hci_dev *hdev = req->hdev;
871996 u8 own_addr_type;
872997 u8 filter_policy;
998
+ u16 window, interval;
999
+ /* Background scanning should run with address resolution */
1000
+ bool addr_resolv = true;
1001
+
1002
+ if (hdev->scanning_paused) {
1003
+ bt_dev_dbg(hdev, "Scanning is paused for suspend");
1004
+ return;
1005
+ }
8731006
8741007 /* Set require_privacy to false since no SCAN_REQ are send
8751008 * during passive scanning. Not using an non-resolvable address
....@@ -900,26 +1033,284 @@
9001033 (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY))
9011034 filter_policy |= 0x02;
9021035
903
- hci_req_start_scan(req, LE_SCAN_PASSIVE, hdev->le_scan_interval,
904
- hdev->le_scan_window, own_addr_type, filter_policy);
1036
+ if (hdev->suspended) {
1037
+ window = hdev->le_scan_window_suspend;
1038
+ interval = hdev->le_scan_int_suspend;
1039
+ } else if (hci_is_le_conn_scanning(hdev)) {
1040
+ window = hdev->le_scan_window_connect;
1041
+ interval = hdev->le_scan_int_connect;
1042
+ } else if (hci_is_adv_monitoring(hdev)) {
1043
+ window = hdev->le_scan_window_adv_monitor;
1044
+ interval = hdev->le_scan_int_adv_monitor;
1045
+ } else {
1046
+ window = hdev->le_scan_window;
1047
+ interval = hdev->le_scan_interval;
1048
+ }
1049
+
1050
+ bt_dev_dbg(hdev, "LE passive scan with whitelist = %d", filter_policy);
1051
+ hci_req_start_scan(req, LE_SCAN_PASSIVE, interval, window,
1052
+ own_addr_type, filter_policy, addr_resolv);
9051053 }
9061054
9071055 static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
9081056 {
9091057 struct adv_info *adv_instance;
9101058
911
- /* Ignore instance 0 */
1059
+ /* Instance 0x00 always set local name */
9121060 if (instance == 0x00)
913
- return 0;
1061
+ return 1;
9141062
9151063 adv_instance = hci_find_adv_instance(hdev, instance);
9161064 if (!adv_instance)
9171065 return 0;
9181066
919
- /* TODO: Take into account the "appearance" and "local-name" flags here.
920
- * These are currently being ignored as they are not supported.
921
- */
1067
+ if (adv_instance->flags & MGMT_ADV_FLAG_APPEARANCE ||
1068
+ adv_instance->flags & MGMT_ADV_FLAG_LOCAL_NAME)
1069
+ return 1;
1070
+
9221071 return adv_instance->scan_rsp_len;
1072
+}
1073
+
1074
+static void hci_req_clear_event_filter(struct hci_request *req)
1075
+{
1076
+ struct hci_cp_set_event_filter f;
1077
+
1078
+ memset(&f, 0, sizeof(f));
1079
+ f.flt_type = HCI_FLT_CLEAR_ALL;
1080
+ hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &f);
1081
+
1082
+ /* Update page scan state (since we may have modified it when setting
1083
+ * the event filter).
1084
+ */
1085
+ __hci_req_update_scan(req);
1086
+}
1087
+
1088
+static void hci_req_set_event_filter(struct hci_request *req)
1089
+{
1090
+ struct bdaddr_list_with_flags *b;
1091
+ struct hci_cp_set_event_filter f;
1092
+ struct hci_dev *hdev = req->hdev;
1093
+ u8 scan = SCAN_DISABLED;
1094
+
1095
+ /* Always clear event filter when starting */
1096
+ hci_req_clear_event_filter(req);
1097
+
1098
+ list_for_each_entry(b, &hdev->whitelist, list) {
1099
+ if (!hci_conn_test_flag(HCI_CONN_FLAG_REMOTE_WAKEUP,
1100
+ b->current_flags))
1101
+ continue;
1102
+
1103
+ memset(&f, 0, sizeof(f));
1104
+ bacpy(&f.addr_conn_flt.bdaddr, &b->bdaddr);
1105
+ f.flt_type = HCI_FLT_CONN_SETUP;
1106
+ f.cond_type = HCI_CONN_SETUP_ALLOW_BDADDR;
1107
+ f.addr_conn_flt.auto_accept = HCI_CONN_SETUP_AUTO_ON;
1108
+
1109
+ bt_dev_dbg(hdev, "Adding event filters for %pMR", &b->bdaddr);
1110
+ hci_req_add(req, HCI_OP_SET_EVENT_FLT, sizeof(f), &f);
1111
+ scan = SCAN_PAGE;
1112
+ }
1113
+
1114
+ hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
1115
+}
1116
+
1117
+static void hci_req_config_le_suspend_scan(struct hci_request *req)
1118
+{
1119
+ /* Before changing params disable scan if enabled */
1120
+ if (hci_dev_test_flag(req->hdev, HCI_LE_SCAN))
1121
+ hci_req_add_le_scan_disable(req, false);
1122
+
1123
+ /* Configure params and enable scanning */
1124
+ hci_req_add_le_passive_scan(req);
1125
+
1126
+ /* Block suspend notifier on response */
1127
+ set_bit(SUSPEND_SCAN_ENABLE, req->hdev->suspend_tasks);
1128
+}
1129
+
1130
+static void cancel_adv_timeout(struct hci_dev *hdev)
1131
+{
1132
+ if (hdev->adv_instance_timeout) {
1133
+ hdev->adv_instance_timeout = 0;
1134
+ cancel_delayed_work(&hdev->adv_instance_expire);
1135
+ }
1136
+}
1137
+
1138
+/* This function requires the caller holds hdev->lock */
1139
+static void hci_suspend_adv_instances(struct hci_request *req)
1140
+{
1141
+ bt_dev_dbg(req->hdev, "Suspending advertising instances");
1142
+
1143
+ /* Call to disable any advertisements active on the controller.
1144
+ * This will succeed even if no advertisements are configured.
1145
+ */
1146
+ __hci_req_disable_advertising(req);
1147
+
1148
+ /* If we are using software rotation, pause the loop */
1149
+ if (!ext_adv_capable(req->hdev))
1150
+ cancel_adv_timeout(req->hdev);
1151
+}
1152
+
1153
+/* This function requires the caller holds hdev->lock */
1154
+static void hci_resume_adv_instances(struct hci_request *req)
1155
+{
1156
+ struct adv_info *adv;
1157
+
1158
+ bt_dev_dbg(req->hdev, "Resuming advertising instances");
1159
+
1160
+ if (ext_adv_capable(req->hdev)) {
1161
+ /* Call for each tracked instance to be re-enabled */
1162
+ list_for_each_entry(adv, &req->hdev->adv_instances, list) {
1163
+ __hci_req_enable_ext_advertising(req,
1164
+ adv->instance);
1165
+ }
1166
+
1167
+ } else {
1168
+ /* Schedule for most recent instance to be restarted and begin
1169
+ * the software rotation loop
1170
+ */
1171
+ __hci_req_schedule_adv_instance(req,
1172
+ req->hdev->cur_adv_instance,
1173
+ true);
1174
+ }
1175
+}
1176
+
1177
+static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
1178
+{
1179
+ bt_dev_dbg(hdev, "Request complete opcode=0x%x, status=0x%x", opcode,
1180
+ status);
1181
+ if (test_and_clear_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks) ||
1182
+ test_and_clear_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks)) {
1183
+ wake_up(&hdev->suspend_wait_q);
1184
+ }
1185
+}
1186
+
1187
+/* Call with hci_dev_lock */
1188
+void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)
1189
+{
1190
+ int old_state;
1191
+ struct hci_conn *conn;
1192
+ struct hci_request req;
1193
+ u8 page_scan;
1194
+ int disconnect_counter;
1195
+
1196
+ if (next == hdev->suspend_state) {
1197
+ bt_dev_dbg(hdev, "Same state before and after: %d", next);
1198
+ goto done;
1199
+ }
1200
+
1201
+ hdev->suspend_state = next;
1202
+ hci_req_init(&req, hdev);
1203
+
1204
+ if (next == BT_SUSPEND_DISCONNECT) {
1205
+ /* Mark device as suspended */
1206
+ hdev->suspended = true;
1207
+
1208
+ /* Pause discovery if not already stopped */
1209
+ old_state = hdev->discovery.state;
1210
+ if (old_state != DISCOVERY_STOPPED) {
1211
+ set_bit(SUSPEND_PAUSE_DISCOVERY, hdev->suspend_tasks);
1212
+ hci_discovery_set_state(hdev, DISCOVERY_STOPPING);
1213
+ queue_work(hdev->req_workqueue, &hdev->discov_update);
1214
+ }
1215
+
1216
+ hdev->discovery_paused = true;
1217
+ hdev->discovery_old_state = old_state;
1218
+
1219
+ /* Stop directed advertising */
1220
+ old_state = hci_dev_test_flag(hdev, HCI_ADVERTISING);
1221
+ if (old_state) {
1222
+ set_bit(SUSPEND_PAUSE_ADVERTISING, hdev->suspend_tasks);
1223
+ cancel_delayed_work(&hdev->discov_off);
1224
+ queue_delayed_work(hdev->req_workqueue,
1225
+ &hdev->discov_off, 0);
1226
+ }
1227
+
1228
+ /* Pause other advertisements */
1229
+ if (hdev->adv_instance_cnt)
1230
+ hci_suspend_adv_instances(&req);
1231
+
1232
+ hdev->advertising_paused = true;
1233
+ hdev->advertising_old_state = old_state;
1234
+ /* Disable page scan */
1235
+ page_scan = SCAN_DISABLED;
1236
+ hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &page_scan);
1237
+
1238
+ /* Disable LE passive scan if enabled */
1239
+ if (hci_dev_test_flag(hdev, HCI_LE_SCAN))
1240
+ hci_req_add_le_scan_disable(&req, false);
1241
+
1242
+ /* Mark task needing completion */
1243
+ set_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks);
1244
+
1245
+ /* Prevent disconnects from causing scanning to be re-enabled */
1246
+ hdev->scanning_paused = true;
1247
+
1248
+ /* Run commands before disconnecting */
1249
+ hci_req_run(&req, suspend_req_complete);
1250
+
1251
+ disconnect_counter = 0;
1252
+ /* Soft disconnect everything (power off) */
1253
+ list_for_each_entry(conn, &hdev->conn_hash.list, list) {
1254
+ hci_disconnect(conn, HCI_ERROR_REMOTE_POWER_OFF);
1255
+ disconnect_counter++;
1256
+ }
1257
+
1258
+ if (disconnect_counter > 0) {
1259
+ bt_dev_dbg(hdev,
1260
+ "Had %d disconnects. Will wait on them",
1261
+ disconnect_counter);
1262
+ set_bit(SUSPEND_DISCONNECTING, hdev->suspend_tasks);
1263
+ }
1264
+ } else if (next == BT_SUSPEND_CONFIGURE_WAKE) {
1265
+ /* Unpause to take care of updating scanning params */
1266
+ hdev->scanning_paused = false;
1267
+ /* Enable event filter for paired devices */
1268
+ hci_req_set_event_filter(&req);
1269
+ /* Enable passive scan at lower duty cycle */
1270
+ hci_req_config_le_suspend_scan(&req);
1271
+ /* Pause scan changes again. */
1272
+ hdev->scanning_paused = true;
1273
+ hci_req_run(&req, suspend_req_complete);
1274
+ } else {
1275
+ hdev->suspended = false;
1276
+ hdev->scanning_paused = false;
1277
+
1278
+ hci_req_clear_event_filter(&req);
1279
+ /* Reset passive/background scanning to normal */
1280
+ hci_req_config_le_suspend_scan(&req);
1281
+
1282
+ /* Unpause directed advertising */
1283
+ hdev->advertising_paused = false;
1284
+ if (hdev->advertising_old_state) {
1285
+ set_bit(SUSPEND_UNPAUSE_ADVERTISING,
1286
+ hdev->suspend_tasks);
1287
+ hci_dev_set_flag(hdev, HCI_ADVERTISING);
1288
+ queue_work(hdev->req_workqueue,
1289
+ &hdev->discoverable_update);
1290
+ hdev->advertising_old_state = 0;
1291
+ }
1292
+
1293
+ /* Resume other advertisements */
1294
+ if (hdev->adv_instance_cnt)
1295
+ hci_resume_adv_instances(&req);
1296
+
1297
+ /* Unpause discovery */
1298
+ hdev->discovery_paused = false;
1299
+ if (hdev->discovery_old_state != DISCOVERY_STOPPED &&
1300
+ hdev->discovery_old_state != DISCOVERY_STOPPING) {
1301
+ set_bit(SUSPEND_UNPAUSE_DISCOVERY, hdev->suspend_tasks);
1302
+ hci_discovery_set_state(hdev, DISCOVERY_STARTING);
1303
+ queue_work(hdev->req_workqueue, &hdev->discov_update);
1304
+ }
1305
+
1306
+ hci_req_run(&req, suspend_req_complete);
1307
+ }
1308
+
1309
+ hdev->suspend_state = next;
1310
+
1311
+done:
1312
+ clear_bit(SUSPEND_PREPARE_NOTIFIER, hdev->suspend_tasks);
1313
+ wake_up(&hdev->suspend_wait_q);
9231314 }
9241315
9251316 static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
....@@ -927,9 +1318,9 @@
9271318 u8 instance = hdev->cur_adv_instance;
9281319 struct adv_info *adv_instance;
9291320
930
- /* Ignore instance 0 */
1321
+ /* Instance 0x00 always set local name */
9311322 if (instance == 0x00)
932
- return 0;
1323
+ return 1;
9331324
9341325 adv_instance = hci_find_adv_instance(hdev, instance);
9351326 if (!adv_instance)
....@@ -944,13 +1335,8 @@
9441335 void __hci_req_disable_advertising(struct hci_request *req)
9451336 {
9461337 if (ext_adv_capable(req->hdev)) {
947
- struct hci_cp_le_set_ext_adv_enable cp;
1338
+ __hci_req_disable_ext_adv_instance(req, 0x00);
9481339
949
- cp.enable = 0x00;
950
- /* Disable all sets since we only support one set at the moment */
951
- cp.num_of_sets = 0x00;
952
-
953
- hci_req_add(req, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp), &cp);
9541340 } else {
9551341 u8 enable = 0x00;
9561342
....@@ -1058,6 +1444,7 @@
10581444 struct hci_cp_le_set_adv_param cp;
10591445 u8 own_addr_type, enable = 0x01;
10601446 bool connectable;
1447
+ u16 adv_min_interval, adv_max_interval;
10611448 u32 flags;
10621449
10631450 flags = get_adv_instance_flags(hdev, hdev->cur_adv_instance);
....@@ -1091,16 +1478,30 @@
10911478 return;
10921479
10931480 memset(&cp, 0, sizeof(cp));
1094
- cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
1095
- cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
10961481
1097
- if (connectable)
1482
+ if (connectable) {
10981483 cp.type = LE_ADV_IND;
1099
- else if (get_cur_adv_instance_scan_rsp_len(hdev))
1100
- cp.type = LE_ADV_SCAN_IND;
1101
- else
1102
- cp.type = LE_ADV_NONCONN_IND;
11031484
1485
+ adv_min_interval = hdev->le_adv_min_interval;
1486
+ adv_max_interval = hdev->le_adv_max_interval;
1487
+ } else {
1488
+ if (get_cur_adv_instance_scan_rsp_len(hdev))
1489
+ cp.type = LE_ADV_SCAN_IND;
1490
+ else
1491
+ cp.type = LE_ADV_NONCONN_IND;
1492
+
1493
+ if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE) ||
1494
+ hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) {
1495
+ adv_min_interval = DISCOV_LE_FAST_ADV_INT_MIN;
1496
+ adv_max_interval = DISCOV_LE_FAST_ADV_INT_MAX;
1497
+ } else {
1498
+ adv_min_interval = hdev->le_adv_min_interval;
1499
+ adv_max_interval = hdev->le_adv_max_interval;
1500
+ }
1501
+ }
1502
+
1503
+ cp.min_interval = cpu_to_le16(adv_min_interval);
1504
+ cp.max_interval = cpu_to_le16(adv_max_interval);
11041505 cp.own_address_type = own_addr_type;
11051506 cp.channel_map = hdev->le_adv_channel_map;
11061507
....@@ -1216,7 +1617,7 @@
12161617 memcpy(hdev->scan_rsp_data, cp.data, sizeof(cp.data));
12171618 hdev->scan_rsp_data_len = len;
12181619
1219
- cp.handle = 0;
1620
+ cp.handle = instance;
12201621 cp.length = len;
12211622 cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
12221623 cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
....@@ -1360,7 +1761,7 @@
13601761 hdev->adv_data_len = len;
13611762
13621763 cp.length = len;
1363
- cp.handle = 0;
1764
+ cp.handle = instance;
13641765 cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
13651766 cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
13661767
....@@ -1394,6 +1795,28 @@
13941795 __hci_req_update_adv_data(&req, instance);
13951796
13961797 return hci_req_run(&req, NULL);
1798
+}
1799
+
1800
+static void enable_addr_resolution_complete(struct hci_dev *hdev, u8 status,
1801
+ u16 opcode)
1802
+{
1803
+ BT_DBG("%s status %u", hdev->name, status);
1804
+}
1805
+
1806
+void hci_req_disable_address_resolution(struct hci_dev *hdev)
1807
+{
1808
+ struct hci_request req;
1809
+ __u8 enable = 0x00;
1810
+
1811
+ if (!use_ll_privacy(hdev) &&
1812
+ !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION))
1813
+ return;
1814
+
1815
+ hci_req_init(&req, hdev);
1816
+
1817
+ hci_req_add(&req, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE, 1, &enable);
1818
+
1819
+ hci_req_run(&req, enable_addr_resolution_complete);
13971820 }
13981821
13991822 static void adv_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode)
....@@ -1472,7 +1895,13 @@
14721895 if (use_rpa) {
14731896 int to;
14741897
1475
- *own_addr_type = ADDR_LE_DEV_RANDOM;
1898
+ /* If Controller supports LL Privacy use own address type is
1899
+ * 0x03
1900
+ */
1901
+ if (use_ll_privacy(hdev))
1902
+ *own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED;
1903
+ else
1904
+ *own_addr_type = ADDR_LE_DEV_RANDOM;
14761905
14771906 if (adv_instance) {
14781907 if (!adv_instance->rpa_expired &&
....@@ -1488,7 +1917,7 @@
14881917
14891918 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa);
14901919 if (err < 0) {
1491
- BT_ERR("%s failed to generate new RPA", hdev->name);
1920
+ bt_dev_err(hdev, "failed to generate new RPA");
14921921 return err;
14931922 }
14941923
....@@ -1555,8 +1984,6 @@
15551984 int err;
15561985 struct adv_info *adv_instance;
15571986 bool secondary_adv;
1558
- /* In ext adv set param interval is 3 octets */
1559
- const u8 adv_interval[3] = { 0x00, 0x08, 0x00 };
15601987
15611988 if (instance > 0) {
15621989 adv_instance = hci_find_adv_instance(hdev, instance);
....@@ -1574,7 +2001,7 @@
15742001 connectable = (flags & MGMT_ADV_FLAG_CONNECTABLE) ||
15752002 mgmt_get_connectable(hdev);
15762003
1577
- if (!is_advertising_allowed(hdev, connectable))
2004
+ if (!is_advertising_allowed(hdev, connectable))
15782005 return -EPERM;
15792006
15802007 /* Set require_privacy to true only when non-connectable
....@@ -1589,8 +2016,9 @@
15892016
15902017 memset(&cp, 0, sizeof(cp));
15912018
1592
- memcpy(cp.min_interval, adv_interval, sizeof(cp.min_interval));
1593
- memcpy(cp.max_interval, adv_interval, sizeof(cp.max_interval));
2019
+ /* In ext adv set param interval is 3 octets */
2020
+ hci_cpu_to_le24(hdev->le_adv_min_interval, cp.min_interval);
2021
+ hci_cpu_to_le24(hdev->le_adv_max_interval, cp.max_interval);
15942022
15952023 secondary_adv = (flags & MGMT_ADV_FLAG_SEC_MASK);
15962024
....@@ -1614,7 +2042,7 @@
16142042 cp.own_addr_type = own_addr_type;
16152043 cp.channel_map = hdev->le_adv_channel_map;
16162044 cp.tx_power = 127;
1617
- cp.handle = 0;
2045
+ cp.handle = instance;
16182046
16192047 if (flags & MGMT_ADV_FLAG_SEC_2M) {
16202048 cp.primary_phy = HCI_ADV_PHY_1M;
....@@ -1645,7 +2073,7 @@
16452073
16462074 memset(&cp, 0, sizeof(cp));
16472075
1648
- cp.handle = 0;
2076
+ cp.handle = instance;
16492077 bacpy(&cp.bdaddr, &random_addr);
16502078
16512079 hci_req_add(req,
....@@ -1656,11 +2084,21 @@
16562084 return 0;
16572085 }
16582086
1659
-void __hci_req_enable_ext_advertising(struct hci_request *req)
2087
+int __hci_req_enable_ext_advertising(struct hci_request *req, u8 instance)
16602088 {
2089
+ struct hci_dev *hdev = req->hdev;
16612090 struct hci_cp_le_set_ext_adv_enable *cp;
16622091 struct hci_cp_ext_adv_set *adv_set;
16632092 u8 data[sizeof(*cp) + sizeof(*adv_set) * 1];
2093
+ struct adv_info *adv_instance;
2094
+
2095
+ if (instance > 0) {
2096
+ adv_instance = hci_find_adv_instance(hdev, instance);
2097
+ if (!adv_instance)
2098
+ return -EINVAL;
2099
+ } else {
2100
+ adv_instance = NULL;
2101
+ }
16642102
16652103 cp = (void *) data;
16662104 adv_set = (void *) cp->data;
....@@ -1672,27 +2110,85 @@
16722110
16732111 memset(adv_set, 0, sizeof(*adv_set));
16742112
1675
- adv_set->handle = 0;
2113
+ adv_set->handle = instance;
2114
+
2115
+ /* Set duration per instance since controller is responsible for
2116
+ * scheduling it.
2117
+ */
2118
+ if (adv_instance && adv_instance->timeout) {
2119
+ u16 duration = adv_instance->timeout * MSEC_PER_SEC;
2120
+
2121
+ /* Time = N * 10 ms */
2122
+ adv_set->duration = cpu_to_le16(duration / 10);
2123
+ }
16762124
16772125 hci_req_add(req, HCI_OP_LE_SET_EXT_ADV_ENABLE,
16782126 sizeof(*cp) + sizeof(*adv_set) * cp->num_of_sets,
16792127 data);
2128
+
2129
+ return 0;
2130
+}
2131
+
2132
+int __hci_req_disable_ext_adv_instance(struct hci_request *req, u8 instance)
2133
+{
2134
+ struct hci_dev *hdev = req->hdev;
2135
+ struct hci_cp_le_set_ext_adv_enable *cp;
2136
+ struct hci_cp_ext_adv_set *adv_set;
2137
+ u8 data[sizeof(*cp) + sizeof(*adv_set) * 1];
2138
+ u8 req_size;
2139
+
2140
+ /* If request specifies an instance that doesn't exist, fail */
2141
+ if (instance > 0 && !hci_find_adv_instance(hdev, instance))
2142
+ return -EINVAL;
2143
+
2144
+ memset(data, 0, sizeof(data));
2145
+
2146
+ cp = (void *)data;
2147
+ adv_set = (void *)cp->data;
2148
+
2149
+ /* Instance 0x00 indicates all advertising instances will be disabled */
2150
+ cp->num_of_sets = !!instance;
2151
+ cp->enable = 0x00;
2152
+
2153
+ adv_set->handle = instance;
2154
+
2155
+ req_size = sizeof(*cp) + sizeof(*adv_set) * cp->num_of_sets;
2156
+ hci_req_add(req, HCI_OP_LE_SET_EXT_ADV_ENABLE, req_size, data);
2157
+
2158
+ return 0;
2159
+}
2160
+
2161
+int __hci_req_remove_ext_adv_instance(struct hci_request *req, u8 instance)
2162
+{
2163
+ struct hci_dev *hdev = req->hdev;
2164
+
2165
+ /* If request specifies an instance that doesn't exist, fail */
2166
+ if (instance > 0 && !hci_find_adv_instance(hdev, instance))
2167
+ return -EINVAL;
2168
+
2169
+ hci_req_add(req, HCI_OP_LE_REMOVE_ADV_SET, sizeof(instance), &instance);
2170
+
2171
+ return 0;
16802172 }
16812173
16822174 int __hci_req_start_ext_adv(struct hci_request *req, u8 instance)
16832175 {
16842176 struct hci_dev *hdev = req->hdev;
2177
+ struct adv_info *adv_instance = hci_find_adv_instance(hdev, instance);
16852178 int err;
16862179
1687
- if (hci_dev_test_flag(hdev, HCI_LE_ADV))
1688
- __hci_req_disable_advertising(req);
2180
+ /* If instance isn't pending, the chip knows about it, and it's safe to
2181
+ * disable
2182
+ */
2183
+ if (adv_instance && !adv_instance->pending)
2184
+ __hci_req_disable_ext_adv_instance(req, instance);
16892185
16902186 err = __hci_req_setup_ext_adv_instance(req, instance);
16912187 if (err < 0)
16922188 return err;
16932189
16942190 __hci_req_update_scan_rsp_data(req, instance);
1695
- __hci_req_enable_ext_advertising(req);
2191
+ __hci_req_enable_ext_advertising(req, instance);
16962192
16972193 return 0;
16982194 }
....@@ -1736,10 +2232,13 @@
17362232 adv_instance->remaining_time =
17372233 adv_instance->remaining_time - timeout;
17382234
1739
- hdev->adv_instance_timeout = timeout;
1740
- queue_delayed_work(hdev->req_workqueue,
2235
+ /* Only use work for scheduling instances with legacy advertising */
2236
+ if (!ext_adv_capable(hdev)) {
2237
+ hdev->adv_instance_timeout = timeout;
2238
+ queue_delayed_work(hdev->req_workqueue,
17412239 &hdev->adv_instance_expire,
17422240 msecs_to_jiffies(timeout * 1000));
2241
+ }
17432242
17442243 /* If we're just re-scheduling the same instance again then do not
17452244 * execute any HCI commands. This happens when a single instance is
....@@ -1759,14 +2258,6 @@
17592258 }
17602259
17612260 return 0;
1762
-}
1763
-
1764
-static void cancel_adv_timeout(struct hci_dev *hdev)
1765
-{
1766
- if (hdev->adv_instance_timeout) {
1767
- hdev->adv_instance_timeout = 0;
1768
- cancel_delayed_work(&hdev->adv_instance_expire);
1769
- }
17702261 }
17712262
17722263 /* For a single instance:
....@@ -1830,7 +2321,7 @@
18302321 hci_dev_test_flag(hdev, HCI_ADVERTISING))
18312322 return;
18322323
1833
- if (next_instance)
2324
+ if (next_instance && !ext_adv_capable(hdev))
18342325 __hci_req_schedule_adv_instance(req, next_instance->instance,
18352326 false);
18362327 }
....@@ -1872,7 +2363,13 @@
18722363 if (use_rpa) {
18732364 int to;
18742365
1875
- *own_addr_type = ADDR_LE_DEV_RANDOM;
2366
+ /* If Controller supports LL Privacy use own address type is
2367
+ * 0x03
2368
+ */
2369
+ if (use_ll_privacy(hdev))
2370
+ *own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED;
2371
+ else
2372
+ *own_addr_type = ADDR_LE_DEV_RANDOM;
18762373
18772374 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) &&
18782375 !bacmp(&hdev->random_addr, &hdev->rpa))
....@@ -1977,6 +2474,9 @@
19772474 return;
19782475
19792476 if (mgmt_powering_down(hdev))
2477
+ return;
2478
+
2479
+ if (hdev->scanning_paused)
19802480 return;
19812481
19822482 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) ||
....@@ -2288,7 +2788,7 @@
22882788
22892789 static int le_scan_disable(struct hci_request *req, unsigned long opt)
22902790 {
2291
- hci_req_add_le_scan_disable(req);
2791
+ hci_req_add_le_scan_disable(req, false);
22922792 return 0;
22932793 }
22942794
....@@ -2386,7 +2886,12 @@
23862886 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
23872887 return 0;
23882888
2389
- hci_req_add_le_scan_disable(req);
2889
+ if (hdev->scanning_paused) {
2890
+ bt_dev_dbg(hdev, "Scanning is paused for suspend");
2891
+ return 0;
2892
+ }
2893
+
2894
+ hci_req_add_le_scan_disable(req, false);
23902895
23912896 if (use_ext_scan(hdev)) {
23922897 struct hci_cp_le_set_ext_scan_enable ext_enable_cp;
....@@ -2464,33 +2969,20 @@
24642969 uint16_t interval = opt;
24652970 struct hci_dev *hdev = req->hdev;
24662971 u8 own_addr_type;
2972
+ /* White list is not used for discovery */
2973
+ u8 filter_policy = 0x00;
2974
+ /* Discovery doesn't require controller address resolution */
2975
+ bool addr_resolv = false;
24672976 int err;
24682977
24692978 BT_DBG("%s", hdev->name);
2470
-
2471
- if (hci_dev_test_flag(hdev, HCI_LE_ADV)) {
2472
- hci_dev_lock(hdev);
2473
-
2474
- /* Don't let discovery abort an outgoing connection attempt
2475
- * that's using directed advertising.
2476
- */
2477
- if (hci_lookup_le_connect(hdev)) {
2478
- hci_dev_unlock(hdev);
2479
- return -EBUSY;
2480
- }
2481
-
2482
- cancel_adv_timeout(hdev);
2483
- hci_dev_unlock(hdev);
2484
-
2485
- __hci_req_disable_advertising(req);
2486
- }
24872979
24882980 /* If controller is scanning, it means the background scanning is
24892981 * running. Thus, we should temporarily stop it in order to set the
24902982 * discovery scanning parameters.
24912983 */
24922984 if (hci_dev_test_flag(hdev, HCI_LE_SCAN))
2493
- hci_req_add_le_scan_disable(req);
2985
+ hci_req_add_le_scan_disable(req, false);
24942986
24952987 /* All active scans will be done with either a resolvable private
24962988 * address (when privacy feature has been enabled) or non-resolvable
....@@ -2501,8 +2993,9 @@
25012993 if (err < 0)
25022994 own_addr_type = ADDR_LE_DEV_PUBLIC;
25032995
2504
- hci_req_start_scan(req, LE_SCAN_ACTIVE, interval, DISCOV_LE_SCAN_WIN,
2505
- own_addr_type, 0);
2996
+ hci_req_start_scan(req, LE_SCAN_ACTIVE, interval,
2997
+ hdev->le_scan_window_discovery, own_addr_type,
2998
+ filter_policy, addr_resolv);
25062999 return 0;
25073000 }
25083001
....@@ -2549,18 +3042,18 @@
25493042 * to do BR/EDR inquiry.
25503043 */
25513044 hci_req_sync(hdev, interleaved_discov,
2552
- DISCOV_LE_SCAN_INT * 2, HCI_CMD_TIMEOUT,
3045
+ hdev->le_scan_int_discovery * 2, HCI_CMD_TIMEOUT,
25533046 status);
25543047 break;
25553048 }
25563049
25573050 timeout = msecs_to_jiffies(hdev->discov_interleaved_timeout);
2558
- hci_req_sync(hdev, active_scan, DISCOV_LE_SCAN_INT,
3051
+ hci_req_sync(hdev, active_scan, hdev->le_scan_int_discovery,
25593052 HCI_CMD_TIMEOUT, status);
25603053 break;
25613054 case DISCOV_TYPE_LE:
25623055 timeout = msecs_to_jiffies(DISCOV_LE_TIMEOUT);
2563
- hci_req_sync(hdev, active_scan, DISCOV_LE_SCAN_INT,
3056
+ hci_req_sync(hdev, active_scan, hdev->le_scan_int_discovery,
25643057 HCI_CMD_TIMEOUT, status);
25653058 break;
25663059 default:
....@@ -2604,14 +3097,14 @@
26043097
26053098 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
26063099 cancel_delayed_work(&hdev->le_scan_disable);
2607
- hci_req_add_le_scan_disable(req);
3100
+ hci_req_add_le_scan_disable(req, false);
26083101 }
26093102
26103103 ret = true;
26113104 } else {
26123105 /* Passive scanning */
26133106 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
2614
- hci_req_add_le_scan_disable(req);
3107
+ hci_req_add_le_scan_disable(req, false);
26153108 ret = true;
26163109 }
26173110 }
....@@ -2757,7 +3250,8 @@
27573250 if (!ext_adv_capable(hdev))
27583251 __hci_req_enable_advertising(req);
27593252 else if (!err)
2760
- __hci_req_enable_ext_advertising(req);
3253
+ __hci_req_enable_ext_advertising(req,
3254
+ 0x00);
27613255 }
27623256 } else if (!list_empty(&hdev->adv_instances)) {
27633257 struct adv_info *adv_instance;