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