1 /******************************************************************************
2 ###############################################################################
3 # Copyright (c) [2017-2020] [ICT/CAS] #
4 # Licensed under the ORAN Software License v1.0 (License) #
5 ###############################################################################
6 ******************************************************************************/
10 #include "pdcpuDlDataProc.h"
11 #include "nguUlDataProc.h"
15 INT8 sdapMatchQosFlowId(SdapInstance_t *pSdapInstance, INT64 qosFlowId, UINT64 *pDrbId, UINT8 *pFlag)
20 SdapDrbCfg_t sdapDrbCfg = {0};
22 for(i = 0; i < pSdapInstance->drbNum; i++)
24 drbId = pSdapInstance->drbId[i];
26 VOS_MemCpy(&sdapDrbCfg, &pSdapInstance->drbCfg[drbId - 1], sizeof(SdapDrbCfg_t));
28 for(j = 0; j < sdapDrbCfg.qfiNum; j++)
30 if(qosFlowId == sdapDrbCfg.qfi[j])
38 /* 没有查找到DRB,映射到默认的DRB */
41 for(i = 0; i < pSdapInstance->drbNum; i++)
43 drbId = pSdapInstance->drbId[i];
45 /* 一个实例,即一个会话内,有且只有一个默认的DRB */
46 if(DEFAULT_DRB_TRUE == pSdapInstance->drbCfg[drbId - 1].sdapCfg.defaultDrbInd)
58 INT8 sdapPackPduHead(SdapInstance_t *pSdapInstance, INT64 qosFlowId, UINT64 *pDrbId, MsgbBuff_t *pMsgBuff, UINT8 rqi)
63 sdapDlHeader_t sdapHeader = {0};
66 if(VOS_OK != sdapMatchQosFlowId(pSdapInstance, qosFlowId, pDrbId, &updateFlag))
71 if(*pDrbId < 1 || *pDrbId > 32)
76 /*表明默认DRB上,增加了一条QOS的映射*/
79 qosNum = pSdapInstance->drbCfg[*pDrbId -1].qfiNum;
80 pSdapInstance->drbCfg[*pDrbId -1].qfi[qosNum] = qosFlowId;
81 pSdapInstance->drbCfg[*pDrbId -1].qfiNum++;
84 if(SDAP_HEADER_PRESENT == pSdapInstance->drbCfg[*pDrbId - 1].sdapCfg.sdapDlHeaderInd)
86 sdapHeader.QFI = qosFlowId;
94 pduHeadLen = sizeof(sdapDlHeader_t);
96 p = msgbHeadPush(pMsgBuff, pduHeadLen);
97 VOS_MemCpy(p, &sdapHeader, pduHeadLen);
106 INT32 sdapDlDataProc(UINT64 upE1apId, UINT64 sessId, INT64 qosFlowId, MsgbBuff_t *pMsgBuff, UINT8 rqi)
114 SdapGlobalDtat_t *pGlobalData = NULL;
115 SdapInstance_t *pSdapInstance = NULL;
116 UINT8 *pMsgHead = NULL;
124 pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
126 if(NULL == pGlobalData || 0 == flag)
131 for(i = 0; i < pGlobalData->sessNum; i++)
133 if(sessId == pGlobalData->sessId[i])
135 pSdapInstance = &pGlobalData->sdapInstance[sessId];
140 if(NULL == pSdapInstance)
145 sduLen = msgbDataUsedLen(pMsgBuff); //length of sdap sdu, not include sdap pdu head
146 pMsgHead = msgbData(pMsgBuff);//start of sdap sdu, not include sdap pdu head
148 if(0 > sduLen || NULL == pMsgHead)
153 pduHeadLen = sdapPackPduHead(pSdapInstance, qosFlowId, &drbId, pMsgBuff, rqi);
155 if(VOS_ERROR == pduHeadLen)
161 pdcpuDlDataProc(upE1apId, drbId, pMsgBuff, 1);
166 INT8 sdapUnPackPduHead(MsgbBuff_t *pMsgBuff)
171 UINT8 *pMsgHead = msgbData(pMsgBuff);
172 UINT16 pduLen = msgbDataUsedLen(pMsgBuff);
174 initBits(&bit, pMsgHead, pduLen, 0);
177 bitSize = SDAP_HEADER_LEN*8;
179 if(-1 == unpackBits(&bit, bitSize))
184 return SDAP_HEADER_LEN;
187 INT32 sdapUlDataProc(UINT64 upE1apId, UINT64 sessId, UINT64 drbId, MsgbBuff_t *pMsgBuff)
193 sdapUlHeader_t *pHead = NULL;
194 UINT8 qosFlowId = 0xff;
197 SdapGlobalDtat_t *pGlobalData = NULL;
198 SdapInstance_t *pSdapInstance = NULL;
199 SdapDrbCfg_t *pDrbCfgInfo = NULL;
207 pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
209 if(NULL == pGlobalData || 0 == flag)
215 for(i = 0; i < pGlobalData->sessNum; i++)
217 if(sessId == pGlobalData->sessId[i])
219 pSdapInstance = &pGlobalData->sdapInstance[sessId];
224 if(NULL == pSdapInstance)
230 for(i = 0; i < pSdapInstance->drbNum; i++)
232 if(drbId == pSdapInstance->drbId[i])
234 pDrbCfgInfo = &pSdapInstance->drbCfg[drbId - 1];
239 if(NULL == pDrbCfgInfo)
245 if(SDAP_HEADER_PRESENT == pDrbCfgInfo->sdapCfg.sdapUlHeaderInd)
247 pduHeadLen = sdapUnPackPduHead(pMsgBuff);
249 pHead = (sdapUlHeader_t *)msgbData(pMsgBuff);
250 qosFlowId = pHead->QFI;
251 pduType = pHead->TYPE;
255 /* receive control pdu */
259 /* check qosFlowId */
260 for(i = 0; i < pDrbCfgInfo->qfiNum; i++)
262 if(pDrbCfgInfo->qfi[i] == qosFlowId)
268 if(i < pDrbCfgInfo->qfiNum)
271 msgbHeadPull(pMsgBuff, pduHeadLen);
281 /* 调用NG-U的上行数据处理接口 */
282 return nguUlDataProc(upE1apId, sessId, qosFlowId, pMsgBuff);