Lines Matching refs:hdev

30 void hci_req_init(struct hci_request *req, struct hci_dev *hdev)  in hci_req_init()  argument
33 req->hdev = hdev; in hci_req_init()
40 struct hci_dev *hdev = req->hdev; in req_run() local
62 spin_lock_irqsave(&hdev->cmd_q.lock, flags); in req_run()
63 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q); in req_run()
64 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags); in req_run()
66 queue_work(hdev->workqueue, &hdev->cmd_work); in req_run()
81 struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, in hci_prepare_cmd() argument
111 struct hci_dev *hdev = req->hdev; in hci_req_add_ev() local
114 BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen); in hci_req_add_ev()
122 skb = hci_prepare_cmd(hdev, opcode, plen, param); in hci_req_add_ev()
125 hdev->name, opcode); in hci_req_add_ev()
166 struct hci_dev *hdev = req->hdev; in update_white_list() local
177 list_for_each_entry(b, &hdev->le_white_list, list) { in update_white_list()
180 if (hci_pend_le_action_lookup(&hdev->pend_le_conns, in update_white_list()
182 hci_pend_le_action_lookup(&hdev->pend_le_reports, in update_white_list()
205 list_for_each_entry(params, &hdev->pend_le_conns, action) { in update_white_list()
206 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
210 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
215 if (hci_find_irk_by_addr(hdev, &params->addr, in update_white_list()
229 list_for_each_entry(params, &hdev->pend_le_reports, action) { in update_white_list()
230 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
234 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
239 if (hci_find_irk_by_addr(hdev, &params->addr, in update_white_list()
257 struct hci_dev *hdev = req->hdev; in hci_req_add_le_passive_scan() local
285 if (hci_dev_test_flag(hdev, HCI_PRIVACY) && in hci_req_add_le_passive_scan()
286 (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) in hci_req_add_le_passive_scan()
291 param_cp.interval = cpu_to_le16(hdev->le_scan_interval); in hci_req_add_le_passive_scan()
292 param_cp.window = cpu_to_le16(hdev->le_scan_window); in hci_req_add_le_passive_scan()
307 struct hci_dev *hdev = req->hdev; in set_random_addr() local
319 if (hci_dev_test_flag(hdev, HCI_LE_ADV) || in set_random_addr()
320 hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { in set_random_addr()
322 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); in set_random_addr()
332 struct hci_dev *hdev = req->hdev; in hci_update_random_address() local
339 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { in hci_update_random_address()
344 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && in hci_update_random_address()
345 !bacmp(&hdev->random_addr, &hdev->rpa)) in hci_update_random_address()
348 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); in hci_update_random_address()
350 BT_ERR("%s failed to generate new RPA", hdev->name); in hci_update_random_address()
354 set_random_addr(req, &hdev->rpa); in hci_update_random_address()
356 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); in hci_update_random_address()
357 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); in hci_update_random_address()
380 if (bacmp(&hdev->bdaddr, &nrpa)) in hci_update_random_address()
398 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || in hci_update_random_address()
399 !bacmp(&hdev->bdaddr, BDADDR_ANY) || in hci_update_random_address()
400 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && in hci_update_random_address()
401 bacmp(&hdev->static_addr, BDADDR_ANY))) { in hci_update_random_address()
403 if (bacmp(&hdev->static_addr, &hdev->random_addr)) in hci_update_random_address()
405 &hdev->static_addr); in hci_update_random_address()
417 static bool disconnected_whitelist_entries(struct hci_dev *hdev) in disconnected_whitelist_entries() argument
421 list_for_each_entry(b, &hdev->whitelist, list) { in disconnected_whitelist_entries()
424 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr); in disconnected_whitelist_entries()
437 struct hci_dev *hdev = req->hdev; in __hci_update_page_scan() local
440 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in __hci_update_page_scan()
443 if (!hdev_is_powered(hdev)) in __hci_update_page_scan()
446 if (mgmt_powering_down(hdev)) in __hci_update_page_scan()
449 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) || in __hci_update_page_scan()
450 disconnected_whitelist_entries(hdev)) in __hci_update_page_scan()
455 if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) in __hci_update_page_scan()
458 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) in __hci_update_page_scan()
464 void hci_update_page_scan(struct hci_dev *hdev) in hci_update_page_scan() argument
468 hci_req_init(&req, hdev); in hci_update_page_scan()
481 struct hci_dev *hdev = req->hdev; in __hci_update_background_scan() local
484 if (!test_bit(HCI_UP, &hdev->flags) || in __hci_update_background_scan()
485 test_bit(HCI_INIT, &hdev->flags) || in __hci_update_background_scan()
486 hci_dev_test_flag(hdev, HCI_SETUP) || in __hci_update_background_scan()
487 hci_dev_test_flag(hdev, HCI_CONFIG) || in __hci_update_background_scan()
488 hci_dev_test_flag(hdev, HCI_AUTO_OFF) || in __hci_update_background_scan()
489 hci_dev_test_flag(hdev, HCI_UNREGISTER)) in __hci_update_background_scan()
493 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in __hci_update_background_scan()
497 if (hdev->discovery.state != DISCOVERY_STOPPED) in __hci_update_background_scan()
507 hci_discovery_filter_clear(hdev); in __hci_update_background_scan()
509 if (list_empty(&hdev->pend_le_conns) && in __hci_update_background_scan()
510 list_empty(&hdev->pend_le_reports)) { in __hci_update_background_scan()
517 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
522 BT_DBG("%s stopping background scanning", hdev->name); in __hci_update_background_scan()
532 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in __hci_update_background_scan()
539 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
544 BT_DBG("%s starting background scanning", hdev->name); in __hci_update_background_scan()
548 static void update_background_scan_complete(struct hci_dev *hdev, u8 status, in update_background_scan_complete() argument
556 void hci_update_background_scan(struct hci_dev *hdev) in hci_update_background_scan() argument
561 hci_req_init(&req, hdev); in hci_update_background_scan()