Lines Matching full:conn
56 static void cc_ntf_established(struct ll_conn *conn, struct proc_ctx *ctx) in cc_ntf_established() argument
70 ntf->hdr.handle = conn->lll.handle; in cc_ntf_established()
129 static void rp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
136 static void llcp_rp_cc_tx_rsp(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_tx_rsp() argument
144 tx = llcp_tx_alloc(conn, ctx); in llcp_rp_cc_tx_rsp()
156 ull_conn_event_counter(conn) + 2U); in llcp_rp_cc_tx_rsp()
172 uint32_t conn_interval_us = conn->lll.interval * CONN_INT_UNIT_US; in llcp_rp_cc_tx_rsp()
190 llcp_tx_enqueue(conn, tx); in llcp_rp_cc_tx_rsp()
193 static void llcp_rp_cc_tx_reject(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in llcp_rp_cc_tx_reject() argument
210 llcp_tx_enqueue(conn, tx); in llcp_rp_cc_tx_reject()
213 static void rp_cc_ntf_create(struct ll_conn *conn, struct proc_ctx *ctx) in rp_cc_ntf_create() argument
223 ntf->hdr.handle = conn->lll.handle; in rp_cc_ntf_create()
233 static void rp_cc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_cc_complete() argument
235 cc_ntf_established(conn, ctx); in rp_cc_complete()
236 llcp_rr_complete(conn); in rp_cc_complete()
240 static void rp_cc_send_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_send_cis_rsp() argument
243 if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in rp_cc_send_cis_rsp()
246 llcp_rp_cc_tx_rsp(conn, ctx); in rp_cc_send_cis_rsp()
254 static void rp_cc_send_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_send_reject_ind() argument
257 if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in rp_cc_send_reject_ind()
261 ctx->node_ref.tx = llcp_tx_alloc(conn, ctx); in rp_cc_send_reject_ind()
276 llcp_rp_cc_tx_reject(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in rp_cc_send_reject_ind()
280 rp_cc_complete(conn, ctx, evt, param); in rp_cc_send_reject_ind()
283 llcp_rr_complete(conn); in rp_cc_send_reject_ind()
289 static void rp_cc_state_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_idle() argument
302 static uint8_t rp_cc_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, in rp_cc_check_phy() argument
314 if (((phys & PHY_2M) && !feature_phy_2m(conn)) || in rp_cc_check_phy()
315 ((phys & PHY_CODED) && !feature_phy_coded(conn))) { in rp_cc_check_phy()
324 static void rp_cc_state_wait_rx_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_rx_cis_req() argument
335 ctx->data.cis_create.error = rp_cc_check_phy(conn, ctx, pdu); in rp_cc_state_wait_rx_cis_req()
339 ull_peripheral_iso_acquire(conn, &pdu->llctrl.cis_req, in rp_cc_state_wait_rx_cis_req()
345 rp_cc_ntf_create(conn, ctx); in rp_cc_state_wait_rx_cis_req()
349 rp_cc_send_reject_ind(conn, ctx, evt, param); in rp_cc_state_wait_rx_cis_req()
358 static void rp_cc_state_wait_tx_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_tx_cis_rsp() argument
363 rp_cc_send_cis_rsp(conn, ctx, evt, param); in rp_cc_state_wait_tx_cis_rsp()
371 static void rp_cc_state_wait_tx_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_tx_reject_ind() argument
376 rp_cc_send_reject_ind(conn, ctx, evt, param); in rp_cc_state_wait_tx_reject_ind()
384 static void rp_cc_state_wait_rx_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_rx_cis_ind() argument
403 rp_cc_check_instant(conn, ctx, evt, param); in rp_cc_state_wait_rx_cis_ind()
419 static void rp_cc_state_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_ntf_avail() argument
430 llcp_rp_cc_tx_reject(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in rp_cc_state_wait_ntf_avail()
431 rp_cc_complete(conn, ctx, evt, param); in rp_cc_state_wait_ntf_avail()
441 static void rp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_check_instant() argument
447 event_counter = ull_conn_event_counter(conn); in rp_cc_check_instant()
454 ull_conn_iso_start(conn, ctx->data.cis_create.cis_handle, in rp_cc_check_instant()
455 conn->llcp.prep.ticks_at_expire, in rp_cc_check_instant()
456 conn->llcp.prep.remainder, in rp_cc_check_instant()
464 static void rp_cc_state_wait_reply(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_reply() argument
475 ctx->data.cis_create.host_request_to += (conn->lll.interval * CONN_INT_UNIT_US); in rp_cc_state_wait_reply()
476 if (ctx->data.cis_create.host_request_to < conn->connect_accept_to) { in rp_cc_state_wait_reply()
495 static void rp_cc_state_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_instant() argument
500 rp_cc_check_instant(conn, ctx, evt, param); in rp_cc_state_wait_instant()
509 static void rp_cc_state_wait_cis_established(struct ll_conn *conn, struct proc_ctx *ctx, in rp_cc_state_wait_cis_established() argument
514 rp_cc_complete(conn, ctx, evt, param); in rp_cc_state_wait_cis_established()
523 static void rp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_cc_execute_fsm() argument
528 rp_cc_state_idle(conn, ctx, evt, param); in rp_cc_execute_fsm()
531 rp_cc_state_wait_rx_cis_req(conn, ctx, evt, param); in rp_cc_execute_fsm()
534 rp_cc_state_wait_tx_reject_ind(conn, ctx, evt, param); in rp_cc_execute_fsm()
537 rp_cc_state_wait_tx_cis_rsp(conn, ctx, evt, param); in rp_cc_execute_fsm()
540 rp_cc_state_wait_reply(conn, ctx, evt, param); in rp_cc_execute_fsm()
543 rp_cc_state_wait_rx_cis_ind(conn, ctx, evt, param); in rp_cc_execute_fsm()
546 rp_cc_state_wait_instant(conn, ctx, evt, param); in rp_cc_execute_fsm()
549 rp_cc_state_wait_cis_established(conn, ctx, evt, param); in rp_cc_execute_fsm()
552 rp_cc_state_wait_ntf_avail(conn, ctx, evt, param); in rp_cc_execute_fsm()
560 void llcp_rp_cc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_rp_cc_rx() argument
566 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ, pdu); in llcp_rp_cc_rx()
569 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_IND, pdu); in llcp_rp_cc_rx()
573 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_REJECT, pdu); in llcp_rp_cc_rx()
578 conn->llcp_terminate.reason_final = BT_HCI_ERR_LMP_PDU_NOT_ALLOWED; in llcp_rp_cc_rx()
579 llcp_rr_complete(conn); in llcp_rp_cc_rx()
595 void llcp_rp_cc_accept(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_accept() argument
597 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ_ACCEPT, NULL); in llcp_rp_cc_accept()
600 void llcp_rp_cc_reject(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_reject() argument
602 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ_REJECT, NULL); in llcp_rp_cc_reject()
605 void llcp_rp_cc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_rp_cc_run() argument
607 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_RUN, param); in llcp_rp_cc_run()
615 void llcp_rp_cc_established(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_established() argument
617 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_ESTABLISHED, NULL); in llcp_rp_cc_established()
622 static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param);
660 static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in lp_cc_tx() argument
666 tx = llcp_tx_alloc(conn, ctx); in lp_cc_tx()
688 llcp_tx_enqueue(conn, tx); in lp_cc_tx()
691 void llcp_lp_cc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_lp_cc_rx() argument
697 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_CIS_RSP, pdu); in llcp_lp_cc_rx()
701 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_REJECT, pdu); in llcp_lp_cc_rx()
706 conn->llcp_terminate.reason_final = BT_HCI_ERR_LMP_PDU_NOT_ALLOWED; in llcp_lp_cc_rx()
707 llcp_lr_complete(conn); in llcp_lp_cc_rx()
713 void llcp_lp_cc_offset_calc_reply(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_offset_calc_reply() argument
715 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_OFFSET_CALC_REPLY, NULL); in llcp_lp_cc_offset_calc_reply()
718 static void lp_cc_offset_calc_req(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_offset_calc_req() argument
721 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_offset_calc_req()
737 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in lp_cc_offset_calc_req()
744 static void lp_cc_st_wait_offset_calc_tx_req(struct ll_conn *conn, in lp_cc_st_wait_offset_calc_tx_req() argument
750 lp_cc_offset_calc_req(conn, ctx, evt, param); in lp_cc_st_wait_offset_calc_tx_req()
758 static void lp_cc_st_wait_offset_calc(struct ll_conn *conn, in lp_cc_st_wait_offset_calc() argument
777 static void lp_cc_send_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_send_cis_req() argument
780 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_send_cis_req()
783 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in lp_cc_send_cis_req()
790 static void lp_cc_st_wait_tx_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_st_wait_tx_cis_req() argument
795 lp_cc_send_cis_req(conn, ctx, evt, param); in lp_cc_st_wait_tx_cis_req()
803 static void lp_cc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_complete() argument
805 cc_ntf_established(conn, ctx); in lp_cc_complete()
806 llcp_lr_complete(conn); in lp_cc_complete()
810 static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_st_idle() argument
819 if (feature_peer_iso_peripheral(conn)) { in lp_cc_st_idle()
820 lp_cc_offset_calc_req(conn, ctx, evt, param); in lp_cc_st_idle()
839 static void lp_cc_state_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_state_wait_ntf_avail() argument
850 lp_cc_complete(conn, ctx, evt, param); in lp_cc_state_wait_ntf_avail()
859 static void cc_prepare_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx) in cc_prepare_cis_ind() argument
877 static void lp_cc_send_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_send_cis_ind() argument
880 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_send_cis_ind()
883 cc_prepare_cis_ind(conn, ctx); in lp_cc_send_cis_ind()
884 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_IND); in lp_cc_send_cis_ind()
888 static void lp_cc_st_wait_rx_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_rx_cis_rsp() argument
901 lp_cc_send_cis_ind(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
905 feature_unmask_peer_features(conn, LL_FEAT_BIT_CIS_PERIPHERAL); in lp_cc_st_wait_rx_cis_rsp()
907 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
912 feature_unmask_peer_features(conn, LL_FEAT_BIT_CIS_PERIPHERAL); in lp_cc_st_wait_rx_cis_rsp()
915 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
923 static void lp_cc_st_wait_notify_cancel(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_notify_cancel() argument
935 llcp_lp_cc_established(conn, ctx); in lp_cc_st_wait_notify_cancel()
944 static void lp_cc_st_wait_rx_cis_rsp_cancel(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_rx_cis_rsp_cancel() argument
953 tx = llcp_tx_alloc(conn, ctx); in lp_cc_st_wait_rx_cis_rsp_cancel()
963 llcp_tx_enqueue(conn, tx); in lp_cc_st_wait_rx_cis_rsp_cancel()
964 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp_cancel()
968 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp_cancel()
976 static void lp_cc_st_wait_tx_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_st_wait_tx_cis_ind() argument
981 lp_cc_send_cis_ind(conn, ctx, evt, param); in lp_cc_st_wait_tx_cis_ind()
989 static void lp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_check_instant() argument
996 event_counter = ull_conn_event_counter(conn); in lp_cc_check_instant()
1002 ull_conn_iso_start(conn, ctx->data.cis_create.cis_handle, in lp_cc_check_instant()
1003 conn->llcp.prep.ticks_at_expire, in lp_cc_check_instant()
1004 conn->llcp.prep.remainder, in lp_cc_check_instant()
1012 static void lp_cc_st_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_instant() argument
1017 lp_cc_check_instant(conn, ctx, evt, param); in lp_cc_st_wait_instant()
1025 static void lp_cc_st_wait_established(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_established() argument
1031 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_established()
1039 static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_execute_fsm() argument
1043 lp_cc_st_idle(conn, ctx, evt, param); in lp_cc_execute_fsm()
1046 lp_cc_state_wait_ntf_avail(conn, ctx, evt, param); in lp_cc_execute_fsm()
1049 lp_cc_st_wait_offset_calc_tx_req(conn, ctx, evt, param); in lp_cc_execute_fsm()
1052 lp_cc_st_wait_offset_calc(conn, ctx, evt, param); in lp_cc_execute_fsm()
1055 lp_cc_st_wait_tx_cis_req(conn, ctx, evt, param); in lp_cc_execute_fsm()
1058 lp_cc_st_wait_rx_cis_rsp(conn, ctx, evt, param); in lp_cc_execute_fsm()
1061 lp_cc_st_wait_notify_cancel(conn, ctx, evt, param); in lp_cc_execute_fsm()
1064 lp_cc_st_wait_rx_cis_rsp_cancel(conn, ctx, evt, param); in lp_cc_execute_fsm()
1067 lp_cc_st_wait_tx_cis_ind(conn, ctx, evt, param); in lp_cc_execute_fsm()
1070 lp_cc_st_wait_instant(conn, ctx, evt, param); in lp_cc_execute_fsm()
1073 lp_cc_st_wait_established(conn, ctx, evt, param); in lp_cc_execute_fsm()
1082 void llcp_lp_cc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_lp_cc_run() argument
1084 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_RUN, param); in llcp_lp_cc_run()
1097 void llcp_lp_cc_established(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_established() argument
1099 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_ESTABLISHED, NULL); in llcp_lp_cc_established()
1102 bool llcp_lp_cc_cancel(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_cancel() argument