Lines Matching full:ndev
121 static void nci_hci_reset_pipes_per_host(struct nci_dev *ndev, u8 host) in nci_hci_reset_pipes_per_host() argument
126 if (ndev->hci_dev->pipes[i].host == host) { in nci_hci_reset_pipes_per_host()
127 ndev->hci_dev->pipes[i].gate = NCI_HCI_INVALID_GATE; in nci_hci_reset_pipes_per_host()
128 ndev->hci_dev->pipes[i].host = NCI_HCI_INVALID_HOST; in nci_hci_reset_pipes_per_host()
141 static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, in nci_hci_send_data() argument
150 conn_info = ndev->hci_dev->conn_info; in nci_hci_send_data()
155 skb = nci_skb_alloc(ndev, conn_info->max_pkt_payload_len + in nci_hci_send_data()
180 r = nci_send_data(ndev, conn_info->conn_id, skb); in nci_hci_send_data()
187 skb = nci_skb_alloc(ndev, in nci_hci_send_data()
200 static void nci_hci_send_data_req(struct nci_dev *ndev, unsigned long opt) in nci_hci_send_data_req() argument
204 nci_hci_send_data(ndev, data->pipe, data->cmd, in nci_hci_send_data_req()
208 int nci_hci_send_event(struct nci_dev *ndev, u8 gate, u8 event, in nci_hci_send_event() argument
211 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_send_event()
216 return nci_hci_send_data(ndev, pipe, in nci_hci_send_event()
222 int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, in nci_hci_send_cmd() argument
230 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_send_cmd()
235 conn_info = ndev->hci_dev->conn_info; in nci_hci_send_cmd()
245 r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, in nci_hci_send_cmd()
261 int nci_hci_clear_all_pipes(struct nci_dev *ndev) in nci_hci_clear_all_pipes() argument
265 r = nci_hci_send_cmd(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_clear_all_pipes()
270 nci_hci_reset_pipes(ndev->hci_dev); in nci_hci_clear_all_pipes()
275 static void nci_hci_event_received(struct nci_dev *ndev, u8 pipe, in nci_hci_event_received() argument
278 if (ndev->ops->hci_event_received) in nci_hci_event_received()
279 ndev->ops->hci_event_received(ndev, pipe, event, skb); in nci_hci_event_received()
282 static void nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, in nci_hci_cmd_received() argument
285 u8 gate = ndev->hci_dev->pipes[pipe].gate; in nci_hci_cmd_received()
313 ndev->hci_dev->gate2pipe[dest_gate] = new_pipe; in nci_hci_cmd_received()
314 ndev->hci_dev->pipes[new_pipe].gate = dest_gate; in nci_hci_cmd_received()
315 ndev->hci_dev->pipes[new_pipe].host = in nci_hci_cmd_received()
336 ndev->hci_dev->pipes[delete_info->pipe].gate = in nci_hci_cmd_received()
338 ndev->hci_dev->pipes[delete_info->pipe].host = in nci_hci_cmd_received()
349 nci_hci_reset_pipes_per_host(ndev, cleared_info->host); in nci_hci_cmd_received()
356 if (ndev->ops->hci_cmd_received) in nci_hci_cmd_received()
357 ndev->ops->hci_cmd_received(ndev, pipe, cmd, skb); in nci_hci_cmd_received()
360 nci_hci_send_data(ndev, pipe, status, NULL, 0); in nci_hci_cmd_received()
365 static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, in nci_hci_resp_received() argument
371 conn_info = ndev->hci_dev->conn_info; in nci_hci_resp_received()
380 nci_req_complete(ndev, NCI_STATUS_OK); in nci_hci_resp_received()
386 static void nci_hci_hcp_message_rx(struct nci_dev *ndev, u8 pipe, in nci_hci_hcp_message_rx() argument
391 nci_hci_resp_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
394 nci_hci_cmd_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
397 nci_hci_event_received(ndev, pipe, instruction, skb); in nci_hci_hcp_message_rx()
406 nci_req_complete(ndev, NCI_STATUS_OK); in nci_hci_hcp_message_rx()
425 nci_hci_hcp_message_rx(hdev->ndev, pipe, in nci_hci_msg_rx_work()
433 struct nci_dev *ndev = (struct nci_dev *)context; in nci_hci_data_received_cb() local
443 nci_req_complete(ndev, err); in nci_hci_data_received_cb()
449 skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); in nci_hci_data_received_cb()
454 if (skb_queue_len(&ndev->hci_dev->rx_hcp_frags)) { in nci_hci_data_received_cb()
456 skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); in nci_hci_data_received_cb()
459 skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { in nci_hci_data_received_cb()
467 nci_req_complete(ndev, -ENOMEM); in nci_hci_data_received_cb()
473 skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { in nci_hci_data_received_cb()
480 skb_queue_purge(&ndev->hci_dev->rx_hcp_frags); in nci_hci_data_received_cb()
495 nci_hci_hcp_message_rx(ndev, pipe, type, in nci_hci_data_received_cb()
498 skb_queue_tail(&ndev->hci_dev->msg_rx_queue, hcp_skb); in nci_hci_data_received_cb()
499 schedule_work(&ndev->hci_dev->msg_rx_work); in nci_hci_data_received_cb()
503 int nci_hci_open_pipe(struct nci_dev *ndev, u8 pipe) in nci_hci_open_pipe() argument
508 conn_info = ndev->hci_dev->conn_info; in nci_hci_open_pipe()
519 return nci_request(ndev, nci_hci_send_data_req, in nci_hci_open_pipe()
525 static u8 nci_hci_create_pipe(struct nci_dev *ndev, u8 dest_host, in nci_hci_create_pipe() argument
539 *result = nci_hci_send_cmd(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_create_pipe()
554 static int nci_hci_delete_pipe(struct nci_dev *ndev, u8 pipe) in nci_hci_delete_pipe() argument
558 return nci_hci_send_cmd(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_delete_pipe()
562 int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, in nci_hci_set_param() argument
570 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_set_param()
577 conn_info = ndev->hci_dev->conn_info; in nci_hci_set_param()
595 r = nci_request(ndev, nci_hci_send_data_req, in nci_hci_set_param()
610 int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, in nci_hci_get_param() argument
617 u8 pipe = ndev->hci_dev->gate2pipe[gate]; in nci_hci_get_param()
624 conn_info = ndev->hci_dev->conn_info; in nci_hci_get_param()
635 r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, in nci_hci_get_param()
652 int nci_hci_connect_gate(struct nci_dev *ndev, in nci_hci_connect_gate() argument
661 if (ndev->hci_dev->gate2pipe[dest_gate] != NCI_HCI_INVALID_PIPE) in nci_hci_connect_gate()
675 pipe = nci_hci_create_pipe(ndev, dest_host, dest_gate, &r); in nci_hci_connect_gate()
683 r = nci_hci_open_pipe(ndev, pipe); in nci_hci_connect_gate()
686 if (nci_hci_delete_pipe(ndev, pipe) < 0) { in nci_hci_connect_gate()
695 ndev->hci_dev->pipes[pipe].gate = dest_gate; in nci_hci_connect_gate()
696 ndev->hci_dev->pipes[pipe].host = dest_host; in nci_hci_connect_gate()
697 ndev->hci_dev->gate2pipe[dest_gate] = pipe; in nci_hci_connect_gate()
703 static int nci_hci_dev_connect_gates(struct nci_dev *ndev, in nci_hci_dev_connect_gates() argument
710 r = nci_hci_connect_gate(ndev, gates->dest_host, in nci_hci_dev_connect_gates()
720 int nci_hci_dev_session_init(struct nci_dev *ndev) in nci_hci_dev_session_init() argument
726 ndev->hci_dev->count_pipes = 0; in nci_hci_dev_session_init()
727 ndev->hci_dev->expected_pipes = 0; in nci_hci_dev_session_init()
729 conn_info = ndev->hci_dev->conn_info; in nci_hci_dev_session_init()
734 conn_info->data_exchange_cb_context = ndev; in nci_hci_dev_session_init()
736 nci_hci_reset_pipes(ndev->hci_dev); in nci_hci_dev_session_init()
738 if (ndev->hci_dev->init_data.gates[0].gate != NCI_HCI_ADMIN_GATE) in nci_hci_dev_session_init()
741 r = nci_hci_connect_gate(ndev, in nci_hci_dev_session_init()
742 ndev->hci_dev->init_data.gates[0].dest_host, in nci_hci_dev_session_init()
743 ndev->hci_dev->init_data.gates[0].gate, in nci_hci_dev_session_init()
744 ndev->hci_dev->init_data.gates[0].pipe); in nci_hci_dev_session_init()
748 r = nci_hci_get_param(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_dev_session_init()
754 skb->len == strlen(ndev->hci_dev->init_data.session_id) && in nci_hci_dev_session_init()
755 !memcmp(ndev->hci_dev->init_data.session_id, skb->data, skb->len) && in nci_hci_dev_session_init()
756 ndev->ops->hci_load_session) { in nci_hci_dev_session_init()
758 r = ndev->ops->hci_load_session(ndev); in nci_hci_dev_session_init()
760 r = nci_hci_clear_all_pipes(ndev); in nci_hci_dev_session_init()
764 r = nci_hci_dev_connect_gates(ndev, in nci_hci_dev_session_init()
765 ndev->hci_dev->init_data.gate_count, in nci_hci_dev_session_init()
766 ndev->hci_dev->init_data.gates); in nci_hci_dev_session_init()
770 r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, in nci_hci_dev_session_init()
772 ndev->hci_dev->init_data.session_id, in nci_hci_dev_session_init()
773 strlen(ndev->hci_dev->init_data.session_id)); in nci_hci_dev_session_init()
783 struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev) in nci_hci_allocate() argument
794 hdev->ndev = ndev; in nci_hci_allocate()