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()
181 if (!hci_pend_le_action_lookup(&hdev->pend_le_conns, in update_white_list()
183 !hci_pend_le_action_lookup(&hdev->pend_le_reports, in update_white_list()
195 if (hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) { in update_white_list()
213 list_for_each_entry(params, &hdev->pend_le_conns, action) { in update_white_list()
214 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
218 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
223 if (hci_find_irk_by_addr(hdev, &params->addr, in update_white_list()
237 list_for_each_entry(params, &hdev->pend_le_reports, action) { in update_white_list()
238 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
242 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
247 if (hci_find_irk_by_addr(hdev, &params->addr, in update_white_list()
265 struct hci_dev *hdev = req->hdev; in hci_req_add_le_passive_scan() local
293 if (hci_dev_test_flag(hdev, HCI_PRIVACY) && in hci_req_add_le_passive_scan()
294 (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) in hci_req_add_le_passive_scan()
299 param_cp.interval = cpu_to_le16(hdev->le_scan_interval); in hci_req_add_le_passive_scan()
300 param_cp.window = cpu_to_le16(hdev->le_scan_window); in hci_req_add_le_passive_scan()
315 struct hci_dev *hdev = req->hdev; in set_random_addr() local
327 if (hci_dev_test_flag(hdev, HCI_LE_ADV) || in set_random_addr()
328 hci_lookup_le_connect(hdev)) { in set_random_addr()
330 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); in set_random_addr()
340 struct hci_dev *hdev = req->hdev; in hci_update_random_address() local
347 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { in hci_update_random_address()
352 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && in hci_update_random_address()
353 !bacmp(&hdev->random_addr, &hdev->rpa)) in hci_update_random_address()
356 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); in hci_update_random_address()
358 BT_ERR("%s failed to generate new RPA", hdev->name); in hci_update_random_address()
362 set_random_addr(req, &hdev->rpa); in hci_update_random_address()
364 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); in hci_update_random_address()
365 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); in hci_update_random_address()
388 if (bacmp(&hdev->bdaddr, &nrpa)) in hci_update_random_address()
406 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || in hci_update_random_address()
407 !bacmp(&hdev->bdaddr, BDADDR_ANY) || in hci_update_random_address()
408 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && in hci_update_random_address()
409 bacmp(&hdev->static_addr, BDADDR_ANY))) { in hci_update_random_address()
411 if (bacmp(&hdev->static_addr, &hdev->random_addr)) in hci_update_random_address()
413 &hdev->static_addr); in hci_update_random_address()
425 static bool disconnected_whitelist_entries(struct hci_dev *hdev) in disconnected_whitelist_entries() argument
429 list_for_each_entry(b, &hdev->whitelist, list) { in disconnected_whitelist_entries()
432 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr); in disconnected_whitelist_entries()
445 struct hci_dev *hdev = req->hdev; in __hci_update_page_scan() local
448 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in __hci_update_page_scan()
451 if (!hdev_is_powered(hdev)) in __hci_update_page_scan()
454 if (mgmt_powering_down(hdev)) in __hci_update_page_scan()
457 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) || in __hci_update_page_scan()
458 disconnected_whitelist_entries(hdev)) in __hci_update_page_scan()
463 if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) in __hci_update_page_scan()
466 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) in __hci_update_page_scan()
472 void hci_update_page_scan(struct hci_dev *hdev) in hci_update_page_scan() argument
476 hci_req_init(&req, hdev); in hci_update_page_scan()
489 struct hci_dev *hdev = req->hdev; in __hci_update_background_scan() local
491 if (!test_bit(HCI_UP, &hdev->flags) || in __hci_update_background_scan()
492 test_bit(HCI_INIT, &hdev->flags) || in __hci_update_background_scan()
493 hci_dev_test_flag(hdev, HCI_SETUP) || in __hci_update_background_scan()
494 hci_dev_test_flag(hdev, HCI_CONFIG) || in __hci_update_background_scan()
495 hci_dev_test_flag(hdev, HCI_AUTO_OFF) || in __hci_update_background_scan()
496 hci_dev_test_flag(hdev, HCI_UNREGISTER)) in __hci_update_background_scan()
500 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in __hci_update_background_scan()
504 if (hdev->discovery.state != DISCOVERY_STOPPED) in __hci_update_background_scan()
514 hci_discovery_filter_clear(hdev); in __hci_update_background_scan()
516 if (list_empty(&hdev->pend_le_conns) && in __hci_update_background_scan()
517 list_empty(&hdev->pend_le_reports)) { in __hci_update_background_scan()
524 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
529 BT_DBG("%s stopping background scanning", hdev->name); in __hci_update_background_scan()
539 if (hci_lookup_le_connect(hdev)) in __hci_update_background_scan()
545 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
550 BT_DBG("%s starting background scanning", hdev->name); in __hci_update_background_scan()
554 static void update_background_scan_complete(struct hci_dev *hdev, u8 status, in update_background_scan_complete() argument
562 void hci_update_background_scan(struct hci_dev *hdev) in hci_update_background_scan() argument
567 hci_req_init(&req, hdev); in hci_update_background_scan()
607 if (req->hdev->hci_ver < BLUETOOTH_VER_1_2) in __hci_abort_conn()
645 static void abort_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode) in abort_conn_complete() argument
656 hci_req_init(&req, conn->hdev); in hci_abort_conn()