Lines Matching full:ctx

97 	struct proc_ctx *ctx;  in proc_ctx_acquire()  local
99 ctx = (struct proc_ctx *)mem_acquire(&owner->free); in proc_ctx_acquire()
101 if (ctx) { in proc_ctx_acquire()
103 ctx->owner = owner; in proc_ctx_acquire()
106 return ctx; in proc_ctx_acquire()
109 void llcp_proc_ctx_release(struct proc_ctx *ctx) in llcp_proc_ctx_release() argument
112 LL_ASSERT(ctx->owner); in llcp_proc_ctx_release()
115 mem_release(ctx, &ctx->owner->free); in llcp_proc_ctx_release()
135 static inline bool static_tx_buffer_available(struct ll_conn *conn, struct proc_ctx *ctx) in static_tx_buffer_available() argument
153 bool llcp_tx_alloc_peek(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_tx_alloc_peek() argument
155 if (!static_tx_buffer_available(conn, ctx)) { in llcp_tx_alloc_peek()
159 if (ctx->wait_reason == WAITING_FOR_NOTHING) { in llcp_tx_alloc_peek()
163 sys_slist_append(&tx_buffer_wait_list, &ctx->wait_node); in llcp_tx_alloc_peek()
164 ctx->wait_reason = WAITING_FOR_TX_BUFFER; in llcp_tx_alloc_peek()
168 if (ctx->wait_reason == WAITING_FOR_TX_BUFFER && in llcp_tx_alloc_peek()
169 sys_slist_peek_head(&tx_buffer_wait_list) == &ctx->wait_node) { in llcp_tx_alloc_peek()
183 void llcp_tx_alloc_unpeek(struct proc_ctx *ctx) in llcp_tx_alloc_unpeek() argument
185 sys_slist_find_and_remove(&tx_buffer_wait_list, &ctx->wait_node); in llcp_tx_alloc_unpeek()
186 ctx->wait_reason = WAITING_FOR_NOTHING; in llcp_tx_alloc_unpeek()
196 struct node_tx *llcp_tx_alloc(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_tx_alloc() argument
206 if (ctx->wait_reason == WAITING_FOR_TX_BUFFER) { in llcp_tx_alloc()
207 sys_slist_find_and_remove(&tx_buffer_wait_list, &ctx->wait_node); in llcp_tx_alloc()
215 ctx->wait_reason = WAITING_FOR_NOTHING; in llcp_tx_alloc()
220 bool llcp_tx_alloc_peek(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_tx_alloc_peek() argument
226 void llcp_tx_alloc_unpeek(struct proc_ctx *ctx) in llcp_tx_alloc_unpeek() argument
229 ARG_UNUSED(ctx); in llcp_tx_alloc_unpeek()
232 struct node_tx *llcp_tx_alloc(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_tx_alloc() argument
298 void llcp_rx_node_retain(struct proc_ctx *ctx) in llcp_rx_node_retain() argument
300 LL_ASSERT(ctx->node_ref.rx); in llcp_rx_node_retain()
303 if (ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN) { in llcp_rx_node_retain()
305 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN; in llcp_rx_node_retain()
308 ctx->node_ref.rx->hdr.link = ctx->node_ref.link; in llcp_rx_node_retain()
312 void llcp_rx_node_release(struct proc_ctx *ctx) in llcp_rx_node_release() argument
314 LL_ASSERT(ctx->node_ref.rx); in llcp_rx_node_release()
317 if (ctx->node_ref.rx->hdr.type == NODE_RX_TYPE_RETAIN) { in llcp_rx_node_release()
319 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RELEASE; in llcp_rx_node_release()
320 ll_rx_put_sched(ctx->node_ref.rx->hdr.link, ctx->node_ref.rx); in llcp_rx_node_release()
324 void llcp_nodes_release(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_nodes_release() argument
326 if (ctx->node_ref.rx && ctx->node_ref.rx->hdr.type == NODE_RX_TYPE_RETAIN) { in llcp_nodes_release()
328 ctx->node_ref.rx->hdr.link->mem = conn->llcp.rx_node_release; in llcp_nodes_release()
329 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RELEASE; in llcp_nodes_release()
330 conn->llcp.rx_node_release = ctx->node_ref.rx; in llcp_nodes_release()
333 if (ctx->proc == PROC_PHY_UPDATE && ctx->data.pu.ntf_dle_node) { in llcp_nodes_release()
335 ctx->data.pu.ntf_dle_node->hdr.link->mem = conn->llcp.rx_node_release; in llcp_nodes_release()
336 ctx->data.pu.ntf_dle_node->hdr.type = NODE_RX_TYPE_RELEASE; in llcp_nodes_release()
337 conn->llcp.rx_node_release = ctx->data.pu.ntf_dle_node; in llcp_nodes_release()
341 if (ctx->node_ref.tx) { in llcp_nodes_release()
342 ctx->node_ref.tx->next = conn->llcp.tx_node_release; in llcp_nodes_release()
343 conn->llcp.tx_node_release = ctx->node_ref.tx; in llcp_nodes_release()
353 struct proc_ctx *ctx; in create_procedure() local
355 ctx = proc_ctx_acquire(ctx_pool); in create_procedure()
356 if (!ctx) { in create_procedure()
360 ctx->proc = proc; in create_procedure()
361 ctx->done = 0U; in create_procedure()
362 ctx->rx_greedy = 0U; in create_procedure()
363 ctx->node_ref.rx = NULL; in create_procedure()
364 ctx->node_ref.tx_ack = NULL; in create_procedure()
365 ctx->state = LLCP_STATE_IDLE; in create_procedure()
368 memset((void *)&ctx->data, 0, sizeof(ctx->data)); in create_procedure()
371 ctx->rx_opcode = ULL_LLCP_INVALID_OPCODE; in create_procedure()
372 ctx->tx_opcode = ULL_LLCP_INVALID_OPCODE; in create_procedure()
373 ctx->response_opcode = ULL_LLCP_INVALID_OPCODE; in create_procedure()
375 return ctx; in create_procedure()
511 struct proc_ctx *ctx; in ull_cp_prt_elapse() local
513 ctx = llcp_lr_peek(conn); in ull_cp_prt_elapse()
514 LL_ASSERT(ctx); in ull_cp_prt_elapse()
516 if (ctx->proc == PROC_TERMINATE) { in ull_cp_prt_elapse()
518 *error_code = ctx->data.term.error_code; in ull_cp_prt_elapse()
602 struct proc_ctx *ctx; in ull_cp_min_used_chans() local
608 ctx = llcp_create_local_procedure(PROC_MIN_USED_CHANS); in ull_cp_min_used_chans()
609 if (!ctx) { in ull_cp_min_used_chans()
613 ctx->data.muc.phys = phys; in ull_cp_min_used_chans()
614 ctx->data.muc.min_used_chans = min_used_chans; in ull_cp_min_used_chans()
616 llcp_lr_enqueue(conn, ctx); in ull_cp_min_used_chans()
625 struct proc_ctx *ctx; in ull_cp_le_ping() local
627 ctx = llcp_create_local_procedure(PROC_LE_PING); in ull_cp_le_ping()
628 if (!ctx) { in ull_cp_le_ping()
632 llcp_lr_enqueue(conn, ctx); in ull_cp_le_ping()
641 struct proc_ctx *ctx; in ull_cp_feature_exchange() local
643 ctx = llcp_create_local_procedure(PROC_FEATURE_EXCHANGE); in ull_cp_feature_exchange()
644 if (!ctx) { in ull_cp_feature_exchange()
648 ctx->data.fex.host_initiated = host_initiated; in ull_cp_feature_exchange()
650 llcp_lr_enqueue(conn, ctx); in ull_cp_feature_exchange()
658 struct proc_ctx *ctx; in ull_cp_version_exchange() local
660 ctx = llcp_create_local_procedure(PROC_VERSION_EXCHANGE); in ull_cp_version_exchange()
661 if (!ctx) { in ull_cp_version_exchange()
665 llcp_lr_enqueue(conn, ctx); in ull_cp_version_exchange()
675 struct proc_ctx *ctx; in ull_cp_encryption_start() local
681 ctx = llcp_create_local_procedure(PROC_ENCRYPTION_START); in ull_cp_encryption_start()
682 if (!ctx) { in ull_cp_encryption_start()
687 memcpy(ctx->data.enc.rand, rand, sizeof(ctx->data.enc.rand)); in ull_cp_encryption_start()
688 ctx->data.enc.ediv[0] = ediv[0]; in ull_cp_encryption_start()
689 ctx->data.enc.ediv[1] = ediv[1]; in ull_cp_encryption_start()
690 memcpy(ctx->data.enc.ltk, ltk, sizeof(ctx->data.enc.ltk)); in ull_cp_encryption_start()
693 llcp_lr_enqueue(conn, ctx); in ull_cp_encryption_start()
701 struct proc_ctx *ctx; in ull_cp_encryption_pause() local
707 ctx = llcp_create_local_procedure(PROC_ENCRYPTION_PAUSE); in ull_cp_encryption_pause()
708 if (!ctx) { in ull_cp_encryption_pause()
713 memcpy(ctx->data.enc.rand, rand, sizeof(ctx->data.enc.rand)); in ull_cp_encryption_pause()
714 ctx->data.enc.ediv[0] = ediv[0]; in ull_cp_encryption_pause()
715 ctx->data.enc.ediv[1] = ediv[1]; in ull_cp_encryption_pause()
716 memcpy(ctx->data.enc.ltk, ltk, sizeof(ctx->data.enc.ltk)); in ull_cp_encryption_pause()
719 llcp_lr_enqueue(conn, ctx); in ull_cp_encryption_pause()
727 struct proc_ctx *ctx; in ull_cp_encryption_paused() local
729 ctx = llcp_rr_peek(conn); in ull_cp_encryption_paused()
730 if (ctx && ctx->proc == PROC_ENCRYPTION_PAUSE) { in ull_cp_encryption_paused()
734 ctx = llcp_lr_peek(conn); in ull_cp_encryption_paused()
735 if (ctx && ctx->proc == PROC_ENCRYPTION_PAUSE) { in ull_cp_encryption_paused()
747 struct proc_ctx *ctx; in ull_cp_phy_update() local
749 ctx = llcp_create_local_procedure(PROC_PHY_UPDATE); in ull_cp_phy_update()
750 if (!ctx) { in ull_cp_phy_update()
754 ctx->data.pu.tx = tx; in ull_cp_phy_update()
755 ctx->data.pu.flags = flags; in ull_cp_phy_update()
756 ctx->data.pu.rx = rx; in ull_cp_phy_update()
757 ctx->data.pu.host_initiated = host_initiated; in ull_cp_phy_update()
759 llcp_lr_enqueue(conn, ctx); in ull_cp_phy_update()
767 struct proc_ctx *ctx; in ull_cp_terminate() local
772 ctx = llcp_create_local_procedure(PROC_TERMINATE); in ull_cp_terminate()
773 if (!ctx) { in ull_cp_terminate()
777 ctx->data.term.error_code = error_code; in ull_cp_terminate()
779 llcp_lr_enqueue(conn, ctx); in ull_cp_terminate()
788 struct proc_ctx *ctx; in ull_cp_cis_terminate() local
794 ctx = llcp_create_local_procedure(PROC_CIS_TERMINATE); in ull_cp_cis_terminate()
795 if (!ctx) { in ull_cp_cis_terminate()
799 ctx->data.cis_term.cig_id = cis->group->cig_id; in ull_cp_cis_terminate()
800 ctx->data.cis_term.cis_id = cis->cis_id; in ull_cp_cis_terminate()
801 ctx->data.cis_term.error_code = error_code; in ull_cp_cis_terminate()
803 llcp_lr_enqueue(conn, ctx); in ull_cp_cis_terminate()
813 struct proc_ctx *ctx; in ull_cp_cis_create() local
822 ctx = llcp_create_local_procedure(PROC_CIS_CREATE); in ull_cp_cis_create()
823 if (!ctx) { in ull_cp_cis_create()
828 ctx->data.cis_create.cis_handle = cis->lll.handle; in ull_cp_cis_create()
830 ctx->data.cis_create.cig_id = cis->group->cig_id; in ull_cp_cis_create()
831 ctx->data.cis_create.cis_id = cis->cis_id; in ull_cp_cis_create()
832 ctx->data.cis_create.c_phy = cis->lll.tx.phy; in ull_cp_cis_create()
833 ctx->data.cis_create.p_phy = cis->lll.rx.phy; in ull_cp_cis_create()
834 ctx->data.cis_create.c_sdu_interval = cig->c_sdu_interval; in ull_cp_cis_create()
835 ctx->data.cis_create.p_sdu_interval = cig->p_sdu_interval; in ull_cp_cis_create()
836 ctx->data.cis_create.c_max_pdu = cis->lll.tx.max_pdu; in ull_cp_cis_create()
837 ctx->data.cis_create.p_max_pdu = cis->lll.rx.max_pdu; in ull_cp_cis_create()
838 ctx->data.cis_create.c_max_sdu = cis->c_max_sdu; in ull_cp_cis_create()
839 ctx->data.cis_create.p_max_sdu = cis->p_max_sdu; in ull_cp_cis_create()
840 ctx->data.cis_create.iso_interval = cig->iso_interval; in ull_cp_cis_create()
841 ctx->data.cis_create.framed = cis->framed; in ull_cp_cis_create()
842 ctx->data.cis_create.nse = cis->lll.nse; in ull_cp_cis_create()
843 ctx->data.cis_create.sub_interval = cis->lll.sub_interval; in ull_cp_cis_create()
844 ctx->data.cis_create.c_bn = cis->lll.tx.bn; in ull_cp_cis_create()
845 ctx->data.cis_create.p_bn = cis->lll.rx.bn; in ull_cp_cis_create()
846 ctx->data.cis_create.c_ft = cis->lll.tx.ft; in ull_cp_cis_create()
847 ctx->data.cis_create.p_ft = cis->lll.rx.ft; in ull_cp_cis_create()
849 /* ctx->data.cis_create.conn_event_count will be filled when Tx PDU is in ull_cp_cis_create()
853 llcp_lr_enqueue(conn, ctx); in ull_cp_cis_create()
862 struct proc_ctx *ctx; in ull_cp_chan_map_update() local
868 ctx = llcp_create_local_procedure(PROC_CHAN_MAP_UPDATE); in ull_cp_chan_map_update()
869 if (!ctx) { in ull_cp_chan_map_update()
873 memcpy(ctx->data.chmu.chm, chm, sizeof(ctx->data.chmu.chm)); in ull_cp_chan_map_update()
875 llcp_lr_enqueue(conn, ctx); in ull_cp_chan_map_update()
883 struct proc_ctx *ctx; in ull_cp_chan_map_update_pending() local
886 ctx = llcp_lr_peek(conn); in ull_cp_chan_map_update_pending()
888 ctx = llcp_rr_peek(conn); in ull_cp_chan_map_update_pending()
891 if (ctx && ctx->proc == PROC_CHAN_MAP_UPDATE) { in ull_cp_chan_map_update_pending()
892 return ctx->data.chmu.chm; in ull_cp_chan_map_update_pending()
902 struct proc_ctx *ctx; in ull_cp_data_length_update() local
914 ctx = llcp_create_local_procedure(PROC_DATA_LENGTH_UPDATE); in ull_cp_data_length_update()
916 if (!ctx) { in ull_cp_data_length_update()
923 llcp_lr_enqueue(conn, ctx); in ull_cp_data_length_update()
932 struct proc_ctx *ctx; in ull_cp_req_peer_sca() local
938 ctx = llcp_create_local_procedure(PROC_SCA_UPDATE); in ull_cp_req_peer_sca()
940 if (!ctx) { in ull_cp_req_peer_sca()
944 llcp_lr_enqueue(conn, ctx); in ull_cp_req_peer_sca()
953 struct proc_ctx *ctx; in ull_cp_ltk_req_reply() local
955 ctx = llcp_rr_peek(conn); in ull_cp_ltk_req_reply()
956 if (ctx && (ctx->proc == PROC_ENCRYPTION_START || ctx->proc == PROC_ENCRYPTION_PAUSE) && in ull_cp_ltk_req_reply()
957 llcp_rp_enc_ltk_req_reply_allowed(conn, ctx)) { in ull_cp_ltk_req_reply()
958 memcpy(ctx->data.enc.ltk, ltk, sizeof(ctx->data.enc.ltk)); in ull_cp_ltk_req_reply()
959 llcp_rp_enc_ltk_req_reply(conn, ctx); in ull_cp_ltk_req_reply()
967 struct proc_ctx *ctx; in ull_cp_ltk_req_neq_reply() local
969 ctx = llcp_rr_peek(conn); in ull_cp_ltk_req_neq_reply()
970 if (ctx && (ctx->proc == PROC_ENCRYPTION_START || ctx->proc == PROC_ENCRYPTION_PAUSE) && in ull_cp_ltk_req_neq_reply()
971 llcp_rp_enc_ltk_req_reply_allowed(conn, ctx)) { in ull_cp_ltk_req_neq_reply()
972 llcp_rp_enc_ltk_req_neg_reply(conn, ctx); in ull_cp_ltk_req_neq_reply()
982 struct proc_ctx *ctx; in ull_cp_conn_update() local
986 ctx = llcp_create_local_procedure(PROC_CONN_PARAM_REQ); in ull_cp_conn_update()
988 ctx = llcp_create_local_procedure(PROC_CONN_UPDATE); in ull_cp_conn_update()
996 ctx = llcp_create_local_procedure(PROC_CONN_UPDATE); in ull_cp_conn_update()
999 if (!ctx) { in ull_cp_conn_update()
1004 if (ctx->proc == PROC_CONN_UPDATE) { in ull_cp_conn_update()
1005 ctx->data.cu.interval_max = interval_max; in ull_cp_conn_update()
1006 ctx->data.cu.latency = latency; in ull_cp_conn_update()
1007 ctx->data.cu.timeout = timeout; in ull_cp_conn_update()
1009 } else if (ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_conn_update()
1010 ctx->data.cu.interval_min = interval_min; in ull_cp_conn_update()
1011 ctx->data.cu.interval_max = interval_max; in ull_cp_conn_update()
1012 ctx->data.cu.latency = latency; in ull_cp_conn_update()
1013 ctx->data.cu.timeout = timeout; in ull_cp_conn_update()
1014 ctx->data.cu.offsets[0] = offsets ? offsets[0] : 0x0000; in ull_cp_conn_update()
1015 ctx->data.cu.offsets[1] = offsets ? offsets[1] : 0xffff; in ull_cp_conn_update()
1016 ctx->data.cu.offsets[2] = offsets ? offsets[2] : 0xffff; in ull_cp_conn_update()
1017 ctx->data.cu.offsets[3] = offsets ? offsets[3] : 0xffff; in ull_cp_conn_update()
1018 ctx->data.cu.offsets[4] = offsets ? offsets[4] : 0xffff; in ull_cp_conn_update()
1019 ctx->data.cu.offsets[5] = offsets ? offsets[5] : 0xffff; in ull_cp_conn_update()
1032 llcp_lr_enqueue(conn, ctx); in ull_cp_conn_update()
1042 struct proc_ctx *ctx; in ull_cp_periodic_sync() local
1060 ctx = llcp_create_local_procedure(PROC_PERIODIC_SYNC); in ull_cp_periodic_sync()
1061 if (!ctx) { in ull_cp_periodic_sync()
1115 ctx->data.periodic_sync.sync_handle = sync ? ull_sync_handle_get(sync) : in ull_cp_periodic_sync()
1117 ctx->data.periodic_sync.adv_handle = adv_sync ? ull_adv_sync_handle_get(adv_sync) : in ull_cp_periodic_sync()
1119 ctx->data.periodic_sync.id = service_data; in ull_cp_periodic_sync()
1120 ctx->data.periodic_sync.sca = lll_clock_sca_local_get(); in ull_cp_periodic_sync()
1122 si = &ctx->data.periodic_sync.sync_info; in ull_cp_periodic_sync()
1124 (void)memcpy(si->sca_chm, chan_map, sizeof(ctx->data.periodic_sync.sync_info.sca_chm)); in ull_cp_periodic_sync()
1132 ctx->data.periodic_sync.addr_type = addr_type; in ull_cp_periodic_sync()
1133 (void)memcpy(ctx->data.periodic_sync.adv_addr, adva, BDADDR_SIZE); in ull_cp_periodic_sync()
1134 ctx->data.periodic_sync.sid = sid; in ull_cp_periodic_sync()
1135 ctx->data.periodic_sync.phy = phy; in ull_cp_periodic_sync()
1139 llcp_lr_enqueue(conn, ctx); in ull_cp_periodic_sync()
1148 struct proc_ctx *ctx; in ull_cp_remote_dle_pending() local
1150 ctx = llcp_rr_peek(conn); in ull_cp_remote_dle_pending()
1152 return (ctx && ctx->proc == PROC_DATA_LENGTH_UPDATE); in ull_cp_remote_dle_pending()
1159 struct proc_ctx *ctx; in ull_cp_conn_param_req_reply() local
1161 ctx = llcp_rr_peek(conn); in ull_cp_conn_param_req_reply()
1162 if (ctx && ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_conn_param_req_reply()
1163 llcp_rp_conn_param_req_reply(conn, ctx); in ull_cp_conn_param_req_reply()
1169 struct proc_ctx *ctx; in ull_cp_conn_param_req_neg_reply() local
1171 ctx = llcp_rr_peek(conn); in ull_cp_conn_param_req_neg_reply()
1172 if (ctx && ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_conn_param_req_neg_reply()
1173 ctx->data.cu.error = error_code; in ull_cp_conn_param_req_neg_reply()
1174 llcp_rp_conn_param_req_neg_reply(conn, ctx); in ull_cp_conn_param_req_neg_reply()
1180 struct proc_ctx *ctx; in ull_cp_remote_cpr_pending() local
1182 ctx = llcp_rr_peek(conn); in ull_cp_remote_cpr_pending()
1184 return (ctx && ctx->proc == PROC_CONN_PARAM_REQ); in ull_cp_remote_cpr_pending()
1190 struct proc_ctx *ctx; in ull_cp_remote_cpr_apm_awaiting_reply() local
1192 ctx = llcp_rr_peek(conn); in ull_cp_remote_cpr_apm_awaiting_reply()
1194 if (ctx && ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_remote_cpr_apm_awaiting_reply()
1195 return llcp_rp_conn_param_req_apm_awaiting_reply(ctx); in ull_cp_remote_cpr_apm_awaiting_reply()
1203 struct proc_ctx *ctx; in ull_cp_remote_cpr_apm_reply() local
1205 ctx = llcp_rr_peek(conn); in ull_cp_remote_cpr_apm_reply()
1207 if (ctx && ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_remote_cpr_apm_reply()
1208 ctx->data.cu.offsets[0] = offsets[0]; in ull_cp_remote_cpr_apm_reply()
1209 ctx->data.cu.offsets[1] = offsets[1]; in ull_cp_remote_cpr_apm_reply()
1210 ctx->data.cu.offsets[2] = offsets[2]; in ull_cp_remote_cpr_apm_reply()
1211 ctx->data.cu.offsets[3] = offsets[3]; in ull_cp_remote_cpr_apm_reply()
1212 ctx->data.cu.offsets[4] = offsets[4]; in ull_cp_remote_cpr_apm_reply()
1213 ctx->data.cu.offsets[5] = offsets[5]; in ull_cp_remote_cpr_apm_reply()
1214 ctx->data.cu.error = 0U; in ull_cp_remote_cpr_apm_reply()
1215 llcp_rp_conn_param_req_apm_reply(conn, ctx); in ull_cp_remote_cpr_apm_reply()
1221 struct proc_ctx *ctx; in ull_cp_remote_cpr_apm_neg_reply() local
1223 ctx = llcp_rr_peek(conn); in ull_cp_remote_cpr_apm_neg_reply()
1225 if (ctx && ctx->proc == PROC_CONN_PARAM_REQ) { in ull_cp_remote_cpr_apm_neg_reply()
1226 ctx->data.cu.error = error_code; in ull_cp_remote_cpr_apm_neg_reply()
1227 llcp_rp_conn_param_req_apm_reply(conn, ctx); in ull_cp_remote_cpr_apm_neg_reply()
1249 struct proc_ctx *ctx; local
1272 ctx = llcp_create_local_procedure(PROC_CTE_REQ);
1273 if (!ctx) {
1277 ctx->data.cte_req.min_len = min_cte_len;
1278 ctx->data.cte_req.type = cte_type;
1280 llcp_lr_enqueue(conn, ctx);
1299 struct proc_ctx *ctx; local
1301 ctx = llcp_lr_peek(conn);
1302 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1303 ctx->data.cis_create.cis_offset_min = cis_offset_min;
1304 ctx->data.cis_create.cis_offset_max = cis_offset_max;
1306 llcp_lp_cc_offset_calc_reply(conn, ctx);
1314 struct proc_ctx *ctx; local
1316 ctx = llcp_rr_peek(conn);
1317 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1318 return llcp_rp_cc_awaiting_reply(ctx);
1326 struct proc_ctx *ctx; local
1328 ctx = llcp_rr_peek(conn);
1329 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1330 return ctx->data.cis_create.cis_handle;
1338 struct proc_ctx *ctx; local
1340 ctx = llcp_rr_peek(conn);
1341 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1342 if (cis_offset_min > ctx->data.cis_create.cis_offset_min) {
1343 if (cis_offset_min > ctx->data.cis_create.cis_offset_max) {
1344 ctx->data.cis_create.error = BT_HCI_ERR_UNSUPP_LL_PARAM_VAL;
1345 llcp_rp_cc_reject(conn, ctx);
1350 ctx->data.cis_create.cis_offset_min = cis_offset_min;
1353 llcp_rp_cc_accept(conn, ctx);
1359 struct proc_ctx *ctx; local
1361 ctx = llcp_rr_peek(conn);
1362 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1363 ctx->data.cis_create.error = error_code;
1364 llcp_rp_cc_reject(conn, ctx);
1372 struct proc_ctx *ctx; local
1375 ctx = llcp_rr_peek(conn);
1376 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1377 return llcp_rp_cc_awaiting_established(ctx);
1382 ctx = llcp_lr_peek(conn);
1383 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1384 return llcp_lp_cc_awaiting_established(ctx);
1393 struct proc_ctx *ctx; local
1395 ctx = llcp_lr_peek(conn);
1396 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1397 return llcp_lp_cc_cancel(conn, ctx);
1406 struct proc_ctx *ctx; local
1409 ctx = llcp_rr_peek(conn);
1410 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1411 ctx->data.cis_create.error = error_code;
1412 llcp_rp_cc_established(conn, ctx);
1413 llcp_rr_check_done(conn, ctx);
1418 ctx = llcp_lr_peek(conn);
1419 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1420 ctx->data.cis_create.error = error_code;
1421 llcp_lp_cc_established(conn, ctx);
1422 llcp_lr_check_done(conn, ctx);
1431 struct proc_ctx *ctx; local
1433 ctx = llcp_lr_peek(conn);
1434 if (ctx && ctx->proc == PROC_CIS_CREATE) {
1435 return llcp_lp_cc_is_active(ctx);
1442 struct proc_ctx *ctx; local
1444 ctx = llcp_lr_peek_proc(conn, PROC_CIS_CREATE);
1446 return (ctx != NULL);
1454 const struct proc_ctx *ctx; local
1456 ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC);
1458 if (ctx) {
1459 *adv_sync_handle = ctx->data.periodic_sync.adv_handle;
1460 *sync_handle = ctx->data.periodic_sync.sync_handle;
1470 struct proc_ctx *ctx; local
1473 ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC);
1475 if (ctx) {
1491 ctx->data.periodic_sync.conn_event_count = ull_conn_event_counter(conn) +
1495 llcp_pdu_fill_sync_info_offset(&ctx->data.periodic_sync.sync_info, offset_us);
1498 ctx->data.periodic_sync.offset_us = offset_us;
1501 ctx->data.periodic_sync.sync_conn_event_count = ull_conn_event_counter(conn);
1502 ctx->data.periodic_sync.conn_event_count = ull_conn_event_counter(conn) +
1505 ctx->data.periodic_sync.sync_info.evt_cntr = pa_event_counter;
1507 ctx->data.periodic_sync.last_pa_event_counter = last_pa_event_counter;
1509 llcp_lp_past_offset_calc_reply(conn, ctx);
1515 struct proc_ctx *ctx; local
1517 ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC);
1518 if (ctx) {
1527 ctx->data.periodic_sync.conn_start_to_actual_us = start_to_actual_us;
1531 ctx->data.periodic_sync.conn_evt_trx = done->extra.trx_cnt;
1532 llcp_lp_past_conn_evt_done(conn, ctx);
1537 static bool pdu_is_expected(struct pdu_data *pdu, struct proc_ctx *ctx) argument
1539 return (ctx->rx_opcode == pdu->llctrl.opcode || ctx->rx_greedy);
1542 static bool pdu_is_unknown(struct pdu_data *pdu, struct proc_ctx *ctx) argument
1545 (ctx->tx_opcode == pdu->llctrl.unknown_rsp.type));
1548 static bool pdu_is_reject(struct pdu_data *pdu, struct proc_ctx *ctx) argument
1556 static bool pdu_is_reject_ext(struct pdu_data *pdu, struct proc_ctx *ctx) argument
1559 (ctx->tx_opcode == pdu->llctrl.reject_ext_ind.reject_opcode));
1562 static bool pdu_is_any_reject(struct pdu_data *pdu, struct proc_ctx *ctx) argument
1564 return (pdu_is_reject_ext(pdu, ctx) || pdu_is_reject(pdu, ctx));
1866 struct proc_ctx *ctx; local
1868 ctx = llcp_lr_peek(conn);
1869 if (ctx && ctx->node_ref.tx_ack == tx) {
1871 llcp_lr_tx_ack(conn, ctx, tx);
1874 ctx = llcp_rr_peek(conn);
1875 if (ctx && ctx->node_ref.tx_ack == tx) {
1877 llcp_rr_tx_ack(conn, ctx, tx);
1883 struct proc_ctx *ctx; local
1885 ctx = llcp_lr_peek(conn);
1886 if (ctx) {
1888 llcp_lr_tx_ntf(conn, ctx);
1891 ctx = llcp_rr_peek(conn);
1892 if (ctx) {
1894 llcp_rr_tx_ntf(conn, ctx);
1912 struct proc_ctx *ctx; local
1914 ctx = llcp_lr_peek(conn);
1915 if (ctx && pdu_is_expected(pdu, ctx)) {
1919 ctx = llcp_rr_peek(conn);
1920 if (ctx && pdu_is_expected(pdu, ctx)) {