• Home
  • Raw
  • Download

Lines Matching refs:ipc_mux

16 	struct iosm_mux *ipc_mux = ipc_imem->mux;  in ipc_mux_tq_cmd_send()  local
19 skb_queue_tail(&ipc_mux->channel->ul_list, acb->skb); in ipc_mux_tq_cmd_send()
20 ipc_imem_ul_send(ipc_mux->imem); in ipc_mux_tq_cmd_send()
25 static int ipc_mux_acb_send(struct iosm_mux *ipc_mux, bool blocking) in ipc_mux_acb_send() argument
27 struct completion *completion = &ipc_mux->channel->ul_sem; in ipc_mux_acb_send()
28 int ret = ipc_task_queue_send_task(ipc_mux->imem, ipc_mux_tq_cmd_send, in ipc_mux_acb_send()
29 0, &ipc_mux->acb, in ipc_mux_acb_send()
30 sizeof(ipc_mux->acb), false); in ipc_mux_acb_send()
32 dev_err(ipc_mux->dev, "unable to send mux command"); in ipc_mux_acb_send()
47 dev_err(ipc_mux->dev, "ch[%d] timeout", in ipc_mux_acb_send()
48 ipc_mux->channel_id); in ipc_mux_acb_send()
49 ipc_uevent_send(ipc_mux->imem->dev, UEVENT_MDM_TIMEOUT); in ipc_mux_acb_send()
58 static struct mux_lite_cmdh *ipc_mux_lite_add_cmd(struct iosm_mux *ipc_mux, in ipc_mux_lite_add_cmd() argument
72 cmdh->transaction_id = cpu_to_le32(ipc_mux->tx_transaction_id++); in ipc_mux_lite_add_cmd()
82 static int ipc_mux_acb_alloc(struct iosm_mux *ipc_mux) in ipc_mux_acb_alloc() argument
84 struct mux_acb *acb = &ipc_mux->acb; in ipc_mux_acb_alloc()
89 skb = ipc_pcie_alloc_skb(ipc_mux->pcie, MUX_MAX_UL_ACB_BUF_SIZE, in ipc_mux_acb_alloc()
102 int ipc_mux_dl_acb_send_cmds(struct iosm_mux *ipc_mux, u32 cmd_type, u8 if_id, in ipc_mux_dl_acb_send_cmds() argument
106 struct mux_acb *acb = &ipc_mux->acb; in ipc_mux_dl_acb_send_cmds()
111 ret = ipc_mux_acb_alloc(ipc_mux); in ipc_mux_dl_acb_send_cmds()
115 ack_lite = ipc_mux_lite_add_cmd(ipc_mux, cmd_type, acb, param, in ipc_mux_dl_acb_send_cmds()
120 ret = ipc_mux_acb_send(ipc_mux, blocking); in ipc_mux_dl_acb_send_cmds()
131 static int ipc_mux_dl_cmdresps_decode_process(struct iosm_mux *ipc_mux, in ipc_mux_dl_cmdresps_decode_process() argument
134 struct mux_acb *acb = &ipc_mux->acb; in ipc_mux_dl_cmdresps_decode_process()
147 if (ipc_mux->protocol != MUX_LITE) in ipc_mux_dl_cmdresps_decode_process()
150 dev_dbg(ipc_mux->dev, "if %u FLOW_CTL_ACK %u received", in ipc_mux_dl_cmdresps_decode_process()
160 complete(&ipc_mux->channel->ul_sem); in ipc_mux_dl_cmdresps_decode_process()
165 static int ipc_mux_dl_dlcmds_decode_process(struct iosm_mux *ipc_mux, in ipc_mux_dl_dlcmds_decode_process() argument
172 dev_dbg(ipc_mux->dev, "if_id[%d]: dlcmds decode process %d", in ipc_mux_dl_dlcmds_decode_process()
178 if (cmdh->if_id >= ipc_mux->nr_sessions) { in ipc_mux_dl_dlcmds_decode_process()
179 dev_err(ipc_mux->dev, "if_id [%d] not valid", in ipc_mux_dl_dlcmds_decode_process()
184 session = &ipc_mux->session[cmdh->if_id]; in ipc_mux_dl_dlcmds_decode_process()
220 dev_dbg(ipc_mux->dev, "if[%u] FLOW CTRL 0x%08X", cmdh->if_id, in ipc_mux_dl_dlcmds_decode_process()
234 static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb) in ipc_mux_dl_cmd_decode() argument
239 if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, cmdh)) { in ipc_mux_dl_cmd_decode()
243 if (!ipc_mux_dl_dlcmds_decode_process(ipc_mux, cmdh)) { in ipc_mux_dl_cmd_decode()
265 if (ipc_mux_dl_acb_send_cmds(ipc_mux, cmd, cmdh->if_id, in ipc_mux_dl_cmd_decode()
269 dev_err(ipc_mux->dev, in ipc_mux_dl_cmd_decode()
277 static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id, in ipc_mux_net_receive() argument
295 static void ipc_mux_dl_fcth_decode(struct iosm_mux *ipc_mux, in ipc_mux_dl_fcth_decode() argument
304 dev_err(ipc_mux->dev, "unexpected FCT length: %d", in ipc_mux_dl_fcth_decode()
310 if (if_id >= ipc_mux->nr_sessions) { in ipc_mux_dl_fcth_decode()
311 dev_err(ipc_mux->dev, "not supported if_id: %d", if_id); in ipc_mux_dl_fcth_decode()
316 if_id = array_index_nospec(if_id, ipc_mux->nr_sessions); in ipc_mux_dl_fcth_decode()
317 wwan = ipc_mux->session[if_id].wwan; in ipc_mux_dl_fcth_decode()
319 dev_err(ipc_mux->dev, "session Net ID is NULL"); in ipc_mux_dl_fcth_decode()
325 dev_dbg(ipc_mux->dev, "Flow_Credit:: if_id[%d] Old: %d Grants: %d", in ipc_mux_dl_fcth_decode()
326 if_id, ipc_mux->session[if_id].ul_flow_credits, ul_credits); in ipc_mux_dl_fcth_decode()
329 ipc_mux->session[if_id].ul_flow_credits += ul_credits; in ipc_mux_dl_fcth_decode()
332 if (ipc_mux->session[if_id].ul_flow_credits > 0) { in ipc_mux_dl_fcth_decode()
333 ipc_mux->session[if_id].net_tx_stop = false; in ipc_mux_dl_fcth_decode()
334 ipc_mux_netif_tx_flowctrl(&ipc_mux->session[if_id], in ipc_mux_dl_fcth_decode()
335 ipc_mux->session[if_id].if_id, false); in ipc_mux_dl_fcth_decode()
340 static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux, in ipc_mux_dl_adgh_decode() argument
353 dev_err(ipc_mux->dev, "invalid ADGH signature received"); in ipc_mux_dl_adgh_decode()
358 if (if_id >= ipc_mux->nr_sessions) { in ipc_mux_dl_adgh_decode()
359 dev_err(ipc_mux->dev, "invalid if_id while decoding %d", if_id); in ipc_mux_dl_adgh_decode()
364 if_id = array_index_nospec(if_id, ipc_mux->nr_sessions); in ipc_mux_dl_adgh_decode()
365 wwan = ipc_mux->session[if_id].wwan; in ipc_mux_dl_adgh_decode()
367 dev_err(ipc_mux->dev, "session Net ID is NULL"); in ipc_mux_dl_adgh_decode()
380 ipc_mux->session[if_id].dl_head_pad_len - IPC_MEM_DL_ETH_OFFSET; in ipc_mux_dl_adgh_decode()
383 if_id += ipc_mux->wwan_q_offset; in ipc_mux_dl_adgh_decode()
386 rc = ipc_mux_net_receive(ipc_mux, if_id, wwan, packet_offset, in ipc_mux_dl_adgh_decode()
389 dev_err(ipc_mux->dev, "mux adgh decoding error"); in ipc_mux_dl_adgh_decode()
392 ipc_mux->session[if_id].flush = 1; in ipc_mux_dl_adgh_decode()
395 void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb) in ipc_mux_dl_decode() argument
407 ipc_mux_dl_adgh_decode(ipc_mux, skb); in ipc_mux_dl_decode()
411 ipc_mux_dl_fcth_decode(ipc_mux, skb->data); in ipc_mux_dl_decode()
415 ipc_mux_dl_cmd_decode(ipc_mux, skb); in ipc_mux_dl_decode()
419 dev_err(ipc_mux->dev, "invalid ABH signature"); in ipc_mux_dl_decode()
422 ipc_pcie_kfree_skb(ipc_mux->pcie, skb); in ipc_mux_dl_decode()
425 static int ipc_mux_ul_skb_alloc(struct iosm_mux *ipc_mux, in ipc_mux_ul_skb_alloc() argument
458 dev_err(ipc_mux->dev, in ipc_mux_ul_skb_alloc()
473 static void ipc_mux_ul_adgh_finish(struct iosm_mux *ipc_mux) in ipc_mux_ul_adgh_finish() argument
475 struct mux_adb *ul_adb = &ipc_mux->ul_adb; in ipc_mux_ul_adgh_finish()
481 dev_err(ipc_mux->dev, "no dest skb"); in ipc_mux_ul_adgh_finish()
487 skb_queue_tail(&ipc_mux->channel->ul_list, ul_adb->dest_skb); in ipc_mux_ul_adgh_finish()
490 if (ipc_mux->ul_flow == MUX_UL_ON_CREDITS) { in ipc_mux_ul_adgh_finish()
493 session = &ipc_mux->session[ul_adb->adgh->if_id]; in ipc_mux_ul_adgh_finish()
499 bytes = ipc_mux->ul_data_pend_bytes; in ipc_mux_ul_adgh_finish()
500 ipc_mux->ul_data_pend_bytes = ipc_mux->ul_data_pend_bytes + in ipc_mux_ul_adgh_finish()
504 dev_dbg(ipc_mux->dev, "UL ADGH: size=%u, if_id=%d, payload=%d, %s=%lld", in ipc_mux_ul_adgh_finish()
510 static bool ipc_mux_ul_adb_allocate(struct iosm_mux *ipc_mux, in ipc_mux_ul_adb_allocate() argument
521 status = ipc_mux_ul_skb_alloc(ipc_mux, adb, type); in ipc_mux_ul_adb_allocate()
536 static void ipc_mux_stop_tx_for_all_sessions(struct iosm_mux *ipc_mux) in ipc_mux_stop_tx_for_all_sessions() argument
541 for (idx = 0; idx < ipc_mux->nr_sessions; idx++) { in ipc_mux_stop_tx_for_all_sessions()
542 session = &ipc_mux->session[idx]; in ipc_mux_stop_tx_for_all_sessions()
552 static bool ipc_mux_lite_send_qlt(struct iosm_mux *ipc_mux) in ipc_mux_lite_send_qlt() argument
560 if (!ipc_mux->initialized || ipc_mux->state != MUX_S_ACTIVE) in ipc_mux_lite_send_qlt()
566 for (i = 0; i < ipc_mux->nr_sessions; i++) { in ipc_mux_lite_send_qlt()
567 session = &ipc_mux->session[i]; in ipc_mux_lite_send_qlt()
572 if (ipc_mux_ul_skb_alloc(ipc_mux, &ipc_mux->ul_adb, in ipc_mux_lite_send_qlt()
574 dev_err(ipc_mux->dev, in ipc_mux_lite_send_qlt()
580 qlt = (struct ipc_mem_lite_gen_tbl *)(ipc_mux->ul_adb.qlth_skb) in ipc_mux_lite_send_qlt()
592 skb_queue_tail(&ipc_mux->channel->ul_list, in ipc_mux_lite_send_qlt()
593 ipc_mux->ul_adb.qlth_skb); in ipc_mux_lite_send_qlt()
596 ipc_mux->ul_adb.qlth_skb = NULL; in ipc_mux_lite_send_qlt()
601 (void)ipc_imem_ul_write_td(ipc_mux->imem); in ipc_mux_lite_send_qlt()
609 static int ipc_mux_ul_bytes_credits_check(struct iosm_mux *ipc_mux, in ipc_mux_ul_bytes_credits_check() argument
618 if (ipc_mux->ul_flow == MUX_UL_ON_CREDITS) { in ipc_mux_ul_bytes_credits_check()
621 dev_dbg(ipc_mux->dev, in ipc_mux_ul_bytes_credits_check()
629 ipc_mux->ul_data_pend_bytes; in ipc_mux_ul_bytes_credits_check()
631 ipc_mux_stop_tx_for_all_sessions(ipc_mux); in ipc_mux_ul_bytes_credits_check()
633 dev_dbg(ipc_mux->dev, in ipc_mux_ul_bytes_credits_check()
635 session->if_id, ipc_mux->ul_data_pend_bytes, in ipc_mux_ul_bytes_credits_check()
657 static int ipc_mux_ul_adgh_encode(struct iosm_mux *ipc_mux, int session_id, in ipc_mux_ul_adgh_encode() argument
672 nr_of_pkts = ipc_mux_ul_bytes_credits_check(ipc_mux, session, ul_list, in ipc_mux_ul_adgh_encode()
690 if (ipc_mux_ul_adb_allocate(ipc_mux, adb, &ipc_mux->size_needed, in ipc_mux_ul_adgh_encode()
692 dev_err(ipc_mux->dev, "no reserved memory for ADGH"); in ipc_mux_ul_adgh_encode()
699 dev_err(ipc_mux->dev, in ipc_mux_ul_adgh_encode()
708 ipc_mux->size_needed = sizeof(struct mux_adgh) + aligned_size; in ipc_mux_ul_adgh_encode()
710 if (ipc_mux->size_needed > adb->size) { in ipc_mux_ul_adgh_encode()
711 dev_dbg(ipc_mux->dev, "size needed %d, adgh size %d", in ipc_mux_ul_adgh_encode()
712 ipc_mux->size_needed, adb->size); in ipc_mux_ul_adgh_encode()
733 if (ipc_mux->ul_flow == MUX_UL_ON_CREDITS) in ipc_mux_ul_adgh_encode()
744 ipc_mux_ul_adgh_finish(ipc_mux); in ipc_mux_ul_adgh_encode()
751 if (ipc_mux->ul_flow == MUX_UL_ON_CREDITS || in ipc_mux_ul_adgh_encode()
752 ipc_mux->ul_data_pend_bytes >= in ipc_mux_ul_adgh_encode()
754 adb_updated = ipc_mux_lite_send_qlt(ipc_mux); in ipc_mux_ul_adgh_encode()
759 (void)ipc_imem_ul_write_td(ipc_mux->imem); in ipc_mux_ul_adgh_encode()
765 bool ipc_mux_ul_data_encode(struct iosm_mux *ipc_mux) in ipc_mux_ul_data_encode() argument
774 if (!ipc_mux || ipc_mux->state != MUX_S_ACTIVE || in ipc_mux_ul_data_encode()
775 ipc_mux->adb_prep_ongoing) in ipc_mux_ul_data_encode()
778 ipc_mux->adb_prep_ongoing = true; in ipc_mux_ul_data_encode()
780 for (i = 0; i < ipc_mux->nr_sessions; i++) { in ipc_mux_ul_data_encode()
781 session_id = ipc_mux->rr_next_session; in ipc_mux_ul_data_encode()
782 session = &ipc_mux->session[session_id]; in ipc_mux_ul_data_encode()
785 ipc_mux->rr_next_session++; in ipc_mux_ul_data_encode()
786 if (ipc_mux->rr_next_session >= ipc_mux->nr_sessions) in ipc_mux_ul_data_encode()
787 ipc_mux->rr_next_session = 0; in ipc_mux_ul_data_encode()
806 updated = ipc_mux_ul_adgh_encode(ipc_mux, session_id, session, in ipc_mux_ul_data_encode()
807 ul_list, &ipc_mux->ul_adb, in ipc_mux_ul_data_encode()
811 ipc_mux->adb_prep_ongoing = false; in ipc_mux_ul_data_encode()
815 void ipc_mux_ul_encoded_process(struct iosm_mux *ipc_mux, struct sk_buff *skb) in ipc_mux_ul_encoded_process() argument
824 ipc_mux->ul_flow == MUX_UL) in ipc_mux_ul_encoded_process()
825 ipc_mux->ul_data_pend_bytes = ipc_mux->ul_data_pend_bytes - in ipc_mux_ul_encoded_process()
828 if (ipc_mux->ul_flow == MUX_UL) in ipc_mux_ul_encoded_process()
829 dev_dbg(ipc_mux->dev, "ul_data_pend_bytes: %lld", in ipc_mux_ul_encoded_process()
830 ipc_mux->ul_data_pend_bytes); in ipc_mux_ul_encoded_process()
836 skb_queue_tail((&ipc_mux->ul_adb.free_list), skb); in ipc_mux_ul_encoded_process()
843 struct iosm_mux *ipc_mux = ipc_imem->mux; in ipc_mux_tq_ul_trigger_encode() local
847 ul_data_pend = ipc_mux_ul_data_encode(ipc_mux); in ipc_mux_tq_ul_trigger_encode()
850 ipc_imem_td_update_timer_start(ipc_mux->imem); in ipc_mux_tq_ul_trigger_encode()
853 ipc_mux->ev_mux_net_transmit_pending = false; in ipc_mux_tq_ul_trigger_encode()
858 int ipc_mux_ul_trigger_encode(struct iosm_mux *ipc_mux, int if_id, in ipc_mux_ul_trigger_encode() argument
861 struct mux_session *session = &ipc_mux->session[if_id]; in ipc_mux_ul_trigger_encode()
864 if (ipc_mux->channel && in ipc_mux_ul_trigger_encode()
865 ipc_mux->channel->state != IMEM_CHANNEL_ACTIVE) { in ipc_mux_ul_trigger_encode()
866 dev_err(ipc_mux->dev, in ipc_mux_ul_trigger_encode()
872 dev_err(ipc_mux->dev, "session net ID is NULL"); in ipc_mux_ul_trigger_encode()
895 if (!ipc_mux->ev_mux_net_transmit_pending) { in ipc_mux_ul_trigger_encode()
896 ipc_mux->ev_mux_net_transmit_pending = true; in ipc_mux_ul_trigger_encode()
897 ret = ipc_task_queue_send_task(ipc_mux->imem, in ipc_mux_ul_trigger_encode()
903 dev_dbg(ipc_mux->dev, "mux ul if[%d] qlen=%d/%u, len=%d/%d, prio=%d", in ipc_mux_ul_trigger_encode()