Lines Matching refs:req

35 void hci_req_init(struct hci_request *req, struct hci_dev *hdev)
37 skb_queue_head_init(&req->cmd_q);
38 req->hdev = hdev;
39 req->err = 0;
42 void hci_req_purge(struct hci_request *req)
44 skb_queue_purge(&req->cmd_q);
52 static int req_run(struct hci_request *req, hci_req_complete_t complete,
55 struct hci_dev *hdev = req->hdev;
59 bt_dev_dbg(hdev, "length %u", skb_queue_len(&req->cmd_q));
64 if (req->err) {
65 skb_queue_purge(&req->cmd_q);
66 return req->err;
70 if (skb_queue_empty(&req->cmd_q))
73 skb = skb_peek_tail(&req->cmd_q);
82 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q);
90 int hci_req_run(struct hci_request *req, hci_req_complete_t complete)
92 return req_run(req, complete, NULL);
95 int hci_req_run_skb(struct hci_request *req, hci_req_complete_skb_t complete)
97 return req_run(req, NULL, complete);
115 int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
119 struct hci_request req;
124 hci_req_init(&req, hdev);
128 err = func(&req, opt);
135 err = hci_req_run_skb(&req, hci_req_sync_complete);
191 int hci_req_sync(struct hci_dev *hdev, int (*req)(struct hci_request *req,
204 ret = __hci_req_sync(hdev, req, opt, timeout, hci_status);
239 void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
242 struct hci_dev *hdev = req->hdev;
250 if (req->err)
257 req->err = -ENOMEM;
261 if (skb_queue_empty(&req->cmd_q))
266 skb_queue_tail(&req->cmd_q, skb);
269 void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
272 bt_dev_dbg(req->hdev, "HCI_REQ-0x%4.4x", opcode);
273 hci_req_add_ev(req, opcode, plen, param, 0);
328 void hci_req_add_le_scan_disable(struct hci_request *req, bool rpa_le_conn)
330 struct hci_dev *hdev = req->hdev;
342 hci_req_add(req, HCI_OP_LE_SET_EXT_SCAN_ENABLE, sizeof(cp),
349 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
356 hci_req_add(req, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE, 1, &enable);
360 static void del_from_accept_list(struct hci_request *req, bdaddr_t *bdaddr,
368 bt_dev_dbg(req->hdev, "Remove %pMR (0x%x) from accept list", &cp.bdaddr,
370 hci_req_add(req, HCI_OP_LE_DEL_FROM_ACCEPT_LIST, sizeof(cp), &cp);
372 if (use_ll_privacy(req->hdev)) {
375 irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
382 hci_req_add(req, HCI_OP_LE_DEL_FROM_RESOLV_LIST,
389 static int add_to_accept_list(struct hci_request *req,
394 struct hci_dev *hdev = req->hdev;
423 hci_req_add(req, HCI_OP_LE_ADD_TO_ACCEPT_LIST, sizeof(cp), &cp);
442 hci_req_add(req, HCI_OP_LE_ADD_TO_RESOLV_LIST,
450 static u8 update_accept_list(struct hci_request *req)
452 struct hci_dev *hdev = req->hdev;
485 del_from_accept_list(req, &b->bdaddr, b->bdaddr_type);
510 if (add_to_accept_list(req, params, &num_entries, allow_rpa))
519 if (add_to_accept_list(req, params, &num_entries, allow_rpa))
542 static void hci_req_start_scan(struct hci_request *req, u8 type, u16 interval,
546 struct hci_dev *hdev = req->hdev;
556 hci_req_add(req, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE, 1, &enable);
602 hci_req_add(req, HCI_OP_LE_SET_EXT_SCAN_PARAMS,
609 hci_req_add(req, HCI_OP_LE_SET_EXT_SCAN_ENABLE,
621 hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp),
627 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(enable_cp),
632 static void set_random_addr(struct hci_request *req, bdaddr_t *rpa);
633 static int hci_update_random_address(struct hci_request *req,
637 struct hci_dev *hdev = req->hdev;
662 set_random_addr(req, &hdev->rpa);
690 set_random_addr(req, &nrpa);
709 hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6,
726 void hci_req_add_le_passive_scan(struct hci_request *req)
728 struct hci_dev *hdev = req->hdev;
748 if (hci_update_random_address(req, false, scan_use_rpa(hdev),
761 filter_policy = update_accept_list(req);
806 hci_req_start_scan(req, LE_SCAN_PASSIVE, interval, window,
811 static int hci_req_add_le_interleaved_scan(struct hci_request *req,
814 struct hci_dev *hdev = req->hdev;
820 hci_req_add_le_scan_disable(req, false);
821 hci_req_add_le_passive_scan(req);
867 static void set_random_addr(struct hci_request *req, bdaddr_t *rpa)
869 struct hci_dev *hdev = req->hdev;
888 hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6, rpa);