blob: 3e819f3ce3e733cf9cf529e3b078f8e5e67bc2e8 [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 * tftlib_common_struct.h
40 *
41 * Project:
42 * --------
43 * MOLY
44 *
45 * Description:
46 * ------------
47 * TFT library common structure
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 * ==========================================================================
54 * $Log$
55 *
56 * 09 18 2020 terence.kuo
57 * [MOLY00560403] [Mouton][R0][operator_IOT] Both active and hold call gets disconnected.
58 * . Further error handling for pf precedence conflict without dedicated bearer deactivation.
59 *
60 * 04 15 2020 terence.kuo
61 * [MOLY00508241] Memory reduction - l4 ps cid reduction and reduce maximum number of support flow
62 * 1. Support setting null for pf_act_list parameter.
63 * 2. Support qos flow deactivation.
64 * 3. Record qr's precedence into context in tftlib_set_user_defined_tft() if rate is 5g.
65 * 4. Add primitive traces to record current applied qr/ tft status for analysis.
66 * 5. trace enhancement
67 *
68 * 04 06 2020 terence.kuo
69 * [MOLY00508241] Memory reduction - l4 ps cid reduction and reduce maximum number of support flow
70 * . Add primitive traces to record current applied qr/ tft status for analysis.
71 *
72 * 01 02 2020 terence.kuo
73 * [MOLY00468375] [IODT][MT6885][Petrus][MP1][ZTE][Lab][5GSM][China][Xian][F60][N41][core1,vpe0,tc0(vpe3)] Fatal Error (0x823, 0x2000, 0xcccccccc) - NAS
74 *
75 * . Reduce the control buffer size when handling packet filter action list.
76 *
77 * 09 23 2019 terence.kuo
78 * [MOLY00442505] Update for March CR and trace enhancements.
79 *
80 * . Update for March CR and trace enhancements.
81 *
82 * 09 04 2019 terence.kuo
83 * [MOLY00434754] Upgrade CGTFT to support 5GC
84 *
85 * . Update CGTFT behaviors in tftlib.
86 *
87 * 03 26 2019 jeffery.chen
88 * [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
89 *
90 * [TFTLIB] interface part.
91 *
92 * 03 26 2019 jeffery.chen
93 * [MOLY00393456] [Gen97][VMOLY] 45G InterRAT & interSystem feature
94 *
95 * [TFTLIB] interface part.
96 *
97 * 12 14 2018 jeffery.chen
98 * [MOLY00372635] [VMOLY] L4/TCM/TFTLIB/VGSM phase2 check-in
99 *
100 * [TFTLIB] phase2 check-in.
101 *
102 * 09 14 2018 jeffery.chen
103 * [MOLY00306148] [NAS] pangu giant CR
104 *
105 * [TFTLIB] pass 1st NAS MoDIS IT.
106 *
107 * 08 17 2018 jeffery.chen
108 * [MOLY00306148] [NAS] pangu giant CR
109 * [TFTLIB] re-architecture.
110 *
111 * 08 17 2018 max.mo
112 * [MOLY00306148] [NAS] pangu giant CR
113 * .changes from Norman's CBr
114 *
115 * 07 20 2018 max.mo
116 * [MOLY00339905] [Gen97] porting of MOD_VGSM
117 * [Protocol build tag]
118 * [Is CL self testable: YES]
119 * [Group CL list: NO]
120 *
121 * 10 16 2016 renhuang.liu
122 * [MOLY00205035][TFTLIB] Memory management in TFT internal
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 * 12 25 2013 joe.chang
133 * [MOLY00051497] [MOLY][NRSPCA] NRSPCA phase 2 implementation
134 * [TFTLIB] Check-in related changes
135 *
136 * 04 12 2013 joe.chang
137 * [MOLY00014197] TFTLIB new feature
138 * [MT6290][TFTLIB] update TFT parameter list with new structure
139 *
140 * 12 04 2012 joe.chang
141 * [MOLY00007051] [MT7208][LTE Single Mode] enum rename & memory allocation mechansim change
142 *
143 * 11 07 2012 joe.chang
144 * [MOLY00005322] TATAKA merge to MOLY
145 * [Joe] TFTLIB part is check in done.
146 ****************************************************************************/
147
148
149#ifndef TFTLIB_COMMON_STRUCT_H_
150#define TFTLIB_COMMON_STRUCT_H_
151
152
153#include "kal_general_types.h"
154#include "tftlib_common_enum.h"
155
156
157/*struct declaration */
158
159
160/* IPv4 remote address and subnet mask struct (WORD(4-byte) array, used by UPCM only) */
161typedef struct
162{
163 kal_uint32 addr;
164 kal_uint32 mask;
165}remote_v4addr_struct;
166
167
168/* IPv6 remote address and subnet mask struct (WORD(4-byte) array, used by UPCM only) */
169typedef struct
170{
171 kal_uint32 addr[4];
172 kal_uint32 mask[4];
173}remote_v6addr_struct;
174
175typedef remote_v4addr_struct local_v4addr_struct;
176typedef remote_v6addr_struct local_v6addr_struct;
177
178/* Packet filter struct for SM/ESM, TCM, L4C, & UPCM */
179typedef struct
180{
181 pf_own_entity_enum pf_own_entity; // Indicate UE or NW owns this PF
182 kal_uint8 qri; // QuS Rule ID where the packet filter belongs to
183 kal_uint8 id; // Packet filter index
184 kal_uint8 precedence; // Packet filter evaluation precedence index
185 pf_direction_enum direction; // Direction of the packet filter
186
187 kal_uint32 bitmap; // Used to indicate which of the following field exist
188
189 kal_bool match_all_type;
190
191 union
192 {
193 remote_v4addr_struct v4;
194 remote_v6addr_struct v6;
195 }remote_addr; // Remote address and subnet mask (WORD(4-byte) array, used by UPCM only)
196
197 union
198 {
199 local_v4addr_struct v4;
200 local_v6addr_struct v6;
201 }local_addr; // Local address and subnet mask (WORD(4-byte) array, used by UPCM only)
202
203 kal_uint8 remote_addr_and_mask[MAX_REMOTE_ADDR_AND_MASK_LEN]; /* ----------------- Remote address and subnet mask (byte array) ----------------*
204 * *
205 * IPv4: addr = 0 ~ 3 *
206 * mask = 4 ~ 7 *
207 * <NOTE1: Length of IPv4 addr + mask = IPV4_REMOTE_ADDR_AND_MASK_LEN(8)> *
208 * *
209 * IPv6: addr = 0 ~ 15 *
210 * mask = 16 ~ 31 *
211 * <NOTE2: Length of IPv6 addr + mask = IPV6_REMOTE_ADDR_AND_MASK_LEN(32)> *
212 * *
213 * <NOTE3: MAX_REMOTE_ADDR_AND_MASK_LEN is set as IPV6_REMOTE_ADDR_AND_MASK_LEN> *
214 * *
215 * ------------------------------------------------------------------------------*
216 */
217
218 kal_uint8 local_addr_and_mask[MAX_LOCAL_ADDR_AND_MASK_LEN]; /* ----------------- Local address and subnet mask (byte array) -----------------*
219 * *
220 * IPv4: addr = 0 ~ 3 *
221 * mask = 4 ~ 7 *
222 * <NOTE1: Length of IPv4 addr + mask = IPV4_LOCAL_ADDR_AND_MASK_LEN(8)> *
223 * *
224 * IPv6: addr = 0 ~ 15 *
225 * mask = 16 ~ 31 *
226 * <NOTE2: Length of IPv6 addr + mask = IPV6_LOCAL_ADDR_AND_MASK_LEN(32)> *
227 * *
228 * <NOTE3: MAX_LOCAL_ADDR_AND_MASK_LEN is set as IPV6_LOCAL_ADDR_AND_MASK_LEN> *
229 * *
230 * ------------------------------------------------------------------------------*
231 */
232
233 kal_uint8 protocol_nxt_hdr; // Protocol number (IPv4) / Next header (IPv6)
234
235 kal_uint16 local_port_low; // Single local port / Local port range (low)
236 kal_uint16 local_port_high; // (N/A) / Local port range (high)
237
238 kal_uint16 remote_port_low; // Single remote port / Remote port range (low)
239 kal_uint16 remote_port_high; // (N/A) / Remote port range (high)
240
241 kal_uint32 spi; // IPsec security parameter index
242
243 kal_uint8 tos; // Type of service (IPv4) / Traffic class (IPv6)
244 kal_uint8 tos_msk; // Type of service mask (IPv4) / Traffic class mask (IPv6)
245
246 kal_uint32 flow_label; // Flow label (IPv6)
247}pkt_filter_struct;
248
249/* Common deact list: union of deact_bearer_list_struct and deact_qr_list_sturct */
250typedef struct {
251 kal_uint8 deact_num;
252 kal_uint8 deact_list[TFTLIB_MAX_DEACT_LIST_NUM];
253 kal_bool has_dqr;
254 tft_validate_result_enum cause;
255} tft_deact_list_struct;
256
257/* PDP/EPS bearer context deactivation list for SM/ESM */
258typedef struct {
259 kal_uint8 deact_num; // Number of deactivated bearer due to packet filter conflict
260 kal_uint8 deact_list[TFTLIB_MAX_BEARER_CTXT_NUM]; // Deactivated bearer context list
261} tft_deact_bearer_list_struct;
262
263/* QoS Rule deactivation list for VGSM */
264typedef struct {
265 kal_uint8 deact_num; // Number of deactivated QoS Rule due to packet filter conflict
266 kal_uint8 deact_list[TFTLIB_MAX_QR_NUM]; // Deactivated QoS Rule context list
267 kal_bool has_dqr; // TRUE if there is Default QR in deact list.
268 tft_validate_result_enum cause;
269} tft_deact_qr_list_struct;
270
271/* Packet filter action struct for UPCM */
272typedef struct
273{
274 kal_uint8 bearer_id; // EPS bearer ID/NSAPI where the packet filter belongs to
275 kal_uint8 qri; // QuS Rule ID where the packet filter belongs to
276 kal_uint8 old_qfi; // Old QoS Flow ID where the Qos Rule belongs to
277 kal_uint8 qfi; // New QoS Flow ID
278 pkt_filter_act_enum action; // Update action for the packet filter
279 pkt_filter_struct pkt_filter; // Content of the new packet filter
280} pkt_filter_act_struct;
281
282
283/* Packet filter action list struct for TCM, UPCM */
284typedef struct
285{
286 kal_uint8 pkt_filter_num; // Number of packet filters to be update in the following list
287 pkt_filter_act_struct *pkt_filter_list[MAX_PACKET_FILTER_NUM * 2]; // List of packet filters to be update and each with specific EPS bearer ID/NSAPI & action
288} pkt_filter_act_list_struct;
289
290/* Packet filter action list link-list node for VGSM, TCM, UPCM */
291typedef struct _pkt_filters_act_list_node_struct {
292 pkt_filter_act_list_struct pkt_filters; // Packet filters Action in a QoS Rule
293 struct _pkt_filters_act_list_node_struct *next; // Point to the next pkt_filters act list in the next QoS Rule
294} pkt_filters_act_list_node_struct;
295
296/* TFT PDU struct for SM/ESM, TCM */
297typedef struct {
298 kal_uint16 length; // length of the TFT raw data: upgrade to uint16 for 5G
299 kal_uint8 *data; // TFT raw data
300} tft_pdu_struct;
301
302
303typedef struct {
304 kal_uint8 auth_token_len; // length of authorization token
305 kal_uint8 auth_token[MAX_AUTHORIZATION_TOKEN_LEN]; // authorization token
306 kal_uint8 flow_id_num; // number of flow identifiers
307 kal_uint8 flow_id_list[MAX_FLOW_IDENTIFIER_NUM][FLOW_IDENTIFIER_LEN]; /* flow identifier list
308 * (NOTE: an authtoken can follow one or more flow identifiers,
309 * and each flow identifier is FLOW_IDENTIFIER_LEN (4 byte) long)
310 */
311} tft_authtoken_flowid_struct;
312
313
314typedef struct {
315 kal_uint8 linked_pf_id_num; // Number of linked packet filter IDs carried in linked_pf_id_list[]
316 kal_uint8 linked_pf_id_list[MAX_PACKET_FILTER_NUM]; /* Linked packet filter ID list
317 * (NOTE1: Used to indicate to NW the change for which service applies to)
318 * (NOTE2: Will appear when, 1. GBR changes, 2. TFT operation = 'Add packet filters to existing TFT')
319 */
320
321 kal_uint8 authtoken_flowid_num; // Number of authtoken_flowid group in authtoken_flowid_list[]
322 tft_authtoken_flowid_struct authtoken_flowid_list[MAX_AUTHTOKEN_FLOWID_NUM]; // Authorization and flow identifier group list
323
324} tft_parameter_list_struct;
325
326/* TFT struct for SM/ESM, TCM, L4C */
327typedef struct {
328 kal_uint8 cid; // context id
329 kal_bool est_wo_tft; // indicate whether TFT is established without TFT
330 tft_operation_enum tft_opcode; // TFT operation code
331 kal_bool ebit; // Indicate whether parameter list exists
332 kal_bool is_default_bearer; // (234G) Indicate whether it's primary pdp/ default bearer
333
334 kal_bool dqr_bit; // (5G)Indicate whether the QoS rule is the default QoS rule
335 kal_bool qri_present; // (5G)
336 kal_uint8 qri; // (5G) QoS rule id
337 kal_bool qr_precedence_present; // (5G)
338 kal_uint8 qr_precedence; // (5G) precedence value of QoS rule
339 kal_bool qfi_present; // (5G)
340 kal_uint8 qfi; // (5G) QoS Flow Id
341 kal_bool psi_present; // (5G)
342 kal_uint8 psi; // (5G) PDU session id
343
344 kal_uint8 pf_num; // Number of packet filter carried in pf_list[]
345 pkt_filter_struct pf_list[MAX_PACKET_FILTER_NUM]; // Packet filter list
346 tft_parameter_list_struct parameter_list; // (234G)Parameter list
347
348} tft_info_struct;
349
350typedef struct {
351 kal_uint16 length; // length of the QoS Rules raw data
352 kal_uint8 *data; // raw data of QoS Rules
353} qrs_raw_struct;
354
355/* A memory reduction version of tft_info_struct struct.
356 * The type of pf_list is change from pkt_filter_struct to pkt_filter_struct* (pointer) */
357typedef struct {
358 kal_uint8 cid; // context id
359 kal_bool est_wo_tft; // indicate whether TFT is established without TFT
360 tft_operation_enum tft_opcode; // TFT operation code
361 kal_bool ebit; // Indicate whether parameter list exists
362 kal_bool is_default_bearer; // (234G) Indicate whether it's primary pdp/ default bearer
363
364 kal_bool dqr_bit; // (5G)Indicate whether the QoS rule is the default QoS rule
365 kal_bool qri_present; // (5G)
366 kal_uint8 qri; // (5G) QoS rule id
367 kal_bool qr_precedence_present; // (5G)
368 kal_uint8 qr_precedence; // (5G) precedence value of QoS rule
369 kal_bool qfi_present; // (5G)
370 kal_uint8 qfi; // (5G) QoS Flow Id
371 kal_bool psi_present; // (5G)
372 kal_uint8 psi; // (5G) PDU session id
373
374 kal_uint8 pf_num; // Number of packet filter carried in pf_list[]
375 pkt_filter_struct *pf_list[MAX_PACKET_FILTER_NUM]; // Pointers to packet filter list
376 tft_parameter_list_struct parameter_list; // (234G)Parameter list
377} tft_info_w_pf_ptr_struct;
378
379/* TFT info list */
380typedef struct {
381 kal_uint8 tft_num;
382 tft_info_struct tft_info[ 1 + TFTLIB_MAX_QR_NUM_PER_PDUS]; // +1 for 234G TFT
383} tft_info_list_struct;
384
385/* rqos rule struct */
386typedef struct {
387 kal_bool rule_in_use; //
388 kal_uint8 rule_idx; // = pf idx
389 kal_uint8 qri; // (5G) QoS rule id
390 kal_uint8 qr_precedence; // (5G) precedence value of QoS rule
391 kal_uint8 psi; // (5G) PDU session id
392 kal_uint8 qfi; // (5G) QoS Flow Id
393 kal_uint32 t3583;
394 pkt_filter_struct pf; // packet filter
395
396} tftlib_rqos_rule_struct;
397
398
399// pdus info
400typedef struct {
401 kal_uint8 cid; // context id
402 kal_uint8 qos_flow_id; // (5G) QoS Flow Id
403 kal_uint8 qos_rule_id; // (5G) QoS Rule Id
404 kal_uint8 qr_precedence; // (5G) precedence value of QoS rule
405 kal_bool dqr_bit; // (5G)Indicate whether the QoS rule is the default QoS rule
406} qos_rule_info_struct;
407
408typedef struct {
409 kal_uint8 psi; // (5G) pdu session id
410 kal_uint8 qos_flow_count;
411 kal_uint8 qos_rule_list_len;
412
413 // psi's info
414 qos_rule_info_struct qos_rule_list[TFTLIB_MAX_QR_NUM_PER_PDUS]; // (5G) QoS Rule Id List
415} pdus_info_struct;
416
417
418// bearer info
419typedef struct {
420 kal_uint8 ebi; // in 23G: nsapi
421
422 // ebi's info
423 kal_uint8 cid;
424 // kal_uint8 link_ebi; // in 23G: nsapi of primary cid
425} bearer_info_struct;
426
427#endif /* TFTLIB_COMMON_STRUCT_H_ */