blob: 3bb91df572b54bcf1efa25969375310c95e79452 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
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 * upcm.h
40 *
41 * Project:
42 * --------
43 * MOLY
44 *
45 * Description:
46 * ------------
47 *
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 *
54 * ==========================================================================
55 * $Log$
56 *
rjw2b1408e2022-12-19 11:19:29 +080057 * 11 17 2022 stun.wu
58 * [MOLY00672250] ?????? 1396774: ?????LTE to SA?Reg req????uplink data status
59 *
60 * .
61 *
rjw6c1fd8f2022-11-30 14:33:01 +080062 * 11 04 2021 stun.wu
63 * [MOLY00678218] [Gen97][4N SQC-Lite][W2124][W2128][Internal FT][Post_MP7][Guangzhou][MT6877][Montrose][Feature_Enhance_Test]CU+CMCC_SA+SA_Temp_Data_Switch_On, SIM1 MT call failed(1/10)
64 *
65 * .
66 *
67 * 11 16 2020 stun.wu
68 * [MOLY00591799] [MT6880][Colgin][New feature] Add New ICDs CM_IP_DL_STATs/CM_IP_UL_STATs
69 *
70 * .
71 *
72 * 08 13 2020 ken.li
73 * [MOLY00543497] [MT6873][Margaux][R0][MP5][in-house FTA][LTE][7.1.1.2]enable volte fail
74 *
75 * UPCM TESTMODE drops non-loopback data for obtaining IP address case (SWRD)
76 *
77 * 05 07 2020 andy-wc.chang
78 * [MOLY00506312] [Titan][IPC][IMS] IPC_IMS_INVITE_FLUSH (0x1C) - EL2 dev
79 * [VMOLY][TITAN] ipc flush command porting - setting3
80 *
81 * 04 15 2020 chin-wei.hsu
82 * [MOLY00509991] [Gen97] monitor DL paging for NR RAT
83 * [RD] monitor DL paging for NR RAT.
84 *
85 * 03 10 2020 chin-wei.hsu
86 * [MOLY00503427] [MT6885][Petrus][TMO-US][WWFT][Seattle][5G4G][NSN][MDST][SWIFT][Assert] file:mcu/middleware/hif/ipcore/src/ipc_filter.c line:3815
87 * [RD domain] makefile+header.
88 *
89 * 02 26 2020 willy-wj.chen
90 * [MOLY00501981] [Gen97][UPCM] TMO-US F4L data performance patch sync from Gen93
91 *
92 * Fix build error for certain projects.
93 *
94 * 02 26 2020 willy-wj.chen
95 * [MOLY00501981] [Gen97][UPCM] TMO-US F4L data performance patch sync from Gen93
96 * [UPCM] put small UDP packet into pri-SIT upon channel lock.
97 *
98 * 12 06 2019 tc.chang
99 * [MOLY00463231] [GEN97][GWSD+] patchback from 1001dev.
100 *
101 * 12 05 2019 tc.chang
102 * [MOLY00446861] [Gen97][Code Sync] [B190414-819]¤ýªÌ?Ä£´å??µ{¥d?¡AÊI?©µ?450 (?±`¥X?¡A©Î?¤é¦h¦¸Î`?) According to data type to release HPS for paging.
103 *
104 * 10 30 2019 tc.chang
105 * [MOLY00426963] [Gen97][NWSIM][5G][SA][GCF TEST] TC 8.1.1.2.3 : UE fails to send RRC Setup Request at test step 7..
106 *
107 * 09 23 2019 tc.chang
108 * [MOLY00427068] [Gen97][UPCM][RATDM][ENPDCP] Dynamic SIT.
109 *
110 * 09 06 2019 chin-wei.hsu
111 * [MOLY00437199] [MT6297][ICD][EM] fix wrong values of PDCP throughput and IP throughput
112 *
113 * [ICD] fix wrong value.
114 *
115 * 05 15 2019 tc.chang
116 * [MOLY00406246] [Gaming][KoG][L2] Gen97 Gaming enhancement.
117 *
118 * 05 09 2019 tc.chang
119 * [MOLY00404770] [Gen97] Sync Gen95 UMOLYE patch.
120 * RBRQ, USIR, fake A2
121 *
122 * 04 19 2019 tc.chang
123 * [MOLY00399993] [Gen97][VMOLY] interworking withN26 features.
124 *
125 * 04 16 2019 tc.chang
126 * [MOLY00395158] [Gen97] Sync Gen95 UMOLYE bug fix
127 * [UPCM] ICD and some bug fix.
128 *
129 * 01 28 2019 tc.chang
130 * [MOLY00381488] [Gen97] [MCF] MCF porting to VMOLY.
131 *
132 * 10 16 2018 tc.chang
133 * [MOLY00356444] [VMOLY] Bug fix and add UT cases
134 * Coverity fix.
135 *
136 * 10 08 2018 tc.chang
137 * [MOLY00356444] [VMOLY] Bug fix and add UT cases.
138 *
139 * 09 18 2018 tc.chang
140 * [MOLY00345990] [VMOLY] Code sync.
141 *
142 * 09 14 2018 tc.chang
143 * [MOLY00345990] [VMOLY] Code sync
144 * Rollback first. Fix build error locally
145 *
146 * 09 07 2018 tc.chang
147 * [MOLY00351053] [VMOLY] Compile option clean up
148 * .
149 *
150 * 08 01 2018 chin-wei.hsu
151 * [MOLY00343584] [MT6295][UPCM] log reduction
152 * [UPCM] log reduction.
153 *
154 * 08 01 2018 steve.kao
155 * [MOLY00343532] [6295] EL2 log reduction: EPDCP parts
156 * EPDCP LOG REDUCTION.
157 *
158 * 07 12 2018 chin-wei.hsu
159 * [MOLY00337991] [Gemini][L+L][Gen95] A2 trigger network release
160 * [UPCM][fake A2] provide data prediction.
161 *
162 * 06 14 2018 timothy.yao
163 * [MOLY00333176] [ICD] stage1+stage2 ICD UMOLYE CBr patch back to LR13.R0
164 * [ICD][UPCM]
165 *
166 * 06 11 2018 timothy.yao
167 * [MOLY00319373] [MT6295] recommended bit rate feature
168 * recommended bit rate feature: upcm design (merged from 5764964)
169 *
170 * 05 15 2018 chin-wei.hsu
171 * [MOLY00326156] [EIGER][MT3967][RDIT][Phone][NVIOT][FDD][MVTVD][4G][MIMO-OLSM-TM3][7.2.3.7.12]UE ping failed after re-selection from WCDMA
172 * [UPCM] get PDN by EBI.
173 *
174 * 03 08 2018 chin-wei.hsu
175 * [MOLY00310680] [UMOLYE][Gen95] Add debug assert to compare HW result and SW result
176 * [UMOLYE] check HW HPC result.
177 *
178 * 03 02 2018 chin-wei.hsu
179 * [MOLY00310911] [EIGER][MT3967][RDIT][EVB][LTG][MD_Pre-Sanity][SIM1:CMCC][SIM2:NONE][7.2]SIM1 MT VoLTE call EE
180 *
181 * [UMOLYE] remove debug assert due to coding defect
182 *
183 * 03 02 2018 chin-wei.hsu
184 * [MOLY00310829] 1237333¡G[IN-FT_DC066] [R2_EVT1] [L+L] [Free_Test] [Kochi] DUT takes approx. 30 sec time to register on IMS after Emergency call failed with JIO operator.
185 * [UMOLYE] queue IPv6 RS from IMS EBI.
186 *
187 * 03 01 2018 chin-wei.hsu
188 * [MOLY00310680] [UMOLYE][Gen95] Add debug assert to compare HW result and SW result
189 * [UMOLYE] add debug assert to check IPF.
190 *
191 * 02 21 2018 chin-wei.hsu
192 * [MOLY00309099] [PVT must resolve] ·L«H??¥]ºC?? for Gen95
193 * [UMOLYE][UPCM-307] internal feature.
194 *
195 * 01 09 2018 chin-wei.hsu
196 * [MOLY00299863] [PVT must resolve] ·L«H??¥]ºC?? - keep alive
197 *
198 * [TRUNK][UPCM][RATDM] UPCM_FEATURE_301.
199 *
200 * 01 09 2018 chin-wei.hsu
201 * [MOLY00299863] [PVT must resolve] ·L«H??¥]ºC?? - keep alive
202 * [TRUNK][UPCM][RATDM] UPCM_FEATURE_301.
203 *
204 * 08 29 2017 chin-wei.hsu
205 * [MOLY00274358] [6293] Adapt UPCM Throughput EM to 6293 DL architecture.
206 * [TRUNK] DL throughput for EM.
207 *
208 * 08 23 2017 chin-wei.hsu
209 * [MOLY00273240] [Gen93] New API to set forced SW path to all bearers at once
210 * [TRUNK] forced sw path on/off all
211 *
212 * 08 09 2017 chin-wei.hsu
213 * [MOLY00269663] [Gen 93][LR11.MP5 to UMOLYA code sync] UPCM provides IMS statistics for NWSEL
214 * [TRUNK] UPCM add ims ebi tx/rx statistic query API.
215 *
216 * 07 06 2017 timothy.yao
217 * [MOLY00261868] [6293]UL SIT new handling
218 * new SIT handling (to TRUNK)
219 * - UPCM / RATDM.
220 *
221 * 04 07 2017 timothy.yao
222 * [MOLY00240413] [BIANCO][MT6763][RDIT][PHONE][Overnight][HQ][MTBF][Lab][Ericsson][ASSERT] file:mcu/common/driver/dpcopro/src/dpcopro_mmu_drv.c line:1200
223 * bugfix: IRAT HO data handling. (TRUNK only)
224 *
225 * - if RAT protocol not handled, target RAT can perform UL.
226 * --> UPCM trigger RATDM. (new)
227 *
228 * - if RAT protocol handled, source RAT shall perform rollback.
229 * --> then UPCM can trigger RATDM. (exist)
230 *
231 * 03 23 2017 chin-wei.hsu
232 * [MOLY00237294] [MT6293][UPCM] Forced SW path
233 * [trunk] Forced SW path for EBI/PDN.
234 *
235 * 03 22 2017 steve.kao
236 * [MOLY00230062] [UMOLYA] M-PS related interface changes for UPCM, RATDM, and EPDCP
237 *
238 * [UMOLYA][TRUNK][UPCM][RATDM][M-PS] Add "protocol_idx" for upcm_get_pending_ul_data_status().
239 *
240 * 03 22 2017 steve.kao
241 * [MOLY00230062] [UMOLYA] M-PS related interface changes for UPCM, RATDM, and EPDCP
242 *
243 * [UMOLYA][UMOLYA][UPCM][M-PS] Add "protocol_idx" into the interface of upcm_query_epsb_txrx_statistics().
244 *
245 * 02 16 2017 steve.kao
246 * [MOLY00230062] [UMOLYA] M-PS related interface changes for UPCM, RATDM, and EPDCP
247 *
248 * [M-PS][UPCM]
249 * 1. add protocol_idx into callback interfaces,
250 * 2. one set of UPCM UL SIT per SIM.
251 *
252 * 10 07 2016 cammie.yang
253 * [MOLY00195563] [6293][EL2][UPCM][RATDM][EPDCP] Initial feature integrations
254 * [TRUNK][UPCM] fix incorrect input type of upcm_reg_cbk_dlvr_dl_sdu
255 *
256 * 09 26 2016 cammie.yang
257 * [MOLY00195563] [6293][EL2][UPCM][RATDM][EPDCP] Initial feature integrations
258 * [TRUNK] UPCM/RATDM/EPDCP feature integrations from PS.DEV
259 *
260 * 01 23 2014 clark.peng
261 * [MOLY00047398] [MT6582LTE][WWFT][UK][Vodafone][EE] CSFB performance anlysis [only for UKFT]
262 * Implementation of upcm_get_pending_ul_data_status() based on timestamp difference (3sec)
263 *
264 * 07 17 2013 moja.hsu
265 * [MOLY00030111] Add UPCM Tx/Rx statistics query API
266 * .
267 *
268 * 05 16 2013 moja.hsu
269 * [MOLY00007625] Maintain code
270 * Back out changelist 156018
271 * patch for QMU_BM/UPCM/RATADP/TFT_PF trace
272 *
273 * 05 15 2013 moja.hsu
274 * [MOLY00007625] Maintain code
275 * add tft_pf/qmu_bm/upcm/ratadp trace
276 *
277 * 01 14 2013 moja.hsu
278 * [MOLY00007625] Maintain code
279 * add upcm_rcv_ul_by_ebi and add EBI for DL Deliver for IMS requirement.
280 ****************************************************************************/
281/*
282 * =====================================================================================
283 *
284 * Filename: upcm.h
285 *
286 * Description: UPCM (User plane connection manager exported header file)
287 *
288 * Created: 2012/3/19 �W�� 11:20:22
289 *
290 * Author: mtk01641 (moja)
291 * =====================================================================================
292 */
293#ifndef UPCM_INC
294#define UPCM_INC
295
296#include "kal_public_api.h"
297#include "qmu_bm.h"
298#include "upcm_enum.h"
299#include "upcm_did.h"
300#include "lhif_if.h"
301#include "upcm_emac_struct.h"
302
303/********************************************
304 * FEATURE CONTROL *
305 ********************************************/
306#define UPCM_FEATURE_301 1
307#if UPCM_FEATURE_301
308#define NO_INTERNET_ILM_FOR_EMAC 1
309#endif
310
311#define UPCM_PAGING_EARLY_RELEASE 1
312#if UPCM_PAGING_EARLY_RELEASE
313#define UPCM_PAGING_EARLY_RELEASE_VGMM 1
314#endif
315
316#ifdef __IPC_ADAPTER__
317#define UPCM_INVITE_FLUSH_CMD 1
318#else
319#define UPCM_INVITE_FLUSH_CMD 0
320#endif
321
322#define UPCM_DEBUG_MODE 0
323#define UPCM_NORMAL_MODE !UPCM_DEBUG_MODE
324
325#define UPCM_FEATURE_RBRQ 1
326
327#define UPCM_FEATURE_ICD 1
328
329#define UPCM_FEATURE_LOG_REDUCTION 1
330
331#define UPCM_FEATURE_VIP 1 // very important packet should be put in pri-SIT
332#define UPCM_FEATURE_VIP_NOTIFY_EL2 1 // notify EL2 that VIP is received by UPCM
333
334#ifdef __CHANNEL_LOCK__
335#define UPCM_FEATURE_F4L_DATA_COVERAGE 1 // enhancement for F4L Data Coverage
336#else
337#define UPCM_FEATURE_F4L_DATA_COVERAGE 0 // no channel lock
338#endif
339/********************************************
340 * MACROS *
341 ********************************************/
342#define UPCM_GET_FIVEG_MAPPED_BEARER_ID_BY_PSI_QFI(_psi, _qfi) \
343 (MIN_5G_BEARER_ID + (((_psi) - 1) * QFI_NUM_PER_PSI) + (_qfi))
344
345#define UPCM_GET_FIVEG_MAPPED_BEARER_ID(_is_5g, _psi, _bearer) \
346 ((_is_5g) ? UPCM_GET_FIVEG_MAPPED_BEARER_ID_BY_PSI_QFI(_psi, _bearer) : (_bearer))
347
348#define UPCM_GET_FIVEG_MAPPED_PDN_ID(_is_5g, _psi, _bearer) \
349 ((_is_5g) ? (MIN_5G_PDN_ID + (_psi) - 1) : (_bearer))
350
351#define UPCM_IS_FIVEG_BEARER_ID(_id) \
352 (((MIN_5G_BEARER_ID <= (_id)) && ((_id) < MAX_EPSB_NUM)) ? KAL_TRUE : KAL_FALSE)
353
354#define UPCM_IS_FIVEG_PDN_ID(_id) \
355 (((MIN_5G_PDN_ID <= (_id)) && ((_id) <= MAX_5G_PDN_ID)) ? KAL_TRUE : KAL_FALSE)
356
357#define GET_SIT_TABLE_INFO_PRI(_info) (((_info)>>31) & 0x1)
358#define GET_SIT_TABLE_INFO_IDX(_info) ((_info) & 0x7FFFFFFF)
359
360#define GET_FREE_ENTRY_INFO_START(_info) (((_info)>>16) & 0xFFFF)
361#define GET_FREE_ENTRY_INFO_END(_info) ((_info) & 0xFFFF)
362
363/**
364 * @brief UPCM_HAS_[DL/UL]_[INTERNET/IMS]_Data_IN_MS
365 * Check whether there's data in given milliseconds.
366 * For UL, duration can be >= 0.
367 * For DL, duration should be > 0.
368 *
369 * @param protocol_idx, duration_ms
370 *
371 * @return bool
372 * For UL
373 * if duration_ms == 0
374 * KAL_TURE: there are data in Internet/IMS SIT, i.e. some packets are not sent to NW or Acked yet.
375 * KAL_FALSE: there's no data in Internet/IMS SIT.
376 * if duration_ms > 0
377 * KAL_TURE: there are data in given milliseconds.
378 * KAL_FALSE: there's no data in given milliseconds.
379 * For DL
380 * if duration_ms == 0 (invalid parameter)
381 * KAL_TURE: -
382 * KAL_FALSE: always false.
383 * if duration_ms > 0
384 * KAL_TURE: there are data in given milliseconds.
385 * KAL_FALSE: there's no data in given milliseconds.
386 */
387#define UPCM_HAS_DL_INTERNET_DATA_IN_MS(_protocol_idx, _dl_duration_ms) \
388 (upcm_latest_time_of_DL_internet_data(_protocol_idx) < (_dl_duration_ms))
389
390#define UPCM_HAS_DL_IMS_DATA_IN_MS(_protocol_idx, _dl_duration_ms) \
391 (upcm_latest_time_of_DL_ims_data(_protocol_idx) < (_dl_duration_ms))
392
393#define UPCM_HAS_UL_INTERNET_DATA_IN_MS(_protocol_idx, _ul_duration_ms) \
394 ((_ul_duration_ms == 0)? \
395 upcm_is_ul_internet_data_ongoing(_protocol_idx) : \
396 upcm_latest_time_of_UL_internet_data(_protocol_idx) < (_ul_duration_ms))
397
398#define UPCM_HAS_UL_IMS_DATA_IN_MS(_protocol_idx, _ul_duration_ms) \
399 ((_ul_duration_ms == 0)? \
400 upcm_is_ul_ims_data_ongoing(_protocol_idx) : \
401 upcm_latest_time_of_UL_ims_data(_protocol_idx) < (_ul_duration_ms))
402
403#define UPCM_HAS_DL_UL_INTERNET_DATA_IN_MS(_protocol_idx, _dl_duration_ms, _ul_duration_ms) \
404 (UPCM_HAS_DL_INTERNET_DATA_IN_MS(_protocol_idx, _dl_duration_ms) || \
405 UPCM_HAS_UL_INTERNET_DATA_IN_MS(_protocol_idx, _ul_duration_ms))
406
407#define UPCM_HAS_DL_UL_IMS_DATA_IN_MS(_protocol_idx, _dl_duration_ms, _ul_duration_ms) \
408 (UPCM_HAS_DL_IMS_DATA_IN_MS(_protocol_idx, _dl_duration_ms) || \
409 UPCM_HAS_UL_IMS_DATA_IN_MS(_protocol_idx, _ul_duration_ms))
410
411#define UPCM_HAS_DL_UL_DATA_IN_MS(_protocol_idx, _dl_duration_ms, _ul_duration_ms) \
412 (UPCM_HAS_DL_UL_INTERNET_DATA_IN_MS(_protocol_idx, _dl_duration_ms, _ul_duration_ms) || \
413 UPCM_HAS_DL_UL_IMS_DATA_IN_MS(_protocol_idx, _dl_duration_ms, _ul_duration_ms))
414
415/********************************************
416 * TYPE DEFINITIONS & ENUMS *
417 ********************************************/
418#if UPCM_FEATURE_301
419typedef enum
420{
421 UPCM_KEEP_CONNECTED_DISABLE = 0x0,
422 UPCM_KEEP_CONNECTED_EL2_ONLY = 0x1,
423 UPCM_KEEP_CONNECTED_RATDM_ONLY = 0x2,
424 UPCM_KEEP_CONNECTED_UPCM_ONLY = 0x4,
425 UPCM_KEEP_CONNECTED_UPCM_RATDM = (UPCM_KEEP_CONNECTED_UPCM_ONLY | UPCM_KEEP_CONNECTED_RATDM_ONLY),
426 UPCM_KEEP_CONNECTED_EL2_RATDM = (UPCM_KEEP_CONNECTED_EL2_ONLY | UPCM_KEEP_CONNECTED_RATDM_ONLY)
427} upcm_keep_connected_mode_e;
428#endif
429
430/*
431 * lte tick source notify callback prototype.
432 * is_lte_tick: KAL_TRUE - has LTE tick.
433 * KAL_FLAE - may no LTE tick.
434 */
435typedef void (*upcm_nofify_lte_tick_f)(kal_bool is_lte_tick);
436typedef void (*upcm_dlvr_dl_sdu_93_f)(kal_uint32 pdn_id, upcm_did* p_head, upcm_did* p_tail, kal_uint8 protocol_idx);
437
438typedef struct
439{
440 /* tx/rx bytes */
441 kal_uint64 tx_bytes;
442 kal_uint32 tx_nums;
443 kal_uint32 tx_max;
444 kal_uint64 rx_bytes;
445 kal_uint32 rx_nums;
446 kal_uint32 rx_max;
447} single_epsb_txrx_info_struct;
448
449typedef struct
450{
451 single_epsb_txrx_info_struct txrx_info[MAX_234G_EPSB_NUM];
452#ifdef __FIVEG_NAS__
453 single_epsb_txrx_info_struct nr_txrx_info[NUM_5G_PDU_SESSION];
454#endif
455} upcm_query_epsb_statistics_struct;
456
457typedef struct
458{
459 LOCAL_PARA_HDR
460 /*
461 * D2 notify UPCM that all IP addr(s) of this netif_id has obtained
462 * the range of netif_id is 0x00~0xff
463 */
464 kal_int32 netif_id;
465}d2cm_upcm_get_ip_addr_ind_struct;
466
467/********************************************
468 * FUNCTION DECLARATIONS *
469 ********************************************/
470/**
471 * @brief upcm_init Init UPCM module.
472 *
473 * @return TRUE
474 */
475kal_bool upcm_init(void);
476
477/**
478 * @brief upcm_reset
479 * Reset UPCM module.
480 *
481 * @return TRUE
482 *
483 * @return
484 */
485kal_bool upcm_reset(void);
486
487/**
488 * @brief upcm_on_ilm
489 * Receive ILM message
490 *
491 * @param ilm
492 */
493void upcm_on_ilm(ilm_struct *p_ilm);
494
495
496/**
497 * @brief upcm_rcv_ul_sdu
498 * Receive UL SDUs. UL SDU are GPD list.
499 *
500 * @param ip_type the UL SDU IP type. may help UPCM go quick path if the IP type is known.
501 * @param pdn_id PDN Connection ID
502 * @param p_head SDU list head. (GPD based)
503 * @param p_tail SDU list tail. (GPD based)
504 *
505 * for 93:
506 * - GPD-based, for LTE-CSR (ex: GPD).
507 * - PIT-based, for VRB.
508 */
509void upcm_rcv_ul_sdu_93_gpd(ip_type_e ip_type, kal_uint32 pdn_id, qbm_gpd* p_head, qbm_gpd* p_tail, kal_uint8 protocol_idx);
510void upcm_rcv_ul_sdu_93(kal_uint16 pit_start, kal_uint16 pit_end, LHIF_QUEUE_TYPE queue_type);
511
512/**
513 * @brief upcm_forced_sw_path_xxx
514 * Ensure set/clear should be paired
515 * is_forced_sw_path will +1 or -1 count but is_forced_sw_path can not directly change path
516 * UPCM will use count to determine SW-path or not
517 * if count=0, direct path
518 * if count!=0, inderect(sw) path
519 * @param ebi/pdn:
520 * @param is_forced_sw_path: TRUE(set forced SW path)/FALSE(clear forced SW path)
521 * @param protocol_id:
522 */
523void upcm_forced_sw_path_by_ebi(kal_uint32 ebi, kal_bool is_forced_sw_path, kal_uint8 protocol_idx);
524void upcm_forced_sw_path_by_pdn(kal_uint32 pdn, kal_bool is_forced_sw_path, kal_uint8 protocol_idx);
525//void upcm_forced_sw_path_all(kal_bool is_forced_sw_path); //retire
526void upcm_forced_sw_path_all_by_protocol(kal_bool is_forced_sw_path, kal_uint8 protocol_idx);
527
528
529/**
530 * @brief upcm_rcv_ul_sdu_by_ebi
531 * Receive UL SDUs on specified EBI. The Function will bypass TFT Process.
532 * But for inter-rat case, the data will enter suspend queue, so TFT Process will be applied.
533 * It can't be called on test loopback mode.
534 *
535 * @param ebi
536 * @param p_head
537 * @param p_tail
538 */
539void upcm_rcv_ul_sdu_by_ebi_93_gpd(kal_uint32 ebi, qbm_gpd* p_head, qbm_gpd* p_tail, kal_uint8 protocol_idx);
540
541/**
542 * @brief upcm_reg_cbk_notify_lte_tick
543 * Register callback function.
544 * For get if there is a LTE tick source.
545 *
546 * @param pf_notify callback function.
547 */
548void upcm_reg_cbk_notify_lte_tick(upcm_nofify_lte_tick_f pf_notify);
549
550/**
551 * @brief upcm_reg_cbk_dlvr_dl_sdu
552 * Register callback for deliver DL SDUs.
553 *
554 * @param pf_dlvr_sdu
555 */
556void upcm_reg_cbk_dlvr_dl_sdu(upcm_dlvr_dl_sdu_93_f pf_dlvr_sdu);
557
558#if defined(__SENSITIVE_DATA_MOSAIC__)
559/**
560 * @brief upcm_module_clean
561 * clean sensitive context
562 *
563 * @param
564 */
565void upcm_module_clean(void);
566#endif
567
568/**
569 * @brief upcm_query_epsb_txrx_statistics
570 * Query UPCM tx/rx statistics.
571 * If the connection is deactivated, it will give the last value of previous activate.
572 *
573 * @param query_result
574 */
575void upcm_query_epsb_txrx_statistics(upcm_query_epsb_statistics_struct *query_result, kal_uint8 protocol_idx);
576
577/**
578 * @brief upcm_query_epsb_ims_ebi_tx_rx_statistics
579 * Query tx/rx statistics of the IMS ebi.
580 * If the connection is deactivated, it will give the last value of previous activate.
581 *
582 * @param query_result
583 */
584#ifdef __GEMINI__
585kal_uint64 upcm_query_epsb_ims_ebi_tx_rx_statistics(kal_uint8 sim_idx);
586#else
587kal_uint64 upcm_query_epsb_ims_ebi_tx_rx_statistics(void);
588#endif
589
590/**
591 * @brief upcm_get_pending_ul_data_status
592 * Predict pending UL data of each NSAPI/EBI by checking if there is UL data
593 * within past UPCM_UL_DATA_INTERVAL_TO_TRIGGER_SR.
594 *
595 * @return 16-bit bitmap for each NSAPI/EBI.
596 * If it predicts this NSAPI/EBI has UL data, the corresponding bit is set to 1.
597 * Otherwise, the corresponding bit is set to 0.
598 * For example, if there is pending UL data for NSAPI/EBI 5~15,
599 * then the return value will be 0xFFE0.
600 */
601kal_uint16 upcm_get_pending_ul_data_status(kal_uint8 protocol_idx);
602
603#ifdef __FIVEG_NAS__
604kal_uint16 upcm_get_pending_ul_data_status_5g(kal_uint8 protocol_idx);
605kal_uint16 upcm_get_bind_status_5g(kal_uint8 protocol_idx);
606#endif
607
608kal_bool upcm_is_ims_ebi(kal_uint32 ebi, kal_uint8 protocol_idx);
609
610/**
611 * @brief upcm_predict_internet_data_on_going
612 * predict potential internet data is ongoing
613 * If query main-ps and internet PDN has data in previous time, return TRUE.
614 * If query non-main-ps, return FALSE.
615 *
616 * @param protocol_idx
617 *
618 * @return bool
619 * KAL_TURE: the possibility of ongoing interent data is high
620 * KAL_FALSE: the possiblilty of ongoing internet data is low
621 */
622// Obsoleted. Remove it when other module (ERRC) is not needed anymore.
623kal_bool upcm_predict_internet_data_is_ongoing(kal_uint8 protocol_idx);
624
625/**
626 * @brief upcm_predict_ims_data_is_ongoing
627 * predict potential ims data is ongoing
628 *
629 * @param protocol_idx
630 *
631 * @return bool
632 * KAL_TURE: the possibility of ongoing ims data is high
633 * KAL_FALSE: the possiblilty of ongoing ims data is low
634 */
635// Obsoleted. Remove it when other module (ERRC) is not needed anymore.
636kal_bool upcm_predict_ims_data_is_ongoing(kal_uint8 protocol_idx);
637
638/**
639 * @brief upcm_latest_time_of_[UL/DL]_[internet/ims]_data
640 * provide the latest UL/DL data arrival time of Internet/IMS data
641 * These APIs are needed by control plane modules, e.g. RRC, MSPM, EMM, and SBP.
642 * RRC: to decide whether to trigger fake A2 to release RRC Connection.
643 * EMM: to enhance V-Con in the scenario of Paging+TAU (V-Con feature)
644 * MSPM: to decide leave V-Con to Con or Idle (V-Con feature)
645 * SBP: to help decide whether turn off screen (data dormant feature)
646 *
647 * @param protocol_idx
648 *
649 * @return kal_uint32
650 * the latest UL/DL data arrival time of Internet/IMS data in millisecond
651 */
652kal_uint32 upcm_latest_time_of_internet_data(kal_uint8 protocol_idx);
653kal_uint32 upcm_latest_time_of_UL_internet_data(kal_uint8 protocol_idx);
654kal_uint32 upcm_latest_time_of_DL_internet_data(kal_uint8 protocol_idx);
655kal_uint32 upcm_latest_time_of_UL_ims_data(kal_uint8 protocol_idx);
656kal_uint32 upcm_latest_time_of_DL_ims_data(kal_uint8 protocol_idx);
657
658/**
659 * @brief upcm_is_ul_[internet/ims]_data_ongoing
660 * UL data is ongoing or not
661 * Checks whether SDU Information Table (SIT) is empty or not.
662 * UL packet in SIT would be cleared when sent to NW successfully.
663 *
664 * @param protocol_idx
665 *
666 * @return bool
667 * KAL_TURE: SIT is not empty, i.e. some packets are being sent.
668 * KAL_FALSE: SIT is empty, i.e. no packets are being sent.
669 */
670kal_bool upcm_is_ul_internet_data_ongoing(kal_uint8 protocol_idx);
671kal_bool upcm_is_ul_ims_data_ongoing(kal_uint8 protocol_idx);
672
673#if UPCM_FEATURE_RBRQ
674void upcm_rbrq_set_rb_ebi_mapping(kal_uint8 rb_idx, kal_uint8 ebi, kal_uint32 sim_idx);
675void upcm_rbrq_support_rel_ind(upcm_emac_rbrq_support_rel_ind_struct *p_local);
676#endif
677kal_uint8 upcm_get_pdn_id_by_ebi(kal_uint32 ebi, kal_uint8 protocol_idx);
678
679void upcm_free_sit_entry_wi_free_buf(kal_uint32 sit_table_info, kal_uint32 free_entry_info,
680 kal_uint32 task_id, kal_uint8 protocol_idx);
681
682void upcm_free_sit_entry_wo_free_buf(kal_uint32 sit_table_info, kal_uint32 free_entry_info,
683 kal_uint32 task_id, kal_uint8 protocol_idx);
684
685void upcm_add_rx_statistics(kal_uint32 ebi, kal_uint32 bytes, kal_uint32 nums, kal_uint32 max, kal_uint8 protocol_idx);
686
687qbm_gpd* upcm_copy_pkt_to_gpd(kal_uint16 len, kal_uint32 addr);
688
689void upcm_send_ims_sdu_drop_ind_to_imc(kal_uint32 drop_type, kal_uint8 protocol_idx);
690
691#if UPCM_FEATURE_301
692kal_bool upcm_keep_connected_data_working(kal_uint32 *p_psi_ebi, kal_bool is_5g,
693 kal_uint8 protocol_idx);
694#endif
695
696#if NO_INTERNET_ILM_FOR_EMAC
697void upcm_send_internet_disconnect_notify();
698#endif
699
700kal_uint16 upcm_gen_packet_tag(kal_uint8 *p_data, kal_uint32 data_len);
701kal_uint16 upcm_get_sit_idx(kal_bool is_5g, kal_uint32 psi, kal_uint32 bearer,
702 kal_uint8 protocol_idx);
703
704#if defined(__MTK_INTERNAL__) || defined(__GTEST_ENABLE__)
705void upcm_set_sit_idx(kal_bool is_5g, kal_uint32 psi, kal_uint32 bearer,
706 kal_uint8 protocol_idx, kal_uint16 sit_idx);
707#endif
708
709/**
710 * @brief upcm_is_active_protocol
711 *
712 * @param protocol_idx
713 * @return bool
714 * TRUE: at lease one bearer is activated
715 * FALSE: otherwise
716 */
717kal_bool upcm_is_active_protocol(kal_uint8 protocol_idx);
718
719void upcm_get_psi_qfi_by_bearer_id(kal_uint32 bearer_id, kal_uint8 *psi,
720 kal_uint8 *qfi);
721
722kal_bool upcm_is_test_loop(kal_uint8 protocol_idx);
723
rjw2b1408e2022-12-19 11:19:29 +0800724/**
725 * @brief upcm_has_pending_rollback_ul_data
726 * Check if UPCM has pending rollback UL data queued within.
727 *
728 * @param protocol_idx
729 * @return bool
730 * TRUE: has pending rollback UL data
731 * FALSE: no pending rollback UL data
732 */
733#ifdef __FIVEG_NAS__
734kal_bool upcm_has_pending_rollback_ul_data(kal_uint8 protocol_idx);
735#endif
736
rjw6c1fd8f2022-11-30 14:33:01 +0800737#endif /* ----- #ifndef UPCM_INC ----- */