blob: 8f5954f36c824639070a297057e8f5845785bd95 [file] [log] [blame]
/*****************************************************************************
* 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) 2012
*
* 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:
* ---------
* tftlib_api.h
*
* Project:
* --------
* MOLY
*
* Description:
* ------------
* TFT library API header file
*
* Author:
* -------
* -------
*
* ==========================================================================
* $Log$
*
* 08 12 2020 terence.kuo
* [MOLY00557318] [MT6875][Margaux][Q0][R3][MP6][SQC][Internal][WW FT][China][Quzhou][5GMM][MDST][SWIFT][S][CMCC+Invalid][Error times:1]System API Dump,1165,29,99,/data/vendor/core/,1,,mtkrild:AT command pending too long. assert!!! AT cmd: EAPNACT.timer: 900000ms
* . Provide a new API which constructs context for default bearer without tft to TCM.
*
* 03 09 2020 terence.kuo
* [MOLY00503923] [MT6885][Petrus][MP2][Ericsson][IODT][SA FullStack][Kista][5G] UE crash: [1][core1,vpe0,tc0(vpe3)] Fatal Error (0x823, 0x100, 0xcccccccc) - URR
*
* . Create a uniform api to free control buffers allocated for packet filter action list.
*
* 09 04 2019 terence.kuo
* [MOLY00434754] Upgrade CGTFT to support 5GC
*
* . Update CGTFT behaviors in tftlib.
*
* 03 26 2019 jeffery.chen
* [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
*
* [TFTLIB] interface part.
*
* 03 26 2019 jeffery.chen
* [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
*
* [TFTLIB] interface part.
*
* 12 14 2018 jeffery.chen
* [MOLY00372635] [VMOLY] L4/TCM/TFTLIB/VGSM phase2 check-in
*
* [TFTLIB] phase2 check-in.
*
* 09 14 2018 jeffery.chen
* [MOLY00306148] [NAS] pangu giant CR
*
* [TFTLIB] pass 1st NAS MoDIS IT.
*
* 08 17 2018 jeffery.chen
* [MOLY00306148] [NAS] pangu giant CR
* [TFTLIB] re-architecture.
*
* 08 17 2018 jeffery.chen
* [MOLY00306148] [NAS] pangu giant CR
*
* [TFTLIB] re-architecture.
*
* 10 17 2016 renhuang.liu
* [MOLY00205035] [TFTLIB] Memory management in TFT internal
* Resolve build error
* pcore/modem/interface/general/../../l4/tcm/tftlib/../common/tcm_context.h:559:29: fatal error: tcm_ugtcm_timer.h: No such file or directory
*
* 10 17 2016 renhuang.liu
* [MOLY00205035] [TFTLIB] Memory management in TFT internal
* Resolve the build error:
* pcore/modem/interface/general/../../l4/tcm/tftlib/../common/tcm_context.h:559:29: fatal error: tcm_ugtcm_timer.h: No such file or directory
*
* 10 16 2016 renhuang.liu
* [MOLY00205035] [TFTLIB] Memory management in TFT internal
* Resolve the error:
* pcore/modem/interface/general/tftlib_api.h:118:33:
* fatal error: tftlib_internal_api.h: No such file or directory
*
* 10 16 2016 renhuang.liu
* [MOLY00205035][TFTLIB] Memory management in TFT internal
*
* 09 26 2016 vera.yeh
* [MOLY00205116] [6293][ESM][TFTLIB] new feature/re-arch item porting to UMOLYA trunk
* [TFTLIB][OA] PS.DEV porting to UMOLYA.Trunk.
* 1. TFTLIB UT enhancement
* 2. UL_PF_CHECK
*
* 11 17 2014 jeffery.chen
* [MOLY00084634] [UMOLY][R10][R11] NAS check-in from 6291_DEV to UMOLY
* [R10][R11] NAS check-in from 6291_DEV to UMOLY
*
* 09 10 2014 jeffery.chen
* [MOLY00078264] [UMOLY][R10][R11] NAS check-in from CBr to 6291_DEV
* [R10][R11] NAS check-in from CBr to 6291_DEV
*
* 01 29 2014 joe.chang
* [MOLY00055334] [MT6290][SGLTE DSDS] New feature check-in MOLY
* TFTLIB check-in related interface
*
* 01 21 2014 wcpuser_integrator
* [MOLY00054475] SGLTE option rename
* .
*
* 12 25 2013 joe.chang
* [MOLY00051497] [MOLY][NRSPCA] NRSPCA phase 2 implementation
* [TFTLIB] Check-in related changes
*
* 11 18 2013 joe.chang
* [MOLY00045033] [MOLY][SM][ESM][TCM][TFT][Custom] NRSPCA(NISPCA) Network Requested/Initiated Secondary PDP Context Activation
* Check-in TFTLIB part
*
* 11 06 2013 joe.chang
* [MOLY00045302] [MT6290][LTE] TFTLIB API update for multi-context project
* Check-in TFTLIB part
*
* 10 31 2013 joe.chang
* [MOLY00044423] [MT6290] New TFT AT command development merge back to MOLY
* check in TFTLIB related change
*
* 07 19 2013 joe.chang
* [MOLY00030496] [MT6290][LTE MM][TFTLIB] ASSERT review trace & work around
* add trace error/warning & work around
*
* 06 10 2013 joe.chang
* [MOLY00025286] [MT7208][NW-UE SIM] [TC 10.8.1] AT+CGCMOD Error due to TFT compose issue
* TFTLIB modification for AT+CGTFT interpretation (support both difference set & full set)
*
* 11 07 2012 joe.chang
* [MOLY00005322] TATAKA merge to MOLY
* [Joe] TFTLIB part is check in done.
****************************************************************************/
#ifndef TFTLIB_API_H
#define TFTLIB_API_H
#include "l3_inc_enums.h"
#include "ps_public_utility.h" //for SBP __UL_PF_CHECK__
#include "tftlib_common_struct.h"
#include "tftlib_common_enum.h"
/* TFT Library API for VGSM */
tft_validate_result_enum tftlib_qr_length_decode( kal_uint32 aSimIndx_r,
tft_pdu_struct *apTftRaw_r,
kal_uint32 *p_qos_rule_length,
kal_uint8 *p_qfi);
tft_validate_result_enum tftlib_qr_decode( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
kal_uint8 aQosRuleId_r, /* 5G=QRI */
tft_info_struct *apTft_w, /* OUT */
tft_fail_action_enum *apFailAction_w, /* OUT */
tft_pdu_struct *apTftRaw_r, /* IN */
bearer_type_enum aBearerType_r,
tft_proc_dir_enum aProcDir_r,
tft_bearer_act_enum aBearerAct_r,
etft_enum aEtft_r);
kal_bool tftlib_set_applied_qr( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
kal_uint8 aQosFlowId_r, /* 5G=QFI */
kal_uint8 aQosRuleId_r, /* 5G=QRI */
tft_info_struct *apQosRule_r, /* IN */
bearer_type_enum aBearerType_r,
tft_proc_dir_enum aProcDir_r,
tft_bearer_act_enum aBearerAct_r,
pkt_filter_act_list_struct *apPfActList_w, /* OUT */
tft_deact_qr_list_struct *apDeactQrList_rw /* INOUT */
);
tftlib_qf_has_rule_enum tftlib_qf_has_any_rule( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
kal_uint8 aQosFlowId_r /* 5G=QFI */
);
tft_validate_result_enum tftlib_qrs_precheck( kal_uint32 aSimIndx_r,
tft_bearer_act_enum aBearerAct_r,
kal_uint16 no_auth_qos_rules,
kal_uint8 *auth_qos_rules,
tft_fail_action_enum *apFailAction_w /* OUT */
);
kal_bool tftlib_set_rq_timer( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
kal_uint32 t3583);
kal_bool tftlib_rqos_set_applied_qr(kal_uint32 aSimIndx_r,
kal_uint8 psi, /* IN */
kal_uint8 qfi, /* IN */
kal_uint8 rule_idx, /* IN */
pkt_filter_act_enum action, /* IN */
pkt_filter_struct* p_pf, /* IN */
pkt_filter_act_list_struct *apPfActList_w /* OUT */
);
kal_bool tftlib_qr_get_pf_act_list( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
pkt_filter_act_list_struct *apPfActList_w, /* OUT */
kal_uint8 *pNextQri /* INOUT */
);
kal_bool tftlib_tft_get_pf_act_list(kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r, /* OUT */
pkt_filter_act_list_struct *apPfActList_w /* OUT */
);
kal_bool tftlib_set_applied_tft_by_ebi( kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r,
tft_info_struct *apTft_r,
bearer_type_enum aBearerType_r,
tft_proc_dir_enum aProcDir_r,
tft_bearer_act_enum aBearerAct_r,
pkt_filter_act_list_struct *apPfActList_w,
tft_deact_bearer_list_struct *apDeactBearerList_w,
rat_ind_enum aRat_r);
kal_bool tftlib_update_deact_qr_list_to_del_qf( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* 5G=PSI */
kal_uint8 aQosFlowId_r, /* 5G=QFI */
tft_deact_qr_list_struct *apDeactQrList_rw /* INOUT */
);
/* TFT Library API for SM/ESM */
tft_validate_result_enum tftlib_tft_decode( kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r,
tft_info_struct *apTft_w, /*dst*/
tft_pdu_struct *apTftRaw_r, /*src*/
bearer_type_enum aBearerType_r,
tft_proc_dir_enum aProcDir_r,
tft_bearer_act_enum aBearerAct_r,
bcm_enum aBcm_r,
etft_enum aEtft_r,
rat_ind_enum aRat_r);
kal_bool tftlib_tft_encode( kal_uint32 aSimIndx_r,
tft_pdu_struct *apTftRaw_w, /*dst*/
tft_info_struct *apTft_r, /*src*/
etft_enum aEtft_r);
kal_bool tftlib_tft_validate(kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r,
bearer_type_enum aBearerType_r,
bcm_enum aBcm_r, // 20131106_Joe: Added to support 2/3G 'MS/NW'
rat_ind_enum aRat_r);
kal_bool tftlib_tft_dir_extract( kal_uint32 aSimIndx_r,
tft_info_struct *apSrcTft_r,
tft_info_struct *apDstTft_w,
pf_direction_enum aPfDir_r);
kal_bool tftlib_tft_own_enty_exst_chk( kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r,
pf_own_entity_enum aPfOwnEntity_r);
kal_bool tftlib_del_applied_qr_by_psi( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r /* IN */
);
/**
* OUTPUT: *qfi = QFI which QRI belong to.
* = QFI_NOT_FOUND when QRI is already deleted.
*/
kal_bool tftlib_del_applied_qr_by_psi_qri( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* IN */
kal_uint8 qri, /* IN */
kal_uint8 *qfi /* OUT */
);
/**
* pNextQri: as INPUT, SM set NULL_QRI when start to get_pf_act_list
* as OUTPUT, TFTLIB set NULL_QRI when finish get_pf_act_list.
*/
kal_bool tftlib_del_applied_qr_by_psi_qfi( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r, /* IN */
kal_uint8 qfi, /* IN */
pkt_filter_act_list_struct *apPfActList_w, /* OUT */
kal_uint8 *pNextQri /* INOUT */
);
kal_bool tftlib_del_applied_tft_by_ebi( kal_uint32 aSimIndx_r,
kal_uint8 aBearerId_r /* IN */
);
void tftlib_backup_applied_qr(kal_uint32 aSimIndx_r);
void tftlib_restore_applied_qr(kal_uint32 aSimIndx_r);
/* TFT Library API for TCM */
kal_bool tftlib_compose_and_encode_qrs_to_nw( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r,
kal_uint8 aQosFlowId_r,
kal_uint8 aCid_r,
qrs_raw_struct *apQrsRaw_w, /* OUT */
tft_compose_type_enum aTftComposeType_r,
bearer_type_enum aBearerType_r,
vg_act_enum vgAction);
kal_bool tftlib_set_applied_tft( kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_struct *apTft_r,
tft_proc_dir_enum aProcDir_r,
tft_bearer_act_enum aBearerAct_r,
pkt_filter_act_list_struct *apPfActList_w,
tft_deact_bearer_list_struct *apDeactBearerList_w,
rat_ind_enum aRat_r);
kal_bool tftlib_compose_tft_to_nw( kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_struct *apTft_w,
tft_compose_type_enum aTftComposeType_r,
bearer_type_enum aBearerType_r,
tft_bearer_act_enum aBearerAct_r,
bcm_enum aBcm_r,
rat_ind_enum aRat_r);
void tftlib_del_tft( kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_ctxt_type_enum aTftCtxtType_r);
kal_bool tftlib_chk_bearer_reusability(kal_uint32 aSimIndx_r,
kal_uint8 cid,
bearer_type_enum bearer_type,
rat_ind_enum rat);
kal_bool tftlib_compose_and_encode_deact_qr_list_to_nw( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r,
tft_deact_qr_list_struct *deact_qr_list, /* IN */
qrs_raw_struct *apQrsRaw_w /* OUT */
);
kal_bool tftlib_set_cid_for_applied_qr( kal_uint32 aSimIndx_r,
kal_uint8 aPduSessionId_r,
kal_uint8 aQosFlowId_r,
kal_uint8 aCid_r);
kal_bool tftlib_set_cid_for_applied_tft( kal_uint32 sim_idx, kal_uint8 ebi, kal_uint8 cid);
kal_bool tftlib_construct_context_for_default_bearer_wo_tft(kal_uint32 sim_idx, kal_uint8 ebi);
/* TFT Library API for L4C */
kal_bool tftlib_set_user_defined_tft(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_struct *apTft_r,
rat_ind_enum aRat_r,
etft_enum aEtft_r); // +CGTFT (set-mode)
kal_bool tftlib_get_user_defined_tft(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_list_struct *p_tft_list); // +CGTFT (read-mode)
kal_bool tftlib_get_applied_tft(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_list_struct *p_tft_list); // +CGTFTRDP
kal_bool tftlib_get_applied_qr (kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
tft_info_list_struct *p_tft_list); // +CGTFTRDP
// TODO: OPTIMIZE stack size
kal_bool tftlib_set_usr_delpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
kal_bool qri_present,
kal_uint8 qri,
kal_uint8 aPfId_r,
rat_ind_enum aRat_r); // +EGDELPF (set-mode)
kal_int32 tftlib_get_usr_delpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
kal_bool qri_present,
kal_uint8 qri,
kal_uint8 *apPfLst_w); // +EGDELPF (read-mode)
void tftlib_clear_usr_delpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r); // +EGDELPF (undefine-mode)
kal_bool tftlib_set_usr_lnkpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
kal_uint8 aLnkPfId_r,
rat_ind_enum aRat_r); // +EGLNKPF (set-mode)
kal_int32 tftlib_get_usr_lnkpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r,
kal_uint8 *apLnkPfLst_w); // +EGLNKPF (read-mode)
void tftlib_clear_usr_lnkpf(kal_uint32 aSimIndx_r,
kal_uint8 aCid_r); // +EGLNKPF (undefine-mode)
void tftlib_free_pf_act_list_ctrl_buff(pkt_filter_act_list_struct *apPfActList_w);
kal_bool tftlib_tft_context_init(void);
kal_bool tftlib_tft_context_reset(void);
#endif /* TFTLIB_API_H */