[Feature][Modem]Update MTK MODEM V1.6 baseline version: MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6
MTK modem version: MT2735_IVT_MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6.tar.gz
RF modem version: NA
Change-Id: I45a4c2752fa9d1a618beacd5d40737fb39ab64fb
diff --git a/mcu/protocol/dispatcher/src/dispatcher_control.c b/mcu/protocol/dispatcher/src/dispatcher_control.c
new file mode 100644
index 0000000..8161a01
--- /dev/null
+++ b/mcu/protocol/dispatcher/src/dispatcher_control.c
@@ -0,0 +1,611 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2005
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/*******************************************************************************
+ * Filename:
+ * ---------
+ * dispatcher_control.c
+ *
+ * Project:
+ * --------
+ * VMOLY
+ *
+ * Description:
+ * ------------
+ * Dispatcher control information managment.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *******************************************************************************/
+
+#include "dispatcher_struct.h"
+#include "dispatcher_msgid.h"
+#include "md_sap.h"
+#include "dispatcher_debug.h"
+#include "dispatcher_data_path_trace_utmd.h"
+/**
+ * dispatcher global conrol context having bearer & context information
+ */
+static dispatcher_control_cntx g_dispatcher_cntx[MAX_SIM_NUM];
+
+/**
+ * dispatcher current protoidx for recvd ilm
+ */
+kal_uint8 g_dispatcher_curr_protoidx;
+
+
+void dispatcher_ctrl_set_current_protoidx(kal_uint8 protoidx)
+{
+ g_dispatcher_curr_protoidx = protoidx;
+}
+
+
+void dispatcher_init_control_cntx(void)
+{
+ kal_mem_set(g_dispatcher_cntx, 0, sizeof(g_dispatcher_cntx));
+}
+
+#ifdef ATEST_SYS_DISPATCHER
+ extern kal_bool dispatcher_ut_assert_flag;
+
+ #ifdef ASSERT
+ #undef ASSERT
+ #endif
+ //#define ASSERT(x) do{ if (x) ut_assert_flag = KAL_TRUE; }while(0)
+ void ASSERT(int x) {
+ if (!x) {
+ dispatcher_ut_assert_flag = KAL_TRUE;
+ }
+ }
+#endif
+
+/******************************************************************
+****************Control path functions****************************
+*****************************************************************/
+
+void
+n3epc_dispatcher_bearer_act_req(n3epc_dispatcher_bearer_act_req_struct *p_local)
+{
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ dispatcher_cid_info_struct *p_cid_info;
+ kal_uint8 bearer_id, cid;
+
+ MD_TRC_DISPATCHER_TR_BEARER_ACT_REQ(p_local->bearer_id, p_local->linked_bearer_id,
+ p_local->context_id, proto_idx);
+
+ bearer_id = p_local->bearer_id;
+ /*as per WO bearer_id will range from 1~15*/
+ if (0 == bearer_id || bearer_id > 15) {
+ //BEARER_ID_INVALID_VALUE
+ ASSERT(0);
+ return;
+ }
+ cid = p_local->context_id;
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[cid];
+
+ /*if ebi context has already valid values it means bearer is already active*/
+ if (p_bearer_info->defult_bearer_id != 0) {
+ ASSERT(0);
+ return;
+ }
+ p_bearer_info->bearer_id = bearer_id;
+ p_bearer_info->defult_bearer_id = p_local->linked_bearer_id;
+ //for R14 this will be always true
+ if (p_bearer_info->bearer_id == p_local->linked_bearer_id)
+ {
+ // the bearer_id of the cid info not to be set at bearer act req
+ //bearer is already active for this cid
+ ASSERT(p_cid_info->bearer_id == 0);
+ p_bearer_info->context_id = cid;
+
+ // save ip_addr and dns for the ipcore bind process
+ p_cid_info->ip_addr = p_local->ip_addr;
+ p_cid_info->dns = p_local->dns;
+
+ MD_TRC_DISPATCHER_TR_BEARER_ACT_REQ_BIND_STATE(p_bearer_info->context_id, p_cid_info->bind_state);
+
+ if (DISPATCHER_PDN_ST_UNBIND == p_cid_info->bind_state)
+ {
+ //reset old bearer id here
+ p_cid_info->old_bearer_id = 0;
+ }
+ /* not accepatable state to handle bearer activation*/
+ if ((DISPATCHER_PDN_ST_BIND == p_cid_info->bind_state) ||
+ (DISPATCHER_PDN_ST_BINDING == p_cid_info->bind_state) ||
+ (DISPATCHER_PDN_ST_BINDING_GOING_TO_UNBIND == p_cid_info->bind_state))
+ {
+ ASSERT(0);
+ return;
+ }
+ p_cid_info->bearer_id = p_bearer_info->defult_bearer_id;
+ }
+ /*currently bearer_id & linked bearer_id will be same*/
+ else
+ {
+ ASSERT(0);
+ return;
+ }
+
+}
+
+
+
+void
+n3epc_dispatcher_bearer_deact_req(n3epc_dispatcher_bearer_deact_req_struct *p_local)
+{
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ dispatcher_cid_info_struct *p_cid_info;
+ kal_uint8 bearer_id, cid;
+
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ bearer_id = p_local->bearer_id;
+ cid = p_local->context_id;
+
+ MD_TRC_DISPATCHER_TR_BEARER_DEACT_REQ(bearer_id, cid, proto_idx);
+
+ if (0 == bearer_id || bearer_id > 15) {
+ //BEARER_ID_INVALID_VALUE
+ ASSERT(0);
+ return;
+ }
+
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[cid];
+
+ if (p_bearer_info->defult_bearer_id == bearer_id)
+ {
+ /*check this bearer info have same cid*/
+ ASSERT(p_bearer_info->context_id == cid);
+ p_bearer_info->defult_bearer_id = 0;
+ p_cid_info->bearer_id = 0;
+ }
+
+ /*bearer can be deactivated before pdn unbind*/
+ /*to handle unbind we need bearer_id, to keep bearer_id in old_bearer_id in cid info*/
+ if ((DISPATCHER_PDN_ST_BIND == p_cid_info->bind_state) ||
+ (DISPATCHER_PDN_ST_BINDING_GOING_TO_UNBIND == p_cid_info->bind_state) ||
+ (DISPATCHER_PDN_ST_BINDING == p_cid_info->bind_state))
+ {
+ p_cid_info->old_bearer_id = bearer_id;
+ }
+
+}
+
+void n3epc_dispatcher_pdn_bind_req(n3epc_dispatcher_pdn_bind_req_struct *p_local,
+ kal_uint32 src_mod_id)
+{
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ dispatcher_cid_info_struct *p_cid_info;
+ kal_uint8 bearer_id;
+ dispatcher_bind_state_enum bind_state;
+#ifndef ATEST_SYS_DISPATCHER
+ kal_uint8 pdn_id;
+ ipcore_dispatcher_pdn_bind_ind_struct *p_pdn_bind_ind;
+#endif
+ ps_cause_enum error_result = HIF_IPC_OK;
+
+ MD_TRC_DISPATCHER_TR_PDN_BIND_REQ(p_local->context_id,
+ p_local->network_interface_id, proto_idx);
+
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[p_local->context_id];
+ bearer_id = p_cid_info->bearer_id;
+
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ /*check if bearer is already active or not before bind this is must condition*/
+ /*******handling added for assert removal*************/
+ if ((p_cid_info->bearer_id == 0) ||
+ (p_bearer_info->defult_bearer_id != bearer_id))
+ {
+ error_result = N3EPC_DISPATCHER_BIND_ERROR_AS_BEARER_NOT_ACTIVATED_BEFORE;
+ dispatcher_report_bind_unbind_error_cnf(KAL_TRUE, error_result, p_local->context_id, src_mod_id);
+ return;
+ }
+ bind_state = p_cid_info->bind_state;
+ /*bind req is valid for unbind state only*/
+ if (DISPATCHER_PDN_ST_UNBIND == bind_state)
+ {
+ /*update pdn bind state*/
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_BINDING;
+ p_cid_info->apn_type_info = p_local->apn_type_info;
+
+ /* forward to IPCORE */
+#ifndef ATEST_SYS_DISPATCHER
+ p_pdn_bind_ind = construct_local_para(sizeof(ipcore_dispatcher_pdn_bind_ind_struct), 0);
+
+#if defined(__SENSITIVE_DATA_MOSAIC__) && defined(__MTK_TARGET__)
+ kal_set_sensitive_buff(p_pdn_bind_ind);
+#endif
+
+ p_pdn_bind_ind->network_interface_id = p_local->network_interface_id;
+ DISPATCHER_CONVERT_BEARERID_TO_PDNID(bearer_id, pdn_id);
+ p_pdn_bind_ind->pdn_id = pdn_id;
+ p_pdn_bind_ind->apn_type_info = p_local->apn_type_info;
+ p_pdn_bind_ind->ip_addr = p_cid_info->ip_addr;
+ p_pdn_bind_ind->dns = p_cid_info->dns;
+
+ p_pdn_bind_ind->back_info.reply_dest_mod_id = src_mod_id;
+ p_pdn_bind_ind->back_info.context_id = p_local->context_id;
+
+ msg_send6(
+ MOD_DISPATCHER + proto_idx,
+ MOD_IPCORE,
+#if defined(__SENSITIVE_DATA_MOSAIC__) && defined(__MTK_TARGET__)
+ DISPATCHER_USER_SENSITIVE_SAP,
+#else
+ DISPATCHER_SAP,
+#endif
+ MSG_ID_IPCORE_DISPATCHER_PDN_BIND_IND,
+ (local_para_struct*) p_pdn_bind_ind,
+ NULL);
+#endif
+
+ } else if (DISPATCHER_PDN_ST_BIND == bind_state) {
+ error_result = N3EPC_DISPATCHER_BIND_ERROR_AS_PDN_ALREADY_BIND;
+ dispatcher_report_bind_unbind_error_cnf(KAL_TRUE, error_result, p_local->context_id, src_mod_id);
+ } else if (DISPATCHER_PDN_ST_BINDING == bind_state) {
+ error_result = N3EPC_DISPATCHER_BIND_ERROR_AS_PREV_BIND_IN_PROGRESS;
+ dispatcher_report_bind_unbind_error_cnf(KAL_TRUE, error_result, p_local->context_id, src_mod_id);
+ } else /*if (DISPATCHER_PDN_ST_BINDING_GOING_TO_UNBIND == bind_state)*/ {
+ error_result = N3EPC_DISPATCHER_BINDING_GOING_TO_UNBIND_ERROR_AS_PREV_BIND_IN_PROGRESS;
+ dispatcher_report_bind_unbind_error_cnf(KAL_TRUE, error_result, p_local->context_id, src_mod_id);
+ }
+ MD_TRC_DISPATCHER_TR_PDN_BIND_REQ_BIND_STATE(p_local->context_id,
+ bind_state, p_cid_info->bind_state);
+}
+
+
+void n3epc_dispatcher_pdn_unbind_req(n3epc_dispatcher_pdn_unbind_req_struct *p_local,
+ kal_uint32 src_mod_id)
+{
+
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ dispatcher_cid_info_struct *p_cid_info;
+ kal_uint8 bearer_id;
+ kal_uint8 cid = p_local->context_id;
+ dispatcher_bind_state_enum bind_state;
+ ps_cause_enum error_result = HIF_IPC_OK;
+
+ MD_TRC_DISPATCHER_TR_PDN_UNBIND_REQ(p_local->context_id, proto_idx);
+
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[cid];
+ bind_state = p_cid_info->bind_state;
+ bearer_id = p_cid_info->bearer_id;
+
+ /* unbind may be after bearer deact
+ * on bearer deact we will keep the bearer_id to old_bearer_id in cid
+ */
+ if (!bearer_id) {
+ bearer_id = p_cid_info->old_bearer_id;
+ }
+
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ ASSERT(p_bearer_info->context_id == cid);
+
+ if (DISPATCHER_PDN_ST_BIND == bind_state) {
+ /* wo unbind cnf + ipc unbind ind!! */
+ dispatcher_unbind_cnf_optional_ipc_ind(p_bearer_info, KAL_TRUE, src_mod_id, proto_idx);
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_UNBIND;
+ } else if (DISPATCHER_PDN_ST_BINDING == bind_state) {
+ // update bind_state
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_BINDING_GOING_TO_UNBIND;
+ } else {
+ // Not expected state
+ //ASSERT(0);
+ error_result = N3EPC_DISPATCHER_UNBIND_ERROR_AS_DUPLICATE_UNBIND_REQ;
+ dispatcher_report_bind_unbind_error_cnf(KAL_FALSE, error_result, p_local->context_id, src_mod_id);
+ }
+ MD_TRC_DISPATCHER_TR_PDN_UNBIND_REQ_BIND_STATE(cid, bind_state, p_cid_info->bind_state);
+}
+
+
+void
+ipcore_dispatcher_pdn_bind_rsp(ipcore_dispatcher_pdn_bind_rsp_struct *p_local)
+{
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ kal_uint8 bearer_id = 0;
+ kal_uint8 context_id = p_local->back_info.context_id;
+ n3epc_dispatcher_pdn_bind_cnf_struct *p_pdn_bind_cnf;
+ dispatcher_bind_state_enum bind_state;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ dispatcher_cid_info_struct *p_cid_info;
+
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ DISPATCHER_CONVERT_PDNID_TO_BEARERID(p_local->pdn_id, bearer_id);
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[context_id];
+ bind_state = p_cid_info->bind_state;
+ if (DISPATCHER_PDN_ST_BINDING == bind_state) {
+ /* state is binding(waiting for bind rsp) send cnf to wo!! */
+ if (HIF_IPC_OK == p_local->result) {
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_BIND;
+ p_cid_info->network_interface_id = p_local->network_interface_id;
+ } else {
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_UNBIND;
+ }
+ } else if (DISPATCHER_PDN_ST_BINDING_GOING_TO_UNBIND == bind_state) {
+ /*send bind cnf to WO + unbind to ipc based upon bind result*/
+ if (HIF_IPC_OK == p_local->result) {
+ p_cid_info->pending_req = DISPATCHER_PENDING_REQ_UNBIND_IND_N_CNF ;
+ } else {
+ p_cid_info->pending_req = DISPATCHER_PENDING_REQ_UNBIND_CNF;
+ }
+ } else {
+ ASSERT(0);
+ }
+
+ MD_TRC_DISPATCHER_TR_PDN_IPC_BIND_RSP(p_local->result, context_id,
+ bind_state, p_cid_info->bind_state, proto_idx);
+ /*as this is the bind rsp so first send bind cnf to WO !! */
+
+ p_pdn_bind_cnf = construct_local_para(sizeof(n3epc_dispatcher_pdn_bind_cnf_struct), TD_RESET);
+ p_pdn_bind_cnf->context_id = p_local->back_info.context_id;
+ if (DISPATCHER_PDN_ST_BIND == p_cid_info->bind_state) {
+ p_pdn_bind_cnf->is_successful = p_local->result == HIF_IPC_OK ? KAL_TRUE : KAL_FALSE;
+ }
+ p_pdn_bind_cnf->error_result = p_local->result;
+
+ msg_send6(
+#ifndef ATEST_SYS_DISPATCHER
+ MOD_DISPATCHER + proto_idx,
+#else
+ MOD_NIL,
+#endif
+ p_local->back_info.reply_dest_mod_id,
+ DISPATCHER_SAP,
+ MSG_ID_N3EPC_DISPATCHER_PDN_BIND_CNF,
+ (local_para_struct*) p_pdn_bind_cnf,
+ NULL);
+
+ /*only send unbind cnf to WO*/
+ if (DISPATCHER_PENDING_REQ_UNBIND_CNF == p_cid_info->pending_req) {
+ //KAL_FALSE : as bind rsp failed so no need to send unbind ind to ipcore
+ dispatcher_unbind_cnf_optional_ipc_ind(p_bearer_info, KAL_FALSE,
+ p_local->back_info.reply_dest_mod_id, proto_idx);
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_UNBIND;
+ p_cid_info->pending_req = DISPATCHER_PENDING_REQ_NONE;
+ } else if (DISPATCHER_PENDING_REQ_UNBIND_IND_N_CNF == p_cid_info->pending_req) {
+ //KAL_TRUE: as bind rsp success, so send unbind ind to ipcore
+ dispatcher_unbind_cnf_optional_ipc_ind(p_bearer_info, KAL_TRUE,
+ p_local->back_info.reply_dest_mod_id, proto_idx);
+ p_cid_info->bind_state = DISPATCHER_PDN_ST_UNBIND;
+ p_cid_info->pending_req = DISPATCHER_PENDING_REQ_NONE;
+ }
+}
+
+
+/******************************************************************
+*helper function to check binding state & bearer activation state*
+*****************************************************************/
+
+dispatcher_bind_state_enum
+dispatcher_get_bind_state_by_bearerid(kal_uint8 bearer_id, kal_uint8 proto_idx)
+{
+ dispatcher_cid_info_struct *p_cid_info;
+ dispatcher_bearer_info_struct *p_bearer_info;
+ kal_uint8 cid = 0;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ cid = p_bearer_info->context_id;
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[cid];
+
+ MD_TRC_DISPATCHER_DATA_TRACE_BINDING_INFO(bearer_id, cid, p_cid_info->bind_state, proto_idx);
+ return p_cid_info->bind_state;
+
+}
+
+
+dispatcher_bind_state_enum
+dispatcher_get_bind_state_by_pdnid(kal_uint8 pdn_id, kal_uint8 proto_idx)
+{
+ kal_uint8 bearer_id = 0;
+ DISPATCHER_CONVERT_PDNID_TO_BEARERID(pdn_id, bearer_id);
+ if (IS_VALID_BEARERID(bearer_id)) {
+ return dispatcher_get_bind_state_by_bearerid(bearer_id, proto_idx);
+ }
+ return 0;
+}
+
+
+kal_bool dispatcher_check_is_bearer_active_by_pdnid(kal_uint8 pdn_id,
+ kal_uint8 proto_idx)
+{
+ kal_uint8 bearer_id = 0;
+ DISPATCHER_CONVERT_PDNID_TO_BEARERID(pdn_id, bearer_id);
+ if (IS_VALID_BEARERID(bearer_id)) {
+ return dispatcher_check_is_bearer_active_by_bearerid(bearer_id, proto_idx);
+ }
+ return KAL_FALSE;
+}
+
+
+kal_bool dispatcher_check_is_bearer_active_by_bearerid(kal_uint8 bearer_id,
+ kal_uint8 proto_idx)
+{
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[proto_idx];
+ dispatcher_bearer_info_struct *p_bearer_info = &p_dispatcher_ctrl_cntx->bearer_info[bearer_id];
+ kal_bool is_active = (0 != p_bearer_info->defult_bearer_id) ? KAL_TRUE : KAL_FALSE;
+
+ MD_TRC_DISPATCHER_DATA_TRACE_BEARER_INFO(bearer_id, is_active, proto_idx);
+ return is_active;
+}
+
+/**
+ * dispatcher_report_bind_unbind_error_cnf
+ * report bind unbind error to WO for pre check
+ */
+void dispatcher_report_bind_unbind_error_cnf(kal_bool is_bindreq,
+ ps_cause_enum error_code,
+ kal_uint8 cid,
+ kal_uint32 reply_mod_id)
+{
+ kal_bool success = KAL_FALSE;
+ kal_uint8 proto_idx = g_dispatcher_curr_protoidx;
+ if (is_bindreq)
+ {
+ n3epc_dispatcher_pdn_bind_cnf_struct *p_pdn_bind_cnf;
+ p_pdn_bind_cnf = construct_local_para(sizeof(n3epc_dispatcher_pdn_bind_cnf_struct), TD_RESET);
+ p_pdn_bind_cnf->context_id = cid;
+ p_pdn_bind_cnf->is_successful = success;
+ p_pdn_bind_cnf->error_result = error_code;
+
+ msg_send6(
+#ifndef ATEST_SYS_DISPATCHER
+ MOD_DISPATCHER + proto_idx,
+#else
+ MOD_NIL,
+#endif
+ reply_mod_id,
+ DISPATCHER_SAP,
+ MSG_ID_N3EPC_DISPATCHER_PDN_BIND_CNF,
+ (local_para_struct*) p_pdn_bind_cnf,
+ NULL);
+
+ }
+ else
+ {
+ n3epc_dispatcher_pdn_unbind_cnf_struct *p_pdn_unbind_cnf;
+ p_pdn_unbind_cnf = construct_local_para(sizeof(n3epc_dispatcher_pdn_unbind_cnf_struct), TD_RESET);
+ p_pdn_unbind_cnf->context_id = cid;
+ p_pdn_unbind_cnf->is_successful = success;
+ p_pdn_unbind_cnf->error_result = error_code;
+
+ msg_send6(
+#ifndef ATEST_SYS_DISPATCHER
+ MOD_DISPATCHER + proto_idx,
+#else
+ MOD_NIL,
+#endif
+ reply_mod_id,
+ DISPATCHER_SAP,
+ MSG_ID_N3EPC_DISPATCHER_PDN_UNBIND_CNF,
+ (local_para_struct*) p_pdn_unbind_cnf,
+ NULL);
+ }
+}
+
+
+/**
+ * dispatcher_unbind_cnf_optional_ipc_ind
+ * unbind CNF to WO must + optional IPC unbind ind
+ */
+void dispatcher_unbind_cnf_optional_ipc_ind(
+ dispatcher_bearer_info_struct *p_bearer_info,
+ kal_bool ipc_unbind_required,
+ kal_uint32 dest_mod_id,
+ kal_uint8 proto_idx)
+{
+#ifndef ATEST_SYS_DISPATCHER
+ ipcore_dispatcher_pdn_unbind_ind_struct *p_pdn_unbind_ind;
+#endif
+ n3epc_dispatcher_pdn_unbind_cnf_struct *p_pdn_unbind_cnf;
+
+ kal_uint8 bearer_id = p_bearer_info->bearer_id;
+ kal_uint8 cid = p_bearer_info->context_id;
+
+ MD_TRC_DISPATCHER_TR_PDN_UNBIND_CNF_N_IND_OPTIONAL(bearer_id,
+ p_bearer_info->context_id, ipc_unbind_required, proto_idx);
+
+ /* forward to IPCORE */
+ if (ipc_unbind_required) {
+#ifndef ATEST_SYS_DISPATCHER
+ kal_uint8 pdn_id = 0;
+ p_pdn_unbind_ind = construct_local_para(sizeof(ipcore_dispatcher_pdn_unbind_ind_struct), TD_RESET);
+ DISPATCHER_CONVERT_BEARERID_TO_PDNID(bearer_id, pdn_id);
+ p_pdn_unbind_ind->pdn_id = pdn_id;
+
+ msg_send6(
+ MOD_DISPATCHER + proto_idx,
+ MOD_IPCORE,
+ DISPATCHER_SAP,
+ MSG_ID_IPCORE_DISPATCHER_PDN_UNBIND_IND,
+ (local_para_struct*) p_pdn_unbind_ind,
+ NULL);
+#endif
+ }
+
+ /* CNF to WO */
+
+ p_pdn_unbind_cnf = construct_local_para(sizeof(n3epc_dispatcher_pdn_unbind_cnf_struct), TD_RESET);
+ p_pdn_unbind_cnf->context_id = cid;
+ p_pdn_unbind_cnf->is_successful = KAL_TRUE;
+ p_pdn_unbind_cnf->error_result = HIF_IPC_OK;
+ msg_send6(
+#ifndef ATEST_SYS_DISPATCHER
+ MOD_DISPATCHER + proto_idx,
+#else
+ MOD_NIL,
+#endif
+ dest_mod_id,
+ DISPATCHER_SAP,
+ MSG_ID_N3EPC_DISPATCHER_PDN_UNBIND_CNF,
+ (local_para_struct*) p_pdn_unbind_cnf,
+ NULL);
+}
+
+
+#if defined(__SENSITIVE_DATA_MOSAIC__)
+void dispatcher_clean_private_data(void)
+{
+ //kal_mem_set(g_dispatcher_cntx, 0, sizeof(g_dispatcher_cntx));
+ //or just clean the ip_addr from global
+ kal_uint8 sim_id, cid;
+ dispatcher_control_cntx *p_dispatcher_ctrl_cntx;
+ dispatcher_cid_info_struct *p_cid_info;
+
+ for (sim_id = 0; sim_id < MAX_SIM_NUM; sim_id++) {
+ p_dispatcher_ctrl_cntx = &g_dispatcher_cntx[sim_id];
+ for (cid = 0; cid < 200; cid++) {
+ p_cid_info = &p_dispatcher_ctrl_cntx->cid_info[cid];
+ kal_mem_set(&p_cid_info->ip_addr,0, sizeof(ip_addr_struct));
+ kal_mem_set(&p_cid_info->dns, 0, sizeof(dns_struct));
+ }
+ }
+}
+#endif