Lines Matching refs:ndev
130 static void nci_hci_reset_pipes_per_host(struct nci_dev *ndev, u8 host) in nci_hci_reset_pipes_per_host() argument
135 if (ndev->hci_dev->pipes[i].host == host) { in nci_hci_reset_pipes_per_host()
136 ndev->hci_dev->pipes[i].gate = NCI_HCI_INVALID_GATE; in nci_hci_reset_pipes_per_host()
137 ndev->hci_dev->pipes[i].host = NCI_HCI_INVALID_HOST; in nci_hci_reset_pipes_per_host()
150 static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, in nci_hci_send_data() argument
159 conn_info = ndev->hci_dev->conn_info; in nci_hci_send_data()
164 skb = nci_skb_alloc(ndev, conn_info->max_pkt_payload_len + in nci_hci_send_data()
189 r = nci_send_data(ndev, conn_info->conn_id, skb); in nci_hci_send_data()
196 skb = nci_skb_alloc(ndev, in nci_hci_send_data()
209 static void nci_hci_send_data_req(struct nci_dev *ndev, unsigned long opt) in nci_hci_send_data_req() argument
213 nci_hci_send_data(ndev, data->pipe, data->cmd, in nci_hci_send_data_req()
217 int nci_hci_send_event(struct nci_dev *ndev, u8 gate, u8 event, in nci_hci_send_event() argument
220 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_send_event()
225 return nci_hci_send_data(ndev, pipe, in nci_hci_send_event()
231 int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, in nci_hci_send_cmd() argument
239 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_send_cmd()
244 conn_info = ndev->hci_dev->conn_info; in nci_hci_send_cmd()
254 r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, in nci_hci_send_cmd()
270 static void nci_hci_event_received(struct nci_dev *ndev, u8 pipe, in nci_hci_event_received() argument
273 if (ndev->ops->hci_event_received) in nci_hci_event_received()
274 ndev->ops->hci_event_received(ndev, pipe, event, skb); in nci_hci_event_received()
277 static void nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, in nci_hci_cmd_received() argument
280 u8 gate = ndev->hci_dev->pipes[pipe].gate; in nci_hci_cmd_received()
304 ndev->hci_dev->gate2pipe[dest_gate] = new_pipe; in nci_hci_cmd_received()
305 ndev->hci_dev->pipes[new_pipe].gate = dest_gate; in nci_hci_cmd_received()
306 ndev->hci_dev->pipes[new_pipe].host = in nci_hci_cmd_received()
323 ndev->hci_dev->pipes[delete_info->pipe].gate = in nci_hci_cmd_received()
325 ndev->hci_dev->pipes[delete_info->pipe].host = in nci_hci_cmd_received()
336 nci_hci_reset_pipes_per_host(ndev, cleared_info->host); in nci_hci_cmd_received()
343 if (ndev->ops->hci_cmd_received) in nci_hci_cmd_received()
344 ndev->ops->hci_cmd_received(ndev, pipe, cmd, skb); in nci_hci_cmd_received()
347 nci_hci_send_data(ndev, pipe, status, NULL, 0); in nci_hci_cmd_received()
352 static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, in nci_hci_resp_received() argument
358 conn_info = ndev->hci_dev->conn_info; in nci_hci_resp_received()
367 nci_req_complete(ndev, NCI_STATUS_OK); in nci_hci_resp_received()
373 static void nci_hci_hcp_message_rx(struct nci_dev *ndev, u8 pipe, in nci_hci_hcp_message_rx() argument
378 nci_hci_resp_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
381 nci_hci_cmd_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
384 nci_hci_event_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
393 nci_req_complete(ndev, 0); in nci_hci_hcp_message_rx()
412 nci_hci_hcp_message_rx(hdev->ndev, pipe, in nci_hci_msg_rx_work()
420 struct nci_dev *ndev = (struct nci_dev *)context; in nci_hci_data_received_cb() local
430 nci_req_complete(ndev, err); in nci_hci_data_received_cb()
436 skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); in nci_hci_data_received_cb()
441 if (skb_queue_len(&ndev->hci_dev->rx_hcp_frags)) { in nci_hci_data_received_cb()
443 skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); in nci_hci_data_received_cb()
446 skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { in nci_hci_data_received_cb()
454 nci_req_complete(ndev, -ENOMEM); in nci_hci_data_received_cb()
460 skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { in nci_hci_data_received_cb()
466 skb_queue_purge(&ndev->hci_dev->rx_hcp_frags); in nci_hci_data_received_cb()
481 nci_hci_hcp_message_rx(ndev, pipe, type, in nci_hci_data_received_cb()
484 skb_queue_tail(&ndev->hci_dev->msg_rx_queue, hcp_skb); in nci_hci_data_received_cb()
485 schedule_work(&ndev->hci_dev->msg_rx_work); in nci_hci_data_received_cb()
489 int nci_hci_open_pipe(struct nci_dev *ndev, u8 pipe) in nci_hci_open_pipe() argument
494 conn_info = ndev->hci_dev->conn_info; in nci_hci_open_pipe()
505 return nci_request(ndev, nci_hci_send_data_req, in nci_hci_open_pipe()
511 int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, in nci_hci_set_param() argument
519 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_set_param()
526 conn_info = ndev->hci_dev->conn_info; in nci_hci_set_param()
544 r = nci_request(ndev, nci_hci_send_data_req, in nci_hci_set_param()
559 int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, in nci_hci_get_param() argument
566 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_get_param()
573 conn_info = ndev->hci_dev->conn_info; in nci_hci_get_param()
584 r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, in nci_hci_get_param()
601 int nci_hci_connect_gate(struct nci_dev *ndev, in nci_hci_connect_gate() argument
609 if (ndev->hci_dev->gate2pipe[dest_gate] != NCI_HCI_INVALID_PIPE) in nci_hci_connect_gate()
625 r = nci_hci_open_pipe(ndev, pipe); in nci_hci_connect_gate()
629 ndev->hci_dev->pipes[pipe].gate = dest_gate; in nci_hci_connect_gate()
630 ndev->hci_dev->pipes[pipe].host = dest_host; in nci_hci_connect_gate()
631 ndev->hci_dev->gate2pipe[dest_gate] = pipe; in nci_hci_connect_gate()
637 static int nci_hci_dev_connect_gates(struct nci_dev *ndev, in nci_hci_dev_connect_gates() argument
644 r = nci_hci_connect_gate(ndev, gates->dest_host, in nci_hci_dev_connect_gates()
654 int nci_hci_dev_session_init(struct nci_dev *ndev) in nci_hci_dev_session_init() argument
660 ndev->hci_dev->count_pipes = 0; in nci_hci_dev_session_init()
661 ndev->hci_dev->expected_pipes = 0; in nci_hci_dev_session_init()
663 conn_info = ndev->hci_dev->conn_info; in nci_hci_dev_session_init()
668 conn_info->data_exchange_cb_context = ndev; in nci_hci_dev_session_init()
670 nci_hci_reset_pipes(ndev->hci_dev); in nci_hci_dev_session_init()
672 if (ndev->hci_dev->init_data.gates[0].gate != NCI_HCI_ADMIN_GATE) in nci_hci_dev_session_init()
675 r = nci_hci_connect_gate(ndev, in nci_hci_dev_session_init()
676 ndev->hci_dev->init_data.gates[0].dest_host, in nci_hci_dev_session_init()
677 ndev->hci_dev->init_data.gates[0].gate, in nci_hci_dev_session_init()
678 ndev->hci_dev->init_data.gates[0].pipe); in nci_hci_dev_session_init()
682 r = nci_hci_get_param(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_dev_session_init()
688 skb->len == strlen(ndev->hci_dev->init_data.session_id) && in nci_hci_dev_session_init()
689 memcmp(ndev->hci_dev->init_data.session_id, in nci_hci_dev_session_init()
691 ndev->ops->hci_load_session) { in nci_hci_dev_session_init()
693 r = ndev->ops->hci_load_session(ndev); in nci_hci_dev_session_init()
697 r = nci_hci_dev_connect_gates(ndev, in nci_hci_dev_session_init()
698 ndev->hci_dev->init_data.gate_count, in nci_hci_dev_session_init()
699 ndev->hci_dev->init_data.gates); in nci_hci_dev_session_init()
703 r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_dev_session_init()
705 ndev->hci_dev->init_data.session_id, in nci_hci_dev_session_init()
706 strlen(ndev->hci_dev->init_data.session_id)); in nci_hci_dev_session_init()
718 struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev) in nci_hci_allocate() argument
729 hdev->ndev = ndev; in nci_hci_allocate()