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) 2016 |
| 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 | * This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc. |
| 38 | * |
| 39 | * Any unauthorized use inconsistent with the terms of such license is strictly prohibited. |
| 40 | * |
| 41 | * Copyright (c) 2010 VIA Telecom, Inc. All rights reserved. |
| 42 | * |
| 43 | *************************************************************/ |
| 44 | #ifndef _PAFRLP_H_ |
| 45 | #define _PAFRLP_H_ 1 |
| 46 | |
| 47 | #include "paflist.h" |
| 48 | #include "cpbuf.h" |
| 49 | #include "hlpapi.h" |
| 50 | #include "fcpdefs.h" |
| 51 | #include "do_rcpapi.h" |
| 52 | #include "do_rcp_msgid.h" |
| 53 | |
| 54 | #include "kal_public_api.h" |
| 55 | #include "kal_public_defs.h" |
| 56 | #include "md_sap.h" |
| 57 | |
| 58 | |
| 59 | #define NUM_RLP_RESEQ_REC 1500 |
| 60 | #define FCP_TASK_INTERVAL 4 |
| 61 | #define PAF_RLP_ABORT_TIMER_INTERVAL 500 /*500 ms for abort timer. */ |
| 62 | #define PAF_RLP_FLUSH_TIMER_INTERVAL 300 |
| 63 | #define PAF_RLP_DDW (48/FCP_TASK_INTERVAL) |
| 64 | #define PAF_RLP_ABORT_BACKOFF_INTERVAL 80 /*48 slot * 1.6667 */ |
| 65 | #define PAF_DATAPASS_UPPERLAYER_INTERVAL 1 |
| 66 | #define MAX_NAK_REC_NUM 20 /* Max NakRequests # in Nak msg */ |
| 67 | #ifdef CBP7_EHRPD |
| 68 | #define NUM_RLP_ROUTE_PROTOCOL_PKT_REC 1 |
| 69 | #endif |
| 70 | |
| 71 | |
| 72 | /* See 0x18 ~ 0x1c most of time in field test, which shall be from RLP_NAK. So if it is less than 0x14, flag monfault.*/ |
| 73 | #define DELAY_RLP_OCTET_NAK_FAULT_INTERVAL (20) |
| 74 | typedef enum |
| 75 | { |
| 76 | PAFRLP_NULL_ST, |
| 77 | PAFRLP_DATA_ST, |
| 78 | PAFRLP_RESET_ST, |
| 79 | PAFRLP_MAX_ST |
| 80 | } |
| 81 | PafRlpStateT; |
| 82 | |
| 83 | |
| 84 | typedef struct PafReseqRecT |
| 85 | { |
| 86 | kal_uint32 seq; |
| 87 | kal_uint16 len; |
| 88 | CpBufferT *datap; |
| 89 | kal_uint16 dataoffset; |
| 90 | #ifdef CBP7_EHRPD |
| 91 | kal_bool FirstDataUnit; |
| 92 | kal_bool LastDataUnit; |
| 93 | #endif |
| 94 | } PafReseqRecT; |
| 95 | |
| 96 | #ifdef CBP7_EHRPD |
| 97 | typedef struct |
| 98 | { |
| 99 | kal_uint32 seq; /* First seq of this route packet */ |
| 100 | kal_uint32 nextSeq; /* Next seq of this route packet to receive */ |
| 101 | kal_bool IsCompletedPacket; |
| 102 | LIST_STR routePacketQ; |
| 103 | } PafRouteProtocolPktT; |
| 104 | #endif |
| 105 | |
| 106 | typedef struct |
| 107 | { |
| 108 | kal_uint8 nAppType; |
| 109 | kal_uint8 nRLPFlow; |
| 110 | kal_uint8 RLPId; |
| 111 | kal_uint8 RLPIDLen; |
| 112 | kal_uint8 SeqLen; |
| 113 | PafRlpStateT stRlp; |
| 114 | kal_bool bFlowNakEnabled; |
| 115 | /*This is the timer for passing the in sequence RLP packet to upper layer*/ |
| 116 | kal_uint8 nDataPassUpperlayerInterval; |
| 117 | HlpRlpFwdDataPktT *pHlpRlpFwdDataIndMsg; |
| 118 | kal_uint32 vr; |
| 119 | kal_uint32 vn; |
| 120 | kal_uint32 ss; // Sequence Space for this RLP |
| 121 | LIST_STR reseqQ; |
| 122 | LIST_STR nakGapQ; |
| 123 | #ifdef CBP7_EHRPD |
| 124 | kal_uint8 RoutePDU; /* Octet stream or packet stream */ |
| 125 | kal_uint8 DataUnit; |
| 126 | kal_uint8 nRoute; |
| 127 | LIST_STR routeProtocolPktQ; |
| 128 | #endif |
| 129 | }PafRlpInstanceT; |
| 130 | |
| 131 | typedef struct PafNakGapRecT |
| 132 | { |
| 133 | kal_uint32 seq; |
| 134 | kal_uint16 len; |
| 135 | //initialized as the Tddw in units of slot when added be NakGapQ, will be |
| 136 | //descreased in PAFApplicationLayerProcessing() when received |
| 137 | //FCP_TASK_SIG and when it reaches zero, the NAK for this gap should be sent. |
| 138 | kal_uint8 nTicksForNak; |
| 139 | kal_uint32 time; |
| 140 | kal_uint32 tNakSent; |
| 141 | kal_bool bNakSent; |
| 142 | kal_bool bTimerRunning; |
| 143 | } PafNakGapRecT; |
| 144 | |
| 145 | typedef struct |
| 146 | { |
| 147 | kal_uint32 FirstErased; |
| 148 | kal_uint16 WindowLen; |
| 149 | } PafRlpNakReqT; |
| 150 | |
| 151 | typedef struct |
| 152 | { |
| 153 | kal_uint8 NumNakRequest; |
| 154 | PafRlpNakReqT NakRequest[MAX_NAK_REC_NUM]; |
| 155 | }PafRlpNakInfoT; |
| 156 | |
| 157 | typedef struct |
| 158 | { |
| 159 | LIST_NODE ResQNodeList[NUM_RLP_RESEQ_REC]; |
| 160 | LIST_STR ResQFreeNodes; |
| 161 | LIST_STR ResQIdleList; |
| 162 | |
| 163 | PafReseqRecT resPool[NUM_RLP_RESEQ_REC]; |
| 164 | LIST_NODE NakGapNodeList[NUM_RLP_RESEQ_REC]; |
| 165 | LIST_STR NakGapFreeNodes; |
| 166 | LIST_STR NakGapIdleList; |
| 167 | PafNakGapRecT nakGapPool[NUM_RLP_RESEQ_REC]; |
| 168 | #ifdef CBP7_EHRPD |
| 169 | LIST_NODE RouteProtocolQNodeList[NUM_RLP_ROUTE_PROTOCOL_PKT_REC]; |
| 170 | LIST_STR RouteProtocolQFreeNodes; |
| 171 | LIST_STR RouteProtocolQIdleList; |
| 172 | PafRouteProtocolPktT RouteProtocolPool[NUM_RLP_ROUTE_PROTOCOL_PKT_REC]; |
| 173 | #endif |
| 174 | } PafRlpBufPool; |
| 175 | |
| 176 | |
| 177 | typedef PACKED_PREFIX struct |
| 178 | { |
| 179 | kal_uint16 EVDORevAFwdMFRLPStatsFlowId; |
| 180 | kal_uint32 EVDORevAFwdMFRLPStatsResetTime; |
| 181 | kal_uint16 EVDORevAFwdMFRLPStatsReXmitsNotFound; |
| 182 | kal_int64 EVDORevAFwdMFRLPStatsATNakBytesRequested; |
| 183 | kal_int64 EVDORevAFwdMFRLPStatsRxDuplicateBytes; |
| 184 | kal_int64 EVDORevAFwdMFRLPStatsRxReXmitsBytes; |
| 185 | kal_int64 EVDORevAFwdMFRLPStatsRxNewDataBytes; |
| 186 | kal_int64 EVDORevAFwdMFRLPStatsRxTotalBytes; |
| 187 | kal_int32 EVDORevAFwdMFRLPStatsNaksSent; |
| 188 | kal_int32 EVDORevAFwdMFRLPStatsRxNakTimesOuts; |
| 189 | kal_int32 EVDORevAFwdMFRLPStatsResetCount; |
| 190 | kal_uint16 EVDORevAFwdMFRLPStatsATResetRequestCount; |
| 191 | kal_uint16 EVDORevAFwdMFRLPStatsANResetAckCount; |
| 192 | kal_uint16 EVDORevAFwdMFRLPStatsANResetRequestCount; |
| 193 | } PACKED_POSTFIX EVDORevAFwdMFRLPStatsMeasT; |
| 194 | |
| 195 | typedef PACKED_PREFIX struct |
| 196 | { |
| 197 | EVDORevAFwdMFRLPStatsMeasT rlpMeas[MAX_RLP_FLOW_SUPPORTED]; |
| 198 | } PACKED_POSTFIX EVDORevAFwdMFRLPStatsEventT; |
| 199 | |
| 200 | typedef PACKED_PREFIX struct |
| 201 | { |
| 202 | kal_uint32 SysTime; |
| 203 | EVDORevAFwdMFRLPStatsMeasT rlpMeas[MAX_RLP_FLOW_SUPPORTED]; |
| 204 | } PACKED_POSTFIX PafMfpaRlpStatPeekRspMsgT; |
| 205 | |
| 206 | typedef PACKED_PREFIX struct |
| 207 | { |
| 208 | kal_uint32 SysTime; |
| 209 | EVDORLPStatsMeasT rlpMeas; |
| 210 | } PACKED_POSTFIX PafDpaRlpStatPeekRspMsgT; |
| 211 | |
| 212 | typedef struct |
| 213 | { |
| 214 | kal_uint32 ulTaskId; |
| 215 | kal_uint32 ulSapId; |
| 216 | }PafSapInfo; |
| 217 | void PafInit(void); |
| 218 | void PafRlpInit(PafRlpInstanceT *pRlpInstance); |
| 219 | void PafRlpCspConnCloseMsg(PafRlpInstanceT *pRlpInstance); |
| 220 | void PafRlpIdpConnOpenMsg(PafRlpInstanceT *pRlpInstance); |
| 221 | void PafRlpReset(PafRlpInstanceT *pRlpInstance); |
| 222 | kal_uint32 PafRlpGetSeqSpace(kal_uint8 s); |
| 223 | |
| 224 | kal_bool PafRlpFrameDecode(kal_uint8 nAppType, FwdLinkPktT *pNode, kal_uint8 *pRLPFlow, PafReseqRecT **pReseq); |
| 225 | void PafRlpFrameRecv(PafRlpInstanceT *pRlpInstance, PafReseqRecT *pReseq); |
| 226 | void PafRlpBufferFramesForUpperLayerDelivery(PafRlpInstanceT *pRlpInstance, PafReseqRecT *pReseq); |
| 227 | void PafRlpServiceNakTimer(PafRlpInstanceT *pRlpInstance); |
| 228 | void PafRlpAbortTmrExpired(PafRlpInstanceT *pRlpInstanace); |
| 229 | void PafRlpResetTxIndAllFlowMsg(PafRlpInstanceT *pRlpInstance, kal_uint8 nRlpFlow); |
| 230 | void PafRlpResetTxIndMsg(PafRlpInstanceT *pRlpInstance, kal_uint8 nRlpFlow); |
| 231 | void PafRlpResetRxIndMsg(PafRlpInstanceT *pRlpInstance); // ResetAck to DPA |
| 232 | void PafRlpResetTxCompleteMsg(PafRlpInstanceT *pRlpInstance); |
| 233 | void PafRlpResetRxCompleteMsg(PafRlpInstanceT *pRlpInstance); |
| 234 | kal_bool PafRlpSendDsarMsg(DsaRevMsgT *MsgDataP); |
| 235 | void PafRlpStateSet(PafRlpInstanceT *pRlpInstance, PafRlpStateT rlpState); |
| 236 | PafRlpStateT PafRlpStateGet(PafRlpInstanceT *pRlpInstance); |
| 237 | |
| 238 | #ifdef CBP7_EHRPD |
| 239 | void PafRlpPacketFrameRecv(PafRlpInstanceT *pRlpInstance, PafReseqRecT *pReseq); |
| 240 | void PafRlpIpPacketFramesForUpperLayerDelivery(PafRlpInstanceT *pRlpInstance, PafRouteProtocolPktT *pRouteProtocolPkt); |
| 241 | void PafRlpPacketAbortTmrExpired(PafRlpInstanceT *pRlpInstance); |
| 242 | #endif |
| 243 | |
| 244 | void PafResetLastRLPStat(void); |
| 245 | |
| 246 | #endif /*_PAFRLP_H_*/ |
| 247 | |