JIRA ID:[ODUHIGH-296]-Dl Data Changes from DUAPP to RLC
[o-du/l2.git] / src / cm / kwu.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /********************************************************************20**
20   
21         Name:    KWU user interface
22     
23         Type:    C include file
24   
25         Desc:    This file Contains the Data structures and prototypes
26                  for KWU Interface
27  
28         File:    kwu.x
29   
30 *********************************************************************21*/
31
32 #ifndef __KWU_X__
33 #define __KWU_X__
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif  /*for extern "C"*/
38
39 /** @file kwu.x
40     @brief KWU Interface File (kwu.x)
41 */
42  
43 /***********************************************************************
44                           KWU typedefs and data structures
45  ***********************************************************************/
46
47 /** @brief Data Request Information from RRC or PDCP to RLC */
48 typedef struct kwuDatReqInfo
49 {
50    CmLteRlcId        rlcId;               /*!< RLC ID */
51    uint32_t               sduId;               /*!< SDU ID */
52 #ifdef CCPU_OPT
53    CmLteLcType       lcType;              /*!<Logical Channel Type */ 
54 #ifdef EMTC_ENABLE
55    uint8_t                emtcDiReason;    /* !< DI reason */
56    uint8_t                pnb;                  /*!<paging narrowBand on which Ue perform Paging Reception*/
57 #endif
58    union
59    {
60       CmLteTimingInfo   tmg;              /*!< Timing  for BCCH/PCCH */
61       CmLteRnti         rnti;             /*!< Temporary CRNTI:Applicable for CCCH. */
62    }tm;                                   /*!< TM mode data */
63 #endif                                    /* CCPU_OPT */
64 }RlcDatReqInfo;
65
66 /** @brief Data Indication Information from RLC to RRC or PDCP */
67 typedef struct kwuDatIndInfo
68 {
69    CmLteRlcId        rlcId;               /*!< RLC ID */
70 #ifdef CCPU_OPT
71    CmLteRnti         tCrnti;              /*!< Temporary C-RNTI for UL-CCCH */
72 #endif                                    /* CCPU_OPT */
73    Bool              isOutOfSeq;          /*!< To indicate whether this packet is in-sequence or not */
74 }KwuDatIndInfo;
75
76 /** @brief Data Confirmation Information from RLC to PDCP
77     This primitive will be sent on successful sdu delivery */
78 typedef struct kwuDatCfmInfo
79 {
80   CmLteRlcId         rlcId;          /*!< RLC ID */
81   uint32_t                numSduIds;      /*!< Number of Id's in the sudIds array */
82   uint32_t                sduIds[KWU_MAX_DAT_CFM];    /*!< SDU Ids */
83 }KwuDatCfmInfo;
84
85 /** @brief Discard SDU Request Information from PDCP to RLC */
86 typedef KwuDatCfmInfo KwuDiscSduInfo;
87
88 /** @brief SDU Retransmission Threshold reached from RLC to PDCP */
89 typedef struct kwuStaIndInfo
90 {
91    CmLteRlcId        rlcId;               /*!< RLC ID */
92    uint32_t               numSdu;              /*!< Number of SDUs */
93    uint32_t               sduId[KWU_MAX_STA_IND_SDU]; /*!< SDU Id Array */
94 }KwuStaIndInfo;
95
96 typedef struct kwuFlowCntrlIndInfo
97 {
98    CmLteRlcId   rlcId; 
99    uint32_t          pktAdmitCnt;
100 }KwuFlowCntrlIndInfo;
101 /* kwu_x_001.main_3 Added support for L2 Measurement */
102 #ifdef LTE_L2_MEAS
103 /** @brief Data ACK  from RLC to PDCP */
104 typedef struct kwuDatAckInfo
105 {
106    CmLteRlcId        rlcId;               /*!< RLC ID */
107    uint32_t               sduId;               /*!< SDU Id Array */
108 }KwuDatAckInfo;
109 #endif /* LTE_L2_MEAS */
110
111 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
112 typedef struct kwuDatReqDetl
113 {
114   SpId         spId;
115   Buffer       *mBuf;
116   CmLteLcType  lcType;
117   Ticks        arrTime; 
118   uint32_t          sduId;
119   CmLteRlcId   rlcId;
120 }KwuDatReqDetl;
121 #endif 
122
123 /* Control primitives towards LTE RRC */
124 typedef S16 (*KwuBndReq)      ARGS((Pst *pst, SuId suId,  SpId spId));
125 typedef S16 (*KwuBndCfm)      ARGS((Pst *pst, SuId suId, uint8_t status));
126 typedef S16 (*KwuUbndReq)     ARGS((Pst *pst, SuId suId, Reason reason));
127
128 typedef S16 (*KwuDatReq)      ARGS((Pst *pst, RlcDatReqInfo* datReq, Buffer *mBuf));
129 typedef uint8_t (*KwuDatInd)      ARGS((Pst *pst, KwuDatIndInfo* datInd,
130          Buffer *mBuf));
131 typedef S16 (*KwuDatCfm)      ARGS((Pst *pst, SuId suId, KwuDatCfmInfo* datCfm));
132 typedef S16 (*KwuDiscSduReq)  ARGS((Pst *pst, SpId spId, KwuDiscSduInfo* discSdu));
133 typedef S16 (*KwuStaInd)      ARGS((Pst *pst, SuId suId, KwuStaIndInfo* staInd));
134 typedef S16 (*KwuFlowCntrlInd)ARGS((Pst *pst, SuId suId, KwuFlowCntrlIndInfo* flowCntrlInd));
135 typedef S16 (*KwuReEstCmpInd) ARGS((Pst *pst, SuId suId, CmLteRlcId rlcId));
136
137 /* kwu_x_001.main_3 Added support for L2 Measurement */
138 #ifdef LTE_L2_MEAS
139 typedef S16 (*KwuDatAckInd) ARGS((Pst *pst, SuId suId, KwuDatAckInfo *ackInfo));
140 #endif /* LTE_L2_MEAS */
141 typedef S16 (*KwuDiscSduCfm) ARGS((Pst *pst, SuId suId, KwuDiscSduInfo *discCfmInfo));
142
143 /** 
144  * @details This primitive binds the RLC service user entity to the RLC product.
145  * The RLC service user must bind each KWU SAP individually before sending any
146  * other request. RLC acknowledges the receipt of the bind request by sending
147  * a RlcUiKwuBndCfm primitive.
148
149  * @param[in] pst    -  For the bind request, the event field in the Pst structure is set to
150 EVTKWUBNDREQ
151  * @param[in] suId   -  The ID of the service user SAP associated with the SAP in the RLC
152 layer. The SSAP in the RLC layer is specified by the spId parameter.
153 Allowable values: 0 to 32767.
154  * @param[in] spId   -  The ID of the service provider SAP in the RLC layer. Allowable values: 0 to 32767.
155  * @return  S16 
156  *    -# ROK
157  *    -# RFAILED
158  */
159 S16 RlcUiKwuBndReq ARGS((Pst *pst,
160          SuId suId,
161          SpId spId));
162
163 /** 
164  * @details RLC invokes the bind confirm primitive to acknowledge the receipt
165  * of the RlcUiKwuBndReq primitive from the service user. The status field
166  * indicates whether the bind request succeeded or failed. The bind request
167  * may fail due to invalid parameters in the bind request from the
168  * service user (for example, an invalid spId).
169
170  * @param[in] pst    -  For the bind confirm, the event field in the Pst structure is set to
171 EVTKWUBNDCFM
172  * @param[in] suId   -  The ID of the service user SAP specified in the bind request. Allowable
173 values: 0 to 32767.
174  * @param[in] status -  Indicates the status of the bind request.\n
175 CM_BND_OK: Bind request succeeded\n
176 CM_BND_NOK: Error encountered during the processing of the bind request.
177  * @return  S16 
178  *    -# ROK
179  *    -# RFAILED
180  */
181 S16 RlcUiKwuBndCfm ARGS((Pst *pst,
182          SuId suId,
183          uint8_t status));
184
185 /** 
186  * @details The RLC service user initiates this primitive for performing
187  * an unbind operation.This primitive brings the link down if it is already up,
188  * and releases all the resources associated for this SAP at RLC.
189
190  * @param[in] pst    -  For the unbind request, the event field in the Pst structure is set to
191 EVTKWUUBNDREQ
192  * @param[in] spId   -  The ID of the service provider SAP in the RLC layer that is to be
193 disassociated from its service user SAP. Allowable values: 0 to 32767.
194  * @param[in] reason -  Reason for the unbind. Allowable value: KWU_UBND_REQ.
195  * @return  S16
196  *    -# ROK
197  *    -# RFAILED
198  */
199 S16 RlcUiKwuUbndReq ARGS((Pst *pst,
200          SpId spId,
201          Reason reason));
202
203 /**
204  *@details This primitive is used by RLC to transfer the SDU data to the service
205  user (RRC/PDCP) recieved from the peer RLC. RLC will send the data to service
206  user (RRC/PDCP) by reassembling the PDUs recieved from the peer RLC.
207
208  * @param pst    -  Pointer to the pst structure
209  * @param suId   -  Service user ID
210  * @param datInd -  Data indication parameter
211  * @param buf    -  RLC SDU
212  * @return  S16
213  *   -# ROK
214  *   -# RFAILED
215  */
216 S16 rlcSendUlDataToDu ARGS((Pst *pst,
217        KwuDatIndInfo* datInd,
218        Buffer *mBuf));
219
220 /**
221  *@details This primitive is used by RLC as the confirmation for the RlcProcDlData
222  to the service user (RLC/PDCP). It is used only in AM mode data transfers for
223  RLC.
224
225  * @param[in] pst    -  Pointer to the pst structure
226  * @param[in] suId   -  Service user ID
227  * @param[in] datCfm -  Data confirmation parameter
228  * @return  S16 
229  *   -# ROK
230  *   -# RFAILED 
231  */
232 S16 RlcUiKwuDatCfm ARGS((Pst *pst,
233          SuId suId,
234          KwuDatCfmInfo* datCfm));
235
236 /**
237  *@details This primitive is used by PDCP to discard the particular SDU to RLC.
238  It is used only in AM mode data transfers for RLC. RLC discards this SDU
239  if no segment of the RLC SDU has been mapped to a RLC data PDU yet.
240
241  * @param[in] pst     -  Pointer to the pst structure
242  * @param[in] spId    -  Service provider ID
243  * @param[in] discSdu -  Discard SDU parameter
244  * @return  S16 
245  *   -# ROK
246  *   -# RFAILED
247  */
248 S16 RlcUiKwuDiscSduReq ARGS((Pst *pst,
249          SpId spId,
250          KwuDiscSduInfo* discSdu));
251
252 /**
253  *@details This primitive is used by RRC to discard the particular SDU to RLC.
254  It is used only in AM mode data transfers for RLC. RLC discards this SDU
255  if no segment of the RLC SDU has been mapped to a RLC data PDU yet.
256
257  * @param[in] pst    -  Pointer to the pst structure
258  * @param[in] suId   -  Service provider ID
259  * @param[in] rlcId  -  RLC ID
260  * @return  S16
261  *   -# ROK
262  *   -# RFAILED
263  */
264 S16 RlcUiKwuStaInd ARGS((Pst *pst,
265          SuId suId,
266          KwuStaIndInfo* staInd));
267
268 /* kwu_x_001.main_3 Added support for L2 Measurement */
269 /**
270  *@details This primitive is used by RLC to confirm the positive discard 
271  of a particular SDU to PDCP.  
272
273  * @param[in] pst          -  Pointer to the pst structure
274  * @param[in] spId         -  Service provider ID
275  * @param[in] discCfmSdu   -  Discard Cfm SDU parameter
276  * @return  S16 
277  *   -# ROK
278  *   -# RFAILED
279  */
280 S16 RlcUiKwuDiscSduCfm ARGS((Pst *pst,
281          SpId spId,
282          KwuDiscSduInfo* discCfmSdu));
283
284 /**
285  *@details This primitive is used by RLC to indicate to PDCP if packets
286  *         need to be dropped/restarted for a particular RB
287  *
288  * @param[in] pst                -  Pointer to the pst structure
289  * @param[in] suId               -  Service user ID
290  * @param[in] flowCntrlIndInfo   -  Flow control information
291  * @return  S16 
292  *   -# ROK
293  *   -# RFAILED
294  */
295 S16 RlcUiKwuFlowCntrlInd ARGS((Pst *pst,
296          SuId suId,
297          KwuFlowCntrlIndInfo* flowCntrlIndInfo));
298 #ifdef LTE_L2_MEAS
299 /**
300  *@details This primitive is used by RLC to inform PDCP of the sucessful
301  reception of a particular data message at the peer side. This confirms
302  only positive acknowlegements at the peer side . 
303
304  * @param[in] pst    -  Pointer to the pst structure
305  * @param[in] suId   -  Service provider ID
306  * @param[in] ackInd -  Data Ack Indication parameter
307  * @return  S16
308  *   -# ROK
309  *   -# RFAILED
310  */
311 S16 RlcUiKwuDatAckInd ARGS((Pst *pst,
312          SuId suId,
313          KwuDatAckInfo* ackInd));
314 #endif /* LTE_L2_MEAS */
315
316 S16 RlcUiKwuReEstCmpInd ARGS((Pst *pst,
317          SuId suId,
318          CmLteRlcId rlcId
319 ));
320
321 /* RRC Extern Declarations */
322 #ifdef NH
323 S16 NhLiKwuBndReq ARGS((Pst *pst,
324          SuId suId,
325          SpId spId));
326
327 S16 NhLiKwuBndCfm ARGS((Pst *pst,
328          SuId suId,
329          uint8_t status));
330
331 S16 NhLiKwuUbndReq ARGS((Pst *pst,
332          SpId spId,
333          Reason reason));
334
335 S16 NhLiKwuDatReq ARGS((Pst *pst,
336          SpId spId,
337          RlcDatReqInfo* datReq,
338          Buffer *buf));
339
340 S16 NhLiKwuDatInd ARGS((Pst *pst,
341          KwuDatIndInfo* datInd,
342          Buffer *buf));
343 #endif /* NH */
344
345 /* Dummy RRC Interface primitives */
346 #ifdef DM
347 S16 DmUiKwuBndReq ARGS((Pst *pst,
348          SuId suId,
349          SpId spId));
350
351 S16 DmUiKwuBndCfm ARGS((Pst *pst,
352          SuId suId,
353          uint8_t status));
354
355 S16 DmUiKwuUbndReq ARGS((Pst *pst,
356          SpId spId,
357          Reason reason));
358
359 S16 DmUiKwuDatReq ARGS((Pst *pst,
360          SpId spId,
361          RlcDatReqInfo* datReq,
362          Buffer *buf));
363
364 S16 DmUiKwuDatInd ARGS((Pst *pst,
365          SuId suId,
366          KwuDatIndInfo* datInd,
367          Buffer *buf));
368
369 S16 DmUiKwuReEstCmpInd ARGS((Pst *pst,
370          SuId suId, CmLteRlcId rlcId));
371
372 #endif /* DM */
373
374 /* PDCP Extern Declarations */
375 #ifdef PJ
376 S16 PjLiKwuBndReq ARGS((Pst *pst,
377          SuId suId,
378          SpId spId));
379
380 S16 PjLiKwuBndCfm ARGS((Pst *pst,
381          SuId suId,
382          uint8_t status));
383
384 S16 PjLiKwuUbndReq ARGS((Pst *pst,
385          SpId spId,
386          Reason reason));
387
388 S16 PjLiKwuDatReq ARGS((Pst *pst,
389          SpId spId,
390          RlcDatReqInfo* datReq,
391          Buffer *buf));
392
393 S16 PjLiKwuDatInd ARGS((Pst *pst,
394          KwuDatIndInfo* datInd,
395          Buffer *buf));
396
397 S16 PjLiKwuDatCfm ARGS((Pst *pst,
398          SuId suId,
399          KwuDatCfmInfo* datCfm));
400
401 S16 PjLiKwuStaInd ARGS((Pst *pst,
402          SuId suId,
403          KwuStaIndInfo* staInd));
404
405 S16 PjLiKwuDiscSduReq ARGS((Pst *pst,
406          SpId spId,
407          KwuDiscSduInfo* discSdu));
408
409
410 S16 PjLiKwuReEstCmpInd ARGS((Pst *pst,
411          SuId suId, CmLteRlcId rlcId));
412
413 /* kwu_x_001.main_3 Added support for L2 Measurement */
414 S16 PjLiKwuDiscSduCfm ARGS((Pst *pst,
415          SpId spId,
416          KwuDiscSduInfo* discCfmSdu));
417 S16 PjLiKwuFlowCntrlInd ARGS((Pst *pst,       
418          SuId suId,       
419          KwuFlowCntrlIndInfo *flowCntrlInfo));
420 #ifdef LTE_L2_MEAS
421 S16 PjLiKwuDatAckInd ARGS((Pst *pst,
422          SuId suId,
423          KwuDatAckInfo* ackInd));
424 #endif /* LTE_L2_MEAS */
425
426 #endif /* PJ */
427 #ifdef MAC_RLC_UL_RBUF
428 S16 rlcUlBatchProc ARGS((Void));
429 #endif 
430 /*****************************************************************************
431  *                      PACK/UNPACK FUNCTIONS
432  ****************************************************************************/
433 #ifdef LCKWU
434 /* Packing Functions */
435 uint8_t cmPkRlcDatReqInfo ARGS ((
436 RlcDatReqInfo *param,
437 Buffer *mBuf
438 ));
439
440 uint8_t cmPkKwuDatIndInfo ARGS ((
441 KwuDatIndInfo *param,
442 Buffer *mBuf
443 ));
444
445 S16 cmPkKwuDatCfmInfo ARGS ((
446 KwuDatCfmInfo *param,
447 Buffer *mBuf
448 ));
449
450 S16 cmPkKwuStaIndInfo ARGS ((
451 KwuStaIndInfo *param,
452 Buffer *mBuf
453 ));
454
455 S16 cmPkKwuBndReq ARGS ((
456 Pst * pst,
457 SuId suId,
458 SpId spId
459 ));
460
461 S16 cmPkKwuUbndReq ARGS ((
462 Pst * pst,
463 SuId suId,
464 Reason reason
465 ));
466
467 S16 cmPkKwuBndCfm ARGS ((
468 Pst * pst,
469 SuId suId,
470 uint8_t status
471 ));
472
473 uint8_t cmPkRlcDatReq ARGS ((
474 Pst * pst,
475 RlcDatReqInfo* datReq,
476 Buffer * mBuf
477 ));
478
479 uint8_t cmPkKwuDatInd ARGS ((
480 Pst * pst,
481 KwuDatIndInfo* datInd,
482 Buffer * mBuf
483 ));
484
485 S16 cmPkKwuDatCfm ARGS ((
486 Pst * pst,
487 SuId suId,
488 KwuDatCfmInfo* datCfm
489 ));
490
491 S16 cmPkKwuStaInd ARGS ((
492 Pst * pst,
493 SuId suId,
494 KwuStaIndInfo* staInd
495 ));
496
497 S16 cmPkKwuReEstCmpInd ARGS ((
498 Pst * pst,
499 SuId suId,
500 CmLteRlcId rlcId
501 ));
502
503 S16 cmPkKwuDiscSduReq ARGS ((
504 Pst * pst,
505 SpId spId,
506 KwuDiscSduInfo* discSdu
507 ));
508
509 /* kwu_x_001.main_3 Added support for L2 Measurement */
510 #ifdef LTE_L2_MEAS
511 S16 cmPkKwuDatAckInfo ARGS ((
512 KwuDatAckInfo* datAckInd,
513 Buffer * mBuf
514 ));
515
516 S16 cmPkKwuDatAckInd ARGS ((
517 Pst * pst,
518 SuId suId,
519 KwuDatAckInfo* ackInfo
520 ));
521 #endif /* LTE_L2_MEAS */
522
523 S16 cmPkKwuDiscSduCfm ARGS ((
524 Pst * pst,
525 SpId spId,
526 KwuDiscSduInfo* cfmSdu
527 ));
528
529 S16 cmPkKwuFlowCntrlInd ARGS ((
530 Pst *pst,
531 SuId suId,
532 KwuFlowCntrlIndInfo *flowCntrlIndInfo
533 ));
534
535 /* Unpacking Functions */
536 S16 cmUnpkRlcDatReqInfo ARGS ((
537 RlcDatReqInfo *param,
538 Buffer *mBuf
539 ));
540
541 uint8_t cmUnpkKwuDatIndInfo ARGS ((
542 KwuDatIndInfo *param,
543 Buffer *mBuf
544 ));
545
546 S16 cmUnpkKwuDatCfmInfo ARGS ((
547 KwuDatCfmInfo *param,
548 Buffer *mBuf
549 ));
550
551 S16 cmUnpkKwuStaIndInfo ARGS ((
552 KwuStaIndInfo *param,
553 Buffer *mBuf
554 ));
555
556 S16 cmUnpkKwuBndReq ARGS ((
557 KwuBndReq func,
558 Pst *pst,
559 Buffer *mBuf
560 ));
561
562 S16 cmUnpkKwuUbndReq ARGS ((
563 KwuUbndReq func,
564 Pst *pst,
565 Buffer *mBuf
566 ));
567
568 S16 cmUnpkKwuBndCfm ARGS ((
569 KwuBndCfm func,
570 Pst *pst,
571 Buffer *mBuf
572 ));
573
574 S16 cmUnpkKwuDatReq ARGS ((
575 KwuDatReq func,
576 Pst *pst,
577 Buffer *mBuf
578 ));
579
580 uint8_t cmUnpkKwuDatInd ARGS ((
581 KwuDatInd func,
582 Pst *pst,
583 Buffer *mBuf
584 ));
585
586 S16 cmUnpkKwuDatCfm ARGS ((
587 KwuDatCfm func,
588 Pst *pst,
589 Buffer *mBuf
590 ));
591
592 S16 cmUnpkKwuStaInd ARGS ((
593 KwuStaInd func,
594 Pst *pst,
595 Buffer *mBuf
596 ));
597
598 S16 cmUnpkKwuReEstCmpInd ARGS ((
599 KwuReEstCmpInd func,
600 Pst *pst,
601 Buffer *mBuf
602 ));
603 S16 cmUnpkKwuDiscSduReq ARGS ((
604 KwuDiscSduReq func,
605 Pst *pst,
606 Buffer *mBuf
607 ));
608
609 S16 cmUnpkKwuFlowCntrlInd ARGS ((
610 KwuFlowCntrlInd func,
611 Pst *pst,
612 Buffer *mBuf
613 ));
614
615 /* kwu_x_001.main_3 Added support for L2 Measurement */
616 #ifdef LTE_L2_MEAS
617 S16 cmUnpkKwuDatAckInfo ARGS ((
618 KwuDatAckInfo *param,
619 Buffer *mBuf
620 ));
621
622 S16 cmUnpkKwuDatAckInd ARGS ((
623 KwuDatAckInd func,
624 Pst *pst,
625 Buffer *mBuf
626 ));
627 #endif /* LTE_L2_MEAS */
628
629 S16 cmUnpkKwuDiscSduCfm ARGS ((
630 KwuDiscSduCfm func,
631 Pst *pst,
632 Buffer *mBuf
633 ));
634
635 S16 cmPkKwuFlowCntrlIndInfo ARGS((
636 KwuFlowCntrlIndInfo *param,
637 Buffer              *mBuf
638 ));
639
640 S16 cmUnpkKwuFlowCntrlIndInfo ARGS((
641 KwuFlowCntrlIndInfo *param,
642 Buffer              *mBuf
643 ));
644
645 #endif /* LCKWU */
646
647 #ifdef __cplusplus
648 }
649 #endif /* __cplusplus */
650 #endif /* __KWU_X__ */
651
652 \f  
653 /********************************************************************30**
654          End of file
655 **********************************************************************/