lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /************************************************************************
|
| 2 | * °æÈ¨ËùÓÐ (C)2001,ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
|
| 3 | *
|
| 4 | * ÎļþÃû³Æ: psbuf.h
|
| 5 | * Îļþ±êʶ:
|
| 6 | * ÄÚÈÝÕªÒª: Êý¾ÝÃæ»º´æÏà¹Ø½á¹¹Ì嶨Òå¡¢ºê¶¨ÒåºÍº¯ÊýÉùÃ÷
|
| 7 | *
|
| 8 | * ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
|
| 9 | * ---------------------------------------------------------------------
|
| 10 | * 2012/06/15 V1.0 create
|
| 11 | ************************************************************************/
|
| 12 |
|
| 13 | #ifndef _PS_BUF_H
|
| 14 | #define _PS_BUF_H
|
| 15 |
|
| 16 | /**************************************************************************
|
| 17 | * Í·Îļþ°üº¬ *
|
| 18 | **************************************************************************/
|
| 19 |
|
| 20 | /**************************************************************************
|
| 21 | È«¾Ö±äÁ¿ÉùÃ÷
|
| 22 | **************************************************************************/
|
| 23 | extern WORD gLinkAlignOffset;
|
| 24 | extern WORD g_l2_wUpLinkSDUNum;
|
| 25 | extern WORD g_l2_wEpdcpPDUNum;
|
| 26 |
|
| 27 | /**************************************************************************
|
| 28 | PSÊý¾ÝÃæÓÅ»¯Ïà¹Ø
|
| 29 | **************************************************************************/
|
| 30 | /**************************************************************************
|
| 31 | * Ïà¹Øºê¶¨Òå *
|
| 32 | **************************************************************************/
|
| 33 | #define Z_LINK_ALIGN_OFFSET gLinkAlignOffset
|
| 34 | /* PSÊý¾ÝÃæ£¬ÉÏÐлº´æÐèÒªÔ¤ÁôÊý¾ÝÇø´óС */
|
| 35 |
|
| 36 | #define Z_UP_PPP_MAX_SIZE (1520 + 100)
|
| 37 | #define Z_UP_IP_MAX_SIZE 1520
|
| 38 | #define LL_MAX_HEADER 48//64
|
| 39 | #define Z_UP_LINK_RESERVE LL_MAX_HEADER
|
| 40 | #define Z_UL_PDU_BUF_SIZE 1600
|
| 41 | /* PSÊý¾ÝÃæ£¬ÉÏÐÐPPPÊý¾Ý°üµÄ×î´óÖµ */
|
| 42 |
|
| 43 | #define Z_DOWN_LINK_RESERVE_IP (LL_MAX_HEADER + 16)
|
| 44 | #define Z_DOWN_LINK_RESERVE_MAC (LL_MAX_HEADER + 14)
|
| 45 | #define Z_DOWN_RLCSDU_MAX_SIZE 1504
|
| 46 |
|
| 47 | /* PSÊý¾ÝÃæ£¬ÏÂÐлº´æÐèÒªÔ¤ÁôÊý¾ÝÇø´óС */
|
| 48 | #define Z_DOWN_LINK_RESERVE (Z_DOWN_LINK_RESERVE_MAC + Z_LINK_ALIGN_OFFSET)
|
| 49 |
|
| 50 | #define Z_DDR_32 0
|
| 51 | #define Z_DDR_64 1
|
| 52 |
|
| 53 | #ifdef _OS_WIN
|
| 54 | /* PSÊý¾ÝÃæ£¬ÉÏ¡¢ÏÂÐлº´æ¿éµÄ¸öÊý */
|
| 55 | #define Z_UP_LINK_SDU_COUNT (1536 + 1792)//g_El2_wUpLinkSDUNum
|
| 56 | #define Z_DOWNLINK_SDU_COUNT 1792
|
| 57 |
|
| 58 | #define Z_LTE_EPDCP_PDU_COUNT 1536
|
| 59 |
|
| 60 | #else
|
| 61 | /*ps buffer memory size provided by product ddr*/
|
| 62 | #define Z_PS_BUFFER_MEM_SIZE DDR_BASE_LEN_PSBUF /* 2.5M */
|
| 63 |
|
| 64 | /* PSÊý¾ÝÃæ£¬ÉÏ¡¢ÏÂÐлº´æ¿éµÄ¸öÊý */
|
| 65 | #define Z_UP_LINK_SDU_COUNT g_l2_wUpLinkSDUNum//520 //1792
|
| 66 | #define Z_DOWNLINK_SDU_COUNT 0
|
| 67 | #define Z_LTE_EPDCP_PDU_COUNT g_l2_wUpLinkSDUNum // 520 //1536
|
| 68 |
|
| 69 | #endif
|
| 70 |
|
| 71 | #define Z_PLAT_DL_RESERVE (Z_DOWN_LINK_RESERVE - 14)
|
| 72 | #define Z_UL_DATA_DESC_SIZE 40
|
| 73 | #define Z_DL_DATA_DESC_SIZE 40
|
| 74 | #define Z_SKB_SHARE_INFO_SIZE 396 //400 //ºêÖµÓÉ 400¸ÄΪ396£¬±£Ö¤psbufµÄdataÓòΪ64×Ö½Ú¶ÔÆë
|
| 75 |
|
| 76 | //DHD°üÍ·×î´óÆ«ÒÆ
|
| 77 | #define Z_UL_DHD_MAX_OFFSET 64
|
| 78 | #define Z_OVERFLUD_SIZE 4
|
| 79 | //ec616000533092
|
| 80 | #define Z_UL_NODE_BUF_SIZE (((DWORD)(Z_UP_LINK_RESERVE + Z_UP_IP_MAX_SIZE + Z_SKB_SHARE_INFO_SIZE + Z_OVERFLUD_SIZE+63) >> 6) << 6)/*4×Ö½Ú»º´æ¸Äд±êÖ¾*/
|
| 81 | #define Z_UL_SDU_BUF_SIZE (Z_UP_LINK_RESERVE + Z_UP_IP_MAX_SIZE)
|
| 82 | //#define Z_DL_NODE_BUF_SIZE (Z_DOWN_LINK_RESERVE_IP + Z_DOWN_RLCSDU_MAX_SIZE + Z_SKB_SHARE_INFO_SIZE + Z_OVERFLUD_SIZE)
|
| 83 | //#define Z_DL_SDU_BUF_SIZE (Z_DOWN_LINK_RESERVE_IP + Z_DOWN_RLCSDU_MAX_SIZE)
|
| 84 |
|
| 85 | /* PSÊý¾ÝÃæ£¬¼ì²é»º´æ¿éÊÇ·ñ±»Öظ´Êͷűêʾ£¬ÄÚ²¿Ê¹Óò»¶ÔÍ⿪·Å */
|
| 86 | #define Z_BUFFER_NOFREED 0xA3A3A3A3//0xFEFEFEFE
|
| 87 | #define Z_BUFFER_FREED 0x00
|
| 88 | #define Z_BUFFER_NOFLUD 0xA3A3A3A3//0xFEFEFEFE
|
| 89 | /**************************************************************************
|
| 90 | * È«¾Ö½á¹¹ÀàÐÍ *
|
| 91 | **************************************************************************/
|
| 92 | /* PSÊý¾ÝÃæ£¬ÉÏÐлº´æ¿éµÄ½á¹¹ */
|
| 93 | typedef struct _Z_UpLink_Sdu {
|
| 94 | T_ZOss_Node tNode;
|
| 95 | BYTE tDataDescInfo[Z_UL_DATA_DESC_SIZE]; //±£´æTD»òLTEµÄÃèÊöÐÅÏ¢
|
| 96 | BYTE bCid;
|
| 97 | BYTE bPid; //ƽ̨ÓÃÓÚ±êʶÊÇ·ñΪTCP ACK°ü
|
| 98 | BYTE bNsapi;
|
| 99 | BYTE bAtiBuf;
|
| 100 | PBYTE pbPdcpPduAddr;
|
| 101 | WORD wIpPacketLen;
|
| 102 | WORD wIpPacketOffSet; // ÐèÒª³õʼ»¯
|
| 103 | BYTE bIsTcpAck;
|
| 104 | BYTE bPad[3];
|
| 105 | PBYTE Data;
|
| 106 | PBYTE tSkbShareInfo;
|
| 107 | PBYTE pbSkbAddr;
|
| 108 | } T_z_UpLink_Sdu;
|
| 109 |
|
| 110 | /* PSÊý¾ÝÃæ£¬ÏÂÐлº´æ¿éµÄ½á¹¹ */
|
| 111 | typedef struct _Z_DownLink_Sdu {
|
| 112 | T_ZOss_Node tNode;
|
| 113 | BYTE tDataDescInfo[Z_DL_DATA_DESC_SIZE]; //±£´æTD»òLTEµÄÃèÊöÐÅÏ¢
|
| 114 | BYTE bCid;
|
| 115 | BYTE bPid;
|
| 116 | BYTE bNsapi;
|
| 117 | BYTE bRbid;
|
| 118 | WORD abPadding1[2];/*¶ÔÓ¦ÉÏÐÐpbPdcpPduAddr£¬ÏÂÐд¦Àí²»ÄÜʹÓã¬
|
| 119 | ÒòÊͷŽڵãʱ²»Çø·ÖÉÏÏÂÐУ¬»á×÷ΪpbPdcpPduAddrµØÖ·½øÐлØÊÕ£¬
|
| 120 | Èô±»ÉÏÐÐÉêÇëµ½£¬¶Ô¸ÃµØÖ·²Ù×÷ʱ£¬»áÔì³ÉËÀ»ú*/
|
| 121 | WORD wDataLen;
|
| 122 | WORD wDataOffSet;
|
| 123 | WORD abPadding2[2];
|
| 124 | PBYTE Data;
|
| 125 | PBYTE tSkbShareInfo;
|
| 126 | PBYTE pbSkbAddr;
|
| 127 | } T_z_DownLink_Sdu;
|
| 128 |
|
| 129 | /* PSÊý¾ÝÃæ£¬ÉÏÐлº´æ¿é½Úµã½á¹¹£¬ÄÚ²¿Ê¹Óò»¶ÔÍ⿪·Å */
|
| 130 | typedef struct _T_z_UpLink_Node {
|
| 131 | T_z_UpLink_Sdu tUpLinkSdu;
|
| 132 | PDWORD pdwOverFlud;
|
| 133 | DWORD dwFreed;
|
| 134 | WORD wCurrentModule;
|
| 135 | WORD wNextModule;
|
| 136 | struct _T_z_UpLink_Node *ptNextNode;
|
| 137 | } T_z_UpLink_Node;
|
| 138 |
|
| 139 | /**************************************************************************
|
| 140 | * º¯ÊýÉùÃ÷ *
|
| 141 | **************************************************************************/
|
| 142 |
|
| 143 | /*****************************************************************************
|
| 144 | *º¯ÊýÃû³Æ : zAllocUlBuf
|
| 145 | *º¯Êý¹¦ÄÜ : ÉêÇëÉÏÐÐÊý¾Ý»º´æ
|
| 146 | *ÊäÈë²ÎÊý : VOID
|
| 147 | *·µ »Ø Öµ : PBYTE ÿ¿éÊý¾Ý»º´æÆ«ÒƺóµÄµØÖ·
|
| 148 | *ÆäËû˵Ã÷ : Ö§³Ö²¢·¢²Ù×÷£¬»º´æÎª¿Õʱ·µ»ØNULL
|
| 149 | *---------------------------------------------------------------------------
|
| 150 | *
|
| 151 | ****************************************************************************/
|
| 152 | PBYTE zAllocUlBuf(VOID);
|
| 153 |
|
| 154 | /*****************************************************************************
|
| 155 | *º¯ÊýÃû³Æ : zAllocDlBuf
|
| 156 | *º¯Êý¹¦ÄÜ : ÉêÇëÏÂÐÐÊý¾Ý»º´æ
|
| 157 | *ÊäÈë²ÎÊý : VOID
|
| 158 | *·µ »Ø Öµ : PBYTE ÿ¿éÊý¾Ý»º´æÆ«ÒƺóµÄµØÖ·
|
| 159 | *ÆäËû˵Ã÷ : Ö§³Ö²¢·¢²Ù×÷£¬»º´æÎª¿Õʱ·µ»ØNULL
|
| 160 | *---------------------------------------------------------------------------
|
| 161 | *
|
| 162 | ****************************************************************************/
|
| 163 | PBYTE zAllocDlBuf(VOID);
|
| 164 |
|
| 165 | /*****************************************************************************
|
| 166 | *º¯ÊýÃû³Æ : zAllocUlBufCanWait
|
| 167 | *º¯Êý¹¦ÄÜ : ÉêÇëÉÏÐÐÊý¾Ý»º´æ
|
| 168 | *ÊäÈë²ÎÊý : VOID
|
| 169 | *·µ »Ø Öµ : PBYTE ÿ¿éÊý¾Ý»º´æÆ«ÒƺóµÄµØÖ·
|
| 170 | *ÆäËû˵Ã÷ : Ö§³Ö²¢·¢²Ù×÷£¬»º´æÎª¿Õʱ×èÈûµ÷ÓÃÏß³ÌÖ±µ½ÓпÉÓõÄÏß³Ì
|
| 171 | *º¯Êý×÷Õß : ´´½¨ÈÕÆÚ: 2011-11-04
|
| 172 | *
|
| 173 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 174 | *---------------------------------------------------------------------------
|
| 175 | *
|
| 176 | ****************************************************************************/
|
| 177 | PBYTE zAllocUlBufCanWait(VOID);
|
| 178 |
|
| 179 | /*****************************************************************************
|
| 180 | *º¯ÊýÃû³Æ : zFreeUlBuf
|
| 181 | *º¯Êý¹¦ÄÜ : ÊÍ·ÅÉÏÐÐÊý¾Ý»º´æ
|
| 182 | *ÊäÈë²ÎÊý : VOID
|
| 183 | *·µ »Ø Öµ : PBYTE ÿ¿éÊý¾Ý»º´æÆ«ÒƺóµÄµØÖ·
|
| 184 | *ÆäËû˵Ã÷ : Ö§³Ö²¢·¢²Ù×÷£¬
|
| 185 | *º¯Êý×÷Õß : ´´½¨ÈÕÆÚ: 2011-11-04
|
| 186 | *
|
| 187 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 188 | *---------------------------------------------------------------------------
|
| 189 | *
|
| 190 | ****************************************************************************/
|
| 191 | VOID zFreeUlBuf(PBYTE pBuf);
|
| 192 |
|
| 193 | /*****************************************************************************
|
| 194 | *º¯ÊýÃû³Æ : zFreeDlBuf
|
| 195 | *º¯Êý¹¦ÄÜ : ÊÍ·ÅÏÂÐÐÊý¾Ý»º´æ
|
| 196 | *ÊäÈë²ÎÊý : VOID
|
| 197 | *·µ »Ø Öµ : PBYTE ÿ¿éÊý¾Ý»º´æµÄÊ×µØÖ·
|
| 198 | *ÆäËû˵Ã÷ : Ö§³Ö²¢·¢²Ù×÷£¬
|
| 199 | *º¯Êý×÷Õß : ´´½¨ÈÕÆÚ: 2011-11-04
|
| 200 | *
|
| 201 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 202 | *---------------------------------------------------------------------------
|
| 203 | *
|
| 204 | ****************************************************************************/
|
| 205 | VOID zFreeDlBuf(PBYTE pBuf);
|
| 206 |
|
| 207 | /*****************************************************************************
|
| 208 | *º¯ÊýÃû³Æ : zGetUlBufAddr
|
| 209 | *º¯Êý¹¦ÄÜ : ΪÁ˽â¾öDHD°üÍ·32×Ö½Ú¶ÔÆë´«ÊäµÄÎÊÌ⣬´Ëº¯Êý¹©RNDISµ÷Ó㬻ñÈ¡
|
| 210 | SduÊ×µØÖ·ºó£¬Í¶µÝ¸øÐÒéÕ»¡£
|
| 211 | *ÊäÈë²ÎÊý : ÎÞ
|
| 212 | *·µ »Ø Öµ : ÎÞ
|
| 213 | *ÆäËû˵Ã÷ :
|
| 214 | *º¯Êý×÷Õß : ´´½¨ÈÕÆÚ: 2013-09-23
|
| 215 | *Ôö¼Ó±³¾° : 7510UFIÁªµ÷ÐÂÔö
|
| 216 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 217 | *---------------------------------------------------------------------------
|
| 218 | *
|
| 219 | ****************************************************************************/
|
| 220 | T_z_UpLink_Sdu * zGetUlBufAddr(PBYTE pBuf);
|
| 221 |
|
| 222 | #if !defined(_OS_WIN)
|
| 223 | PBYTE zGetpsbufferHead(PBYTE data);
|
| 224 | #endif
|
| 225 |
|
| 226 | PBYTE zAllocEpdcpPduBuf(VOID);
|
| 227 | void zInitEpdcpPduBuf(VOID);
|
| 228 | void zFreeEpdcpPduBuf(PBYTE pbAddr);
|
| 229 | void zFreeEpdcpPduBufList(T_z_UpLink_Node *ptHead,T_z_UpLink_Node *ptTail);
|
| 230 |
|
| 231 | BOOL zIsPsbuff(VOID *buf);
|
| 232 |
|
| 233 | /*****************************************************************************
|
| 234 | *º¯ÊýÃû³Æ : zPutSkb2Psbuf
|
| 235 | *º¯Êý¹¦ÄÜ : ½«SKBÐÅÏ¢·â×°µ½PSBUF½á¹¹ÄÚ
|
| 236 | *ÊäÈë²ÎÊý : pbIpData - IPÂëÁ÷Ê×µØÖ·
|
| 237 | wIpDataLen - IPÂëÁ÷³¤¶È(×Ö½Ú)
|
| 238 | pbPdcpPduAddr - ÉÏÐÐEPDCP¼ÓÃܵÄÄ¿±êµØÖ·
|
| 239 | pbSkbAddr - SKBµØÖ·£¬ÊÍ·ÅʱʹÓÃ
|
| 240 | *·µ »Ø Öµ : ÉÏÐÐÊý¾Ý½ÚµãÖ¸Õë
|
| 241 | *ÆäËû˵Ã÷ :
|
| 242 | ×¢Òâ:sizeof(T_z_UpLink_Node) + Z_UP_LINK_RESERVE ²»Äܳ¬¹ý192×Ö½Ú£¬·ñÔòҪ֪ͨAP
|
| 243 | *º¯Êý×÷Õß :
|
| 244 | *
|
| 245 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 246 | *---------------------------------------------------------------------------
|
| 247 | *
|
| 248 | ****************************************************************************/
|
| 249 | extern PBYTE zPutSkb2Psbuf(PBYTE pbIpData, WORD wIpDataLen, PBYTE pbPdcpPduAddr, PBYTE pbSkbAddr);
|
| 250 | extern WORD zGetUpLinkSduSize(VOID);
|
| 251 |
|
| 252 | /*****************************************************************************
|
| 253 | *º¯ÊýÃû³Æ : zPsBuf_CacheInvalidateRange
|
| 254 | *º¯Êý¹¦ÄÜ : PSBUF·â×°zOss_CacheInvalidateRange²Ù×÷£¬ÒÔºó°æ±¾ºÃͳһ
|
| 255 | *ÊäÈë²ÎÊý :
|
| 256 | *·µ »Ø Öµ :
|
| 257 | *ÆäËû˵Ã÷ :
|
| 258 | *º¯Êý×÷Õß :
|
| 259 | *
|
| 260 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 261 | *---------------------------------------------------------------------------
|
| 262 | *
|
| 263 | ****************************************************************************/
|
| 264 | extern VOID zPsBuf_CacheInvalidateRange(UINT32 base, UINT32 size);
|
| 265 |
|
| 266 | /*****************************************************************************
|
| 267 | *º¯ÊýÃû³Æ : zPsBuf_CacheCleanRange
|
| 268 | *º¯Êý¹¦ÄÜ : PSBUF·â×°zOss_CacheCleanRange²Ù×÷£¬ÒÔºó°æ±¾ºÃͳһ
|
| 269 | *ÊäÈë²ÎÊý :
|
| 270 | *·µ »Ø Öµ :
|
| 271 | *ÆäËû˵Ã÷ :
|
| 272 | *º¯Êý×÷Õß :
|
| 273 | *
|
| 274 | *ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ ÐÞ¸ÄÈË µ¥ºÅÓëÐÞ¸ÄÄÚÈÝ
|
| 275 | *---------------------------------------------------------------------------
|
| 276 | *
|
| 277 | ****************************************************************************/
|
| 278 | extern VOID zPsBuf_CacheCleanRange(UINT32 base, UINT32 size);
|
| 279 |
|
| 280 |
|
| 281 | /* psbuff leak check */
|
| 282 | #ifdef _PSBUF_LEAK_CHECK
|
| 283 | void SetCurrntModule( PBYTE pBuf, WORD wModule );
|
| 284 | void SetNextModule( PBYTE pBuf, WORD wModuleC, WORD wModuleN );
|
| 285 | #define PSBUF_IN(b,m) SetCurrntModule((PBYTE)(b),(WORD)(m)) /* psbuff into module m */
|
| 286 | #define PSBUF_OUT(b,mc,mn) SetNextModule((PBYTE)(b),(WORD)(mc),(WORD)(mn)) /* psbuff from module mc to mn */
|
| 287 | #else
|
| 288 | #define PSBUF_IN(b,m)
|
| 289 | #define PSBUF_OUT(b,mc,mn)
|
| 290 | #endif
|
| 291 | /* outter module id define */
|
| 292 | #define PSBUF_MDL_BASE 0x10
|
| 293 | #define PSBUF_MDL_SIZE 0x10 /* high 4bit for outter module, low 4bit for inner module */
|
| 294 | #define PSBUF_MDL_CP_DRV_BASE PSBUF_MDL_BASE /* 0x10 */
|
| 295 | #define PSBUF_MDL_CP_CTRM_BASE (PSBUF_MDL_CP_DRV_BASE + PSBUF_MDL_SIZE) /* 0x20 */
|
| 296 | #define PSBUF_MDL_CP_NET_BASE (PSBUF_MDL_CP_CTRM_BASE + PSBUF_MDL_SIZE) /* 0x30 */
|
| 297 | #define PSBUF_MDL_AP_PSBUF_BASE (PSBUF_MDL_CP_NET_BASE + PSBUF_MDL_SIZE) /* 0x40 */
|
| 298 | #define PSBUF_MDL_AP_DDRNET_BASE (PSBUF_MDL_AP_PSBUF_BASE + PSBUF_MDL_SIZE) /* 0x50 */
|
| 299 | #define PSBUF_MDL_AP_NET_BASE (PSBUF_MDL_AP_DDRNET_BASE + PSBUF_MDL_SIZE) /* 0x60 */
|
| 300 | #define PSBUF_MDL_AP_WIFI_BASE (PSBUF_MDL_AP_NET_BASE + PSBUF_MDL_SIZE) /* 0x70 */
|
| 301 | #define PSBUF_MDL_CP_PS_BASE (PSBUF_MDL_AP_WIFI_BASE + PSBUF_MDL_SIZE) /* 0x80 */
|
| 302 | #endif
|