blob: 8f5954f36c824639070a297057e8f5845785bd95 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2012
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*******************************************************************************
37 * Filename:
38 * ---------
39 * tftlib_api.h
40 *
41 * Project:
42 * --------
43 * MOLY
44 *
45 * Description:
46 * ------------
47 * TFT library API header file
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 * ==========================================================================
54 * $Log$
55 *
56 * 08 12 2020 terence.kuo
57 * [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
58 * . Provide a new API which constructs context for default bearer without tft to TCM.
59 *
60 * 03 09 2020 terence.kuo
61 * [MOLY00503923] [MT6885][Petrus][MP2][Ericsson][IODT][SA FullStack][Kista][5G] UE crash: [1][core1,vpe0,tc0(vpe3)] Fatal Error (0x823, 0x100, 0xcccccccc) - URR
62 *
63 * . Create a uniform api to free control buffers allocated for packet filter action list.
64 *
65 * 09 04 2019 terence.kuo
66 * [MOLY00434754] Upgrade CGTFT to support 5GC
67 *
68 * . Update CGTFT behaviors in tftlib.
69 *
70 * 03 26 2019 jeffery.chen
71 * [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
72 *
73 * [TFTLIB] interface part.
74 *
75 * 03 26 2019 jeffery.chen
76 * [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
77 *
78 * [TFTLIB] interface part.
79 *
80 * 12 14 2018 jeffery.chen
81 * [MOLY00372635] [VMOLY] L4/TCM/TFTLIB/VGSM phase2 check-in
82 *
83 * [TFTLIB] phase2 check-in.
84 *
85 * 09 14 2018 jeffery.chen
86 * [MOLY00306148] [NAS] pangu giant CR
87 *
88 * [TFTLIB] pass 1st NAS MoDIS IT.
89 *
90 * 08 17 2018 jeffery.chen
91 * [MOLY00306148] [NAS] pangu giant CR
92 * [TFTLIB] re-architecture.
93 *
94 * 08 17 2018 jeffery.chen
95 * [MOLY00306148] [NAS] pangu giant CR
96 *
97 * [TFTLIB] re-architecture.
98 *
99 * 10 17 2016 renhuang.liu
100 * [MOLY00205035] [TFTLIB] Memory management in TFT internal
101 * Resolve build error
102 * pcore/modem/interface/general/../../l4/tcm/tftlib/../common/tcm_context.h:559:29: fatal error: tcm_ugtcm_timer.h: No such file or directory
103 *
104 * 10 17 2016 renhuang.liu
105 * [MOLY00205035] [TFTLIB] Memory management in TFT internal
106 * Resolve the build error:
107 * pcore/modem/interface/general/../../l4/tcm/tftlib/../common/tcm_context.h:559:29: fatal error: tcm_ugtcm_timer.h: No such file or directory
108 *
109 * 10 16 2016 renhuang.liu
110 * [MOLY00205035] [TFTLIB] Memory management in TFT internal
111 * Resolve the error:
112 * pcore/modem/interface/general/tftlib_api.h:118:33:
113 * fatal error: tftlib_internal_api.h: No such file or directory
114 *
115 * 10 16 2016 renhuang.liu
116 * [MOLY00205035][TFTLIB] Memory management in TFT internal
117 *
118 * 09 26 2016 vera.yeh
119 * [MOLY00205116] [6293][ESM][TFTLIB] new feature/re-arch item porting to UMOLYA trunk
120 * [TFTLIB][OA] PS.DEV porting to UMOLYA.Trunk.
121 * 1. TFTLIB UT enhancement
122 * 2. UL_PF_CHECK
123 *
124 * 11 17 2014 jeffery.chen
125 * [MOLY00084634] [UMOLY][R10][R11] NAS check-in from 6291_DEV to UMOLY
126 * [R10][R11] NAS check-in from 6291_DEV to UMOLY
127 *
128 * 09 10 2014 jeffery.chen
129 * [MOLY00078264] [UMOLY][R10][R11] NAS check-in from CBr to 6291_DEV
130 * [R10][R11] NAS check-in from CBr to 6291_DEV
131 *
132 * 01 29 2014 joe.chang
133 * [MOLY00055334] [MT6290][SGLTE DSDS] New feature check-in MOLY
134 * TFTLIB check-in related interface
135 *
136 * 01 21 2014 wcpuser_integrator
137 * [MOLY00054475] SGLTE option rename
138 * .
139 *
140 * 12 25 2013 joe.chang
141 * [MOLY00051497] [MOLY][NRSPCA] NRSPCA phase 2 implementation
142 * [TFTLIB] Check-in related changes
143 *
144 * 11 18 2013 joe.chang
145 * [MOLY00045033] [MOLY][SM][ESM][TCM][TFT][Custom] NRSPCA(NISPCA) Network Requested/Initiated Secondary PDP Context Activation
146 * Check-in TFTLIB part
147 *
148 * 11 06 2013 joe.chang
149 * [MOLY00045302] [MT6290][LTE] TFTLIB API update for multi-context project
150 * Check-in TFTLIB part
151 *
152 * 10 31 2013 joe.chang
153 * [MOLY00044423] [MT6290] New TFT AT command development merge back to MOLY
154 * check in TFTLIB related change
155 *
156 * 07 19 2013 joe.chang
157 * [MOLY00030496] [MT6290][LTE MM][TFTLIB] ASSERT review trace & work around
158 * add trace error/warning & work around
159 *
160 * 06 10 2013 joe.chang
161 * [MOLY00025286] [MT7208][NW-UE SIM] [TC 10.8.1] AT+CGCMOD Error due to TFT compose issue
162 * TFTLIB modification for AT+CGTFT interpretation (support both difference set & full set)
163 *
164 * 11 07 2012 joe.chang
165 * [MOLY00005322] TATAKA merge to MOLY
166 * [Joe] TFTLIB part is check in done.
167 ****************************************************************************/
168
169#ifndef TFTLIB_API_H
170#define TFTLIB_API_H
171
172#include "l3_inc_enums.h"
173#include "ps_public_utility.h" //for SBP __UL_PF_CHECK__
174
175#include "tftlib_common_struct.h"
176#include "tftlib_common_enum.h"
177
178
179/* TFT Library API for VGSM */
180tft_validate_result_enum tftlib_qr_length_decode( kal_uint32 aSimIndx_r,
181 tft_pdu_struct *apTftRaw_r,
182 kal_uint32 *p_qos_rule_length,
183 kal_uint8 *p_qfi);
184
185tft_validate_result_enum tftlib_qr_decode( kal_uint32 aSimIndx_r,
186 kal_uint8 aPduSessionId_r, /* 5G=PSI */
187 kal_uint8 aQosRuleId_r, /* 5G=QRI */
188 tft_info_struct *apTft_w, /* OUT */
189 tft_fail_action_enum *apFailAction_w, /* OUT */
190 tft_pdu_struct *apTftRaw_r, /* IN */
191 bearer_type_enum aBearerType_r,
192 tft_proc_dir_enum aProcDir_r,
193 tft_bearer_act_enum aBearerAct_r,
194 etft_enum aEtft_r);
195
196kal_bool tftlib_set_applied_qr( kal_uint32 aSimIndx_r,
197 kal_uint8 aPduSessionId_r, /* 5G=PSI */
198 kal_uint8 aQosFlowId_r, /* 5G=QFI */
199 kal_uint8 aQosRuleId_r, /* 5G=QRI */
200 tft_info_struct *apQosRule_r, /* IN */
201 bearer_type_enum aBearerType_r,
202 tft_proc_dir_enum aProcDir_r,
203 tft_bearer_act_enum aBearerAct_r,
204 pkt_filter_act_list_struct *apPfActList_w, /* OUT */
205 tft_deact_qr_list_struct *apDeactQrList_rw /* INOUT */
206 );
207
208tftlib_qf_has_rule_enum tftlib_qf_has_any_rule( kal_uint32 aSimIndx_r,
209 kal_uint8 aPduSessionId_r, /* 5G=PSI */
210 kal_uint8 aQosFlowId_r /* 5G=QFI */
211 );
212
213tft_validate_result_enum tftlib_qrs_precheck( kal_uint32 aSimIndx_r,
214 tft_bearer_act_enum aBearerAct_r,
215 kal_uint16 no_auth_qos_rules,
216 kal_uint8 *auth_qos_rules,
217 tft_fail_action_enum *apFailAction_w /* OUT */
218 );
219
220kal_bool tftlib_set_rq_timer( kal_uint32 aSimIndx_r,
221 kal_uint8 aPduSessionId_r, /* 5G=PSI */
222 kal_uint32 t3583);
223
224kal_bool tftlib_rqos_set_applied_qr(kal_uint32 aSimIndx_r,
225 kal_uint8 psi, /* IN */
226 kal_uint8 qfi, /* IN */
227 kal_uint8 rule_idx, /* IN */
228 pkt_filter_act_enum action, /* IN */
229 pkt_filter_struct* p_pf, /* IN */
230 pkt_filter_act_list_struct *apPfActList_w /* OUT */
231 );
232
233kal_bool tftlib_qr_get_pf_act_list( kal_uint32 aSimIndx_r,
234 kal_uint8 aPduSessionId_r, /* 5G=PSI */
235 pkt_filter_act_list_struct *apPfActList_w, /* OUT */
236 kal_uint8 *pNextQri /* INOUT */
237 );
238
239kal_bool tftlib_tft_get_pf_act_list(kal_uint32 aSimIndx_r,
240 kal_uint8 aBearerId_r, /* OUT */
241 pkt_filter_act_list_struct *apPfActList_w /* OUT */
242 );
243
244kal_bool tftlib_set_applied_tft_by_ebi( kal_uint32 aSimIndx_r,
245 kal_uint8 aBearerId_r,
246 tft_info_struct *apTft_r,
247 bearer_type_enum aBearerType_r,
248 tft_proc_dir_enum aProcDir_r,
249 tft_bearer_act_enum aBearerAct_r,
250 pkt_filter_act_list_struct *apPfActList_w,
251 tft_deact_bearer_list_struct *apDeactBearerList_w,
252 rat_ind_enum aRat_r);
253
254kal_bool tftlib_update_deact_qr_list_to_del_qf( kal_uint32 aSimIndx_r,
255 kal_uint8 aPduSessionId_r, /* 5G=PSI */
256 kal_uint8 aQosFlowId_r, /* 5G=QFI */
257 tft_deact_qr_list_struct *apDeactQrList_rw /* INOUT */
258 );
259
260/* TFT Library API for SM/ESM */
261tft_validate_result_enum tftlib_tft_decode( kal_uint32 aSimIndx_r,
262 kal_uint8 aBearerId_r,
263 tft_info_struct *apTft_w, /*dst*/
264 tft_pdu_struct *apTftRaw_r, /*src*/
265 bearer_type_enum aBearerType_r,
266 tft_proc_dir_enum aProcDir_r,
267 tft_bearer_act_enum aBearerAct_r,
268 bcm_enum aBcm_r,
269 etft_enum aEtft_r,
270 rat_ind_enum aRat_r);
271
272kal_bool tftlib_tft_encode( kal_uint32 aSimIndx_r,
273 tft_pdu_struct *apTftRaw_w, /*dst*/
274 tft_info_struct *apTft_r, /*src*/
275 etft_enum aEtft_r);
276
277kal_bool tftlib_tft_validate(kal_uint32 aSimIndx_r,
278 kal_uint8 aBearerId_r,
279 bearer_type_enum aBearerType_r,
280 bcm_enum aBcm_r, // 20131106_Joe: Added to support 2/3G 'MS/NW'
281 rat_ind_enum aRat_r);
282
283kal_bool tftlib_tft_dir_extract( kal_uint32 aSimIndx_r,
284 tft_info_struct *apSrcTft_r,
285 tft_info_struct *apDstTft_w,
286 pf_direction_enum aPfDir_r);
287
288kal_bool tftlib_tft_own_enty_exst_chk( kal_uint32 aSimIndx_r,
289 kal_uint8 aBearerId_r,
290 pf_own_entity_enum aPfOwnEntity_r);
291
292
293kal_bool tftlib_del_applied_qr_by_psi( kal_uint32 aSimIndx_r,
294 kal_uint8 aPduSessionId_r /* IN */
295 );
296
297/**
298 * OUTPUT: *qfi = QFI which QRI belong to.
299 * = QFI_NOT_FOUND when QRI is already deleted.
300 */
301kal_bool tftlib_del_applied_qr_by_psi_qri( kal_uint32 aSimIndx_r,
302 kal_uint8 aPduSessionId_r, /* IN */
303 kal_uint8 qri, /* IN */
304 kal_uint8 *qfi /* OUT */
305 );
306
307/**
308 * pNextQri: as INPUT, SM set NULL_QRI when start to get_pf_act_list
309 * as OUTPUT, TFTLIB set NULL_QRI when finish get_pf_act_list.
310 */
311kal_bool tftlib_del_applied_qr_by_psi_qfi( kal_uint32 aSimIndx_r,
312 kal_uint8 aPduSessionId_r, /* IN */
313 kal_uint8 qfi, /* IN */
314 pkt_filter_act_list_struct *apPfActList_w, /* OUT */
315 kal_uint8 *pNextQri /* INOUT */
316 );
317
318kal_bool tftlib_del_applied_tft_by_ebi( kal_uint32 aSimIndx_r,
319 kal_uint8 aBearerId_r /* IN */
320 );
321
322void tftlib_backup_applied_qr(kal_uint32 aSimIndx_r);
323
324void tftlib_restore_applied_qr(kal_uint32 aSimIndx_r);
325
326
327/* TFT Library API for TCM */
328kal_bool tftlib_compose_and_encode_qrs_to_nw( kal_uint32 aSimIndx_r,
329 kal_uint8 aPduSessionId_r,
330 kal_uint8 aQosFlowId_r,
331 kal_uint8 aCid_r,
332 qrs_raw_struct *apQrsRaw_w, /* OUT */
333 tft_compose_type_enum aTftComposeType_r,
334 bearer_type_enum aBearerType_r,
335 vg_act_enum vgAction);
336
337kal_bool tftlib_set_applied_tft( kal_uint32 aSimIndx_r,
338 kal_uint8 aCid_r,
339 tft_info_struct *apTft_r,
340 tft_proc_dir_enum aProcDir_r,
341 tft_bearer_act_enum aBearerAct_r,
342 pkt_filter_act_list_struct *apPfActList_w,
343 tft_deact_bearer_list_struct *apDeactBearerList_w,
344 rat_ind_enum aRat_r);
345
346kal_bool tftlib_compose_tft_to_nw( kal_uint32 aSimIndx_r,
347 kal_uint8 aCid_r,
348 tft_info_struct *apTft_w,
349 tft_compose_type_enum aTftComposeType_r,
350 bearer_type_enum aBearerType_r,
351 tft_bearer_act_enum aBearerAct_r,
352 bcm_enum aBcm_r,
353 rat_ind_enum aRat_r);
354
355void tftlib_del_tft( kal_uint32 aSimIndx_r,
356 kal_uint8 aCid_r,
357 tft_ctxt_type_enum aTftCtxtType_r);
358
359kal_bool tftlib_chk_bearer_reusability(kal_uint32 aSimIndx_r,
360 kal_uint8 cid,
361 bearer_type_enum bearer_type,
362 rat_ind_enum rat);
363
364kal_bool tftlib_compose_and_encode_deact_qr_list_to_nw( kal_uint32 aSimIndx_r,
365 kal_uint8 aPduSessionId_r,
366 tft_deact_qr_list_struct *deact_qr_list, /* IN */
367 qrs_raw_struct *apQrsRaw_w /* OUT */
368 );
369kal_bool tftlib_set_cid_for_applied_qr( kal_uint32 aSimIndx_r,
370 kal_uint8 aPduSessionId_r,
371 kal_uint8 aQosFlowId_r,
372 kal_uint8 aCid_r);
373
374kal_bool tftlib_set_cid_for_applied_tft( kal_uint32 sim_idx, kal_uint8 ebi, kal_uint8 cid);
375
376kal_bool tftlib_construct_context_for_default_bearer_wo_tft(kal_uint32 sim_idx, kal_uint8 ebi);
377
378/* TFT Library API for L4C */
379
380kal_bool tftlib_set_user_defined_tft(kal_uint32 aSimIndx_r,
381 kal_uint8 aCid_r,
382 tft_info_struct *apTft_r,
383 rat_ind_enum aRat_r,
384 etft_enum aEtft_r); // +CGTFT (set-mode)
385
386kal_bool tftlib_get_user_defined_tft(kal_uint32 aSimIndx_r,
387 kal_uint8 aCid_r,
388 tft_info_list_struct *p_tft_list); // +CGTFT (read-mode)
389
390kal_bool tftlib_get_applied_tft(kal_uint32 aSimIndx_r,
391 kal_uint8 aCid_r,
392 tft_info_list_struct *p_tft_list); // +CGTFTRDP
393
394kal_bool tftlib_get_applied_qr (kal_uint32 aSimIndx_r,
395 kal_uint8 aCid_r,
396 tft_info_list_struct *p_tft_list); // +CGTFTRDP
397// TODO: OPTIMIZE stack size
398
399kal_bool tftlib_set_usr_delpf(kal_uint32 aSimIndx_r,
400 kal_uint8 aCid_r,
401 kal_bool qri_present,
402 kal_uint8 qri,
403 kal_uint8 aPfId_r,
404 rat_ind_enum aRat_r); // +EGDELPF (set-mode)
405
406kal_int32 tftlib_get_usr_delpf(kal_uint32 aSimIndx_r,
407 kal_uint8 aCid_r,
408 kal_bool qri_present,
409 kal_uint8 qri,
410 kal_uint8 *apPfLst_w); // +EGDELPF (read-mode)
411
412void tftlib_clear_usr_delpf(kal_uint32 aSimIndx_r,
413 kal_uint8 aCid_r); // +EGDELPF (undefine-mode)
414
415kal_bool tftlib_set_usr_lnkpf(kal_uint32 aSimIndx_r,
416 kal_uint8 aCid_r,
417 kal_uint8 aLnkPfId_r,
418 rat_ind_enum aRat_r); // +EGLNKPF (set-mode)
419
420kal_int32 tftlib_get_usr_lnkpf(kal_uint32 aSimIndx_r,
421 kal_uint8 aCid_r,
422 kal_uint8 *apLnkPfLst_w); // +EGLNKPF (read-mode)
423
424void tftlib_clear_usr_lnkpf(kal_uint32 aSimIndx_r,
425 kal_uint8 aCid_r); // +EGLNKPF (undefine-mode)
426
427void tftlib_free_pf_act_list_ctrl_buff(pkt_filter_act_list_struct *apPfActList_w);
428
429kal_bool tftlib_tft_context_init(void);
430kal_bool tftlib_tft_context_reset(void);
431#endif /* TFTLIB_API_H */