VOS_VOID QosFc_UpdateRabStatus(VOS_UINT8 ucRabId, QOS_FC_RAB_STATE_ENUM_UINT32 enRabState)
{
    MODEM_ID_ENUM_UINT16    enModemId;
    VOS_UINT32              ulRabId;

    enModemId = ucRabId >> FC_MODEMID_SHIFT;
    ulRabId = FC_MASK_RABID & ucRabId;
    if(QosFc_IsInValidRabId(ulRabId))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_UpdateRabStatus : Error RabId: ", ucRabId);
        return;
    }
    if(QOS_FC_RAB_STATE_BUTT <= enRabState)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_UpdateRabStatus : Error Rab State: ", enRabState);
        return;
    }

    if(g_enRabState[enModemId][ulRabId - 5] != enRabState)
    {
        /* 输出承载流控状态迁移信息 */
        CDS_WARNING_LOG3(UEPS_PID_CDS,"QosFc_UpdateRabStatus : g_enRabState: ->: ", ucRabId, g_enRabState[enModemId][ulRabId - 5], enRabState);
        /* 设置承载状态 */
        g_enRabState[enModemId][ulRabId - 5] = enRabState;
    }

    return;
}
예제 #2
0
VOS_UINT32 CDS_DisableDlIPFFilter(MODEM_ID_ENUM_UINT16 enModemId)
{
    VOS_UINT32               ulFilterNum = 0;
    IPF_FILTER_CHAIN_TYPE_E  enFCType;

    /*根据ModemId区分过滤器首地址*/
    if (MODEM_ID_0 == enModemId)
    {
        enFCType = IPF_MODEM0_DLFC;
    }
    else if (MODEM_ID_1 == enModemId)
    {
        enFCType = IPF_MODEM1_DLFC;
    }
    else
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_DisableDlIPFFilter : Modem ID Error.", enModemId);
        return PS_FAIL;
    }

    /*取消过滤器配置*/
    if (IPF_SUCCESS != BSP_IPF_SetFilter(enFCType,
                                         CDS_GET_DL_IPF_FILTER_ARRAY(),
                                         ulFilterNum))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_DisableDlIPFFilter : Disable Dl IPF Filter Fail.Filter Num:", CDS_GET_DL_IPF_FILTER_NUM());
        return PS_FAIL;
    }
    else
    {
        /*CDS_INFO_LOG(UEPS_PID_CDS, "CDS_DisableDlIPFFilter : Disable Dl IPF Filter Success.");*/
        return PS_SUCC;
    }
}
VOS_VOID QosFc_RabRelease(CONST MsgBlock  *pstMsg)
{
    QOS_FC_RAB_RELEASE_IND_STRU *pstRabRelease = (QOS_FC_RAB_RELEASE_IND_STRU *)(VOS_VOID*)pstMsg;
    QCI_TYPE_ENUM_UINT8     enQci;
    VOS_UINT8               ucLinkRabId;
    MODEM_ID_ENUM_UINT16    enModemId;
    VOS_UINT8               ucExRabId;

    FC_DBG_RELEASE_MSG_STAT(1);

    /*入参判断*/
    if (VOS_NULL_PTR == pstRabRelease)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "QosFc_RabRelease : NULL pointer");
        return;
    }

    if(QosFc_IsInValidRabId(pstRabRelease->ucRabId))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_RabRelease : Invalid RabId:", pstRabRelease->ucRabId);
        return;
    }

    enModemId = VOS_GetModemIDFromPid(TTF_GET_MSG_SENDER_PID(pstRabRelease));
    if (MODEM_ID_BUTT <= enModemId)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_RabRelease : ModemId Error",enModemId);
        return;
    }

    ucExRabId = (VOS_UINT8)((enModemId << FC_MODEMID_SHIFT) | pstRabRelease->ucRabId);
    ucLinkRabId = QosFc_ReleaseRabEntity(ucExRabId);

    if(FC_INVALID_RABID != ucLinkRabId)
    {
        /* 获得PDN上最高的QCI */
        enQci = QosFc_GetPdnQci(ucLinkRabId);
        QosFc_UpdateChannelQos(ucLinkRabId, enQci);
        /* PDN是否需要流控 */
        /*lint -e960*/
        if((QCI_TYPE_BUTT != enQci) && (FC_INVALID_RABID == QosFc_OtherAvailRabOfPdn(ucLinkRabId)))
        /*lint +e960*/
        {
            QosFc_ChannelControl(ucLinkRabId);
        }
    }
    else
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "QosFc_RabRelease : Invalid LinkRabId:");
    }

    return;

}
VOS_UINT8 QosFc_ReleaseRabEntity(VOS_UINT8 ucRabId)
{
    VOS_UINT32  i,j;
    VOS_UINT8 ucLinkRabId;

    for(i = 0; i < FC_MAX_RAB_NUM; i++)
    {
        if((ucRabId == g_stQosFcRabEntity[i].ucRabId)
            || (FC_INVALID_RABID == g_stQosFcRabEntity[i].ucRabId))
        {
            break;
        }
    }

    /* 更新承载至默认状态 */
    QosFc_UpdateRabStatus(ucRabId, QOS_FC_RAB_STATE_NORMAL);

    if(( FC_MAX_RAB_NUM == i )
        || (FC_INVALID_RABID == g_stQosFcRabEntity[i].ucRabId))
    {
        /* 未找到待释放承载 */
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_ReleaseRabEntity : Not find releasing RAB: ", ucRabId);
        return FC_INVALID_RABID;
    }

    ucLinkRabId = g_stQosFcRabEntity[i].ucLinkRabId;

    /* 紧凑排列,释放时要消除空隙 */
    for(j = i; j < (FC_MAX_RAB_NUM - 1); j++)
    {
        if(FC_INVALID_RABID == g_stQosFcRabEntity[j+1].ucRabId)
        {
            break;
        }
        VOS_MemCpy(&g_stQosFcRabEntity[j], &g_stQosFcRabEntity[j+1], sizeof(QOS_FC_RAB_ENTITY_STRU));
    }

    QosFc_RabEntityInit(j);

    /* 减少实体计数 */
    g_iRabEntityCnt--;
    if((g_iRabEntityCnt < 0)
        || (g_iRabEntityCnt > FC_MAX_RAB_NUM))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_ReleaseRabEntity : Error g_iRabEntityCnt:", g_iRabEntityCnt);
        g_iRabEntityCnt = FC_MAX_RAB_NUM;
    }

    FC_DBG_RELEASE_RAB_STAT(1);

    return ucLinkRabId;
}
예제 #5
0
VOS_VOID CDS_SaveIpfDlSrcMem(const IPF_CONFIG_DLPARAM_S *pstIpfDlBdBuff, VOS_UINT32 ulSaveNum)
{
    LUP_QUEUE_STRU                   *pstDlFreeQue;
    VOS_UINT32                        ulCnt;
    TTF_MEM_ST                       *pstSrcMem;

    CDS_ASSERT(VOS_NULL_PTR != pstIpfDlBdBuff);

    if (ulSaveNum > IPF_DLBD_DESC_SIZE)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_SaveIpfDlMemInfo:Input Bd Num Error.",ulSaveNum);
        return ;
    }

    pstDlFreeQue = CDS_IPF_DL_SRCMEM_FREE_QUE();
    CDS_ASSERT(VOS_NULL_PTR != pstDlFreeQue);

    for (ulCnt = 0; ulCnt < ulSaveNum; ulCnt ++)
    {
        pstSrcMem = (TTF_MEM_ST*)pstIpfDlBdBuff[ulCnt].u32Data;
        if (PS_SUCC != LUP_EnQue(pstDlFreeQue,pstSrcMem))
        {
            CDS_ERROR_LOG2(UEPS_PID_CDS,"CDS_SaveIpfDlMemInfo: Src Mem Leak.",ulCnt,ulSaveNum);
            vos_printf("CDS_SaveIpfDlMemInfo: Buffer Full!! cnt=%d,ulSaveNum=%d\n",ulCnt,ulSaveNum);
            TTF_MemFree(UEPS_PID_CDS,pstSrcMem);
            CDS_DBG_DL_IPF_SAVE_SRCMEM_FAIL_NUM(1);
            continue;
        }

        CDS_DBG_DL_IPF_SAVE_SRCMEM_SUCC_NUM(1);
    }

    return ;
}
예제 #6
0
VOS_UINT32 CDS_ChangeDlIpfFilterType(VOS_UINT16  usModemId)
{
    VOS_UINT32              ulCnt;
    IPF_FILTER_CONFIG_S    *pstFilter;

    if (usModemId >= CDS_MAX_MODEM_NUM)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_ChangeDlIpfFilterType : Modem ID Error.", usModemId);
        return PS_FAIL;
    }

    for (ulCnt = 1; ulCnt < CDS_GET_DL_IPF_FILTER_NUM(); ulCnt ++)
    {
        pstFilter = CDS_GET_DL_IPF_FILTER_PTR(ulCnt);

        CDS_DL_IPF_CLR_EX_FILTER_FLG(pstFilter->u32FilterID);

        /*Modem1设置为扩展过滤器*/
        if (MODEM_ID_1 == usModemId)
        {
            CDS_DL_IPF_SET_EX_FILTER_FLG(pstFilter->u32FilterID);
        }
    }

    return PS_SUCC;
}
예제 #7
0
TTF_MEM_ST* CDS_AllocTtfMem(VOS_UINT32 ulLen)
{
    TTF_MEM_ST   *pstTtf;

    if ((0 == ulLen) || (CDS_DL_SDU_MAX_LEN < ulLen))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_AllocTtfMem : Input Length Err.",ulLen);
        return VOS_NULL_PTR;
    }

    /*申请内存,指针需要移位*/
    pstTtf = TTF_MemBlkAlloc(UEPS_PID_CDS,
                             TTF_MEM_POOL_ID_UL_IP_DATA,
                             (VOS_UINT16)(ulLen + CDS_UL_RESV_LEN_FOR_PDU_HDR));

    if (VOS_NULL_PTR == pstTtf)
    {
        return VOS_NULL_PTR;
    }

    /*进行指针偏移*/
    pstTtf->pData  = pstTtf->pData + CDS_UL_RESV_LEN_FOR_PDU_HDR;
    pstTtf->usUsed = (VOS_UINT16)ulLen;

    return pstTtf;
}
VOS_VOID CDS_SendImsaSetImsBearerCnfMsg(VOS_UINT32 ulResult)
{
    IMSA_CDS_SET_IMS_BEARER_CNF_STRU   *pstCnfMsg;
    VOS_UINT32                          ulMsgLen;

    CDS_INFO_LOG1(UEPS_PID_CDS,"Enter CDS_SendImsaSetImsBearerCnfMsg. ulResult=",ulResult);

    ulMsgLen = sizeof(IMSA_CDS_SET_IMS_BEARER_CNF_STRU);
    pstCnfMsg = CDS_ALLOC_MSG_WITH_HDR(ulMsgLen);
    if (VOS_NULL_PTR == pstCnfMsg)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_SendImsaSetImsBearerCnfMsg : Alloc Msg Fail. Size .",ulMsgLen);
        return;
    }

    /*填写消息内容*/
    CDS_CFG_MSG_HDR(pstCnfMsg,PS_PID_IMSA);
    pstCnfMsg->ulMsgId  = ID_IMSA_CDS_SET_IMS_BEARER_CNF;
    pstCnfMsg->ulResult = ulResult;

    /*发送消息*/
    CDS_SEND_MSG(pstCnfMsg);

    CDS_INFO_LOG(UEPS_PID_CDS,"Leave CDS_SendImsaSetImsBearerCnfMsg Succ.");

    return;
}
VOS_VOID QosFc_RestoreRabStatus(VOS_UINT32 ulIndex)
{
    if(FC_MAX_RAB_NUM <= ulIndex)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_RestoreRabStatus : Invalid ulIndex:", ulIndex);
        return;
    }

    if(QOS_FC_RAB_STATE_DISCARD == g_stQosFcRabEntity[ulIndex].enRabState)
    {
        QosFc_SetRabRandomDiscard(ulIndex);

        QosFc_ChannelRestore(g_stQosFcRabEntity[ulIndex].ucLinkRabId);
    }
    else if(QOS_FC_RAB_STATE_RANDOM_DISCARD == g_stQosFcRabEntity[ulIndex].enRabState)
    {
        QosFc_SetRabNormal(ulIndex);
    }
    else
    {
        CDS_ERROR_LOG2(UEPS_PID_CDS, "QosFc_RestoreRabStatus : Invalid State::", ulIndex, g_stQosFcRabEntity[ulIndex].enRabState);
        /* 保护 */
        QosFc_SetRabNormal(ulIndex);
    }

    return;

}
VOS_VOID QosFc_SetRabNormal(VOS_UINT32 ulIndex)
{
    MODEM_ID_ENUM_UINT16    enModemId;

    if(FC_MAX_RAB_NUM <= ulIndex)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_SetRabNormal : Invalid ulIndex:", ulIndex);
        return;
    }

    if(QOS_FC_RAB_STATE_NORMAL == g_stQosFcRabEntity[ulIndex].enRabState)
    {
        return;
    }

    enModemId = g_stQosFcRabEntity[ulIndex].ucRabId >> FC_MODEMID_SHIFT;
    FC_DBG_TO_NORMAL_STAT(enModemId, (FC_MASK_RABID & g_stQosFcRabEntity[ulIndex].ucRabId), 1);

    CDS_WARNING_LOG3(UEPS_PID_CDS, "QosFc_SetRabNormal : RabId: -> ",
                                        g_stQosFcRabEntity[ulIndex].ucRabId,
                                        g_stQosFcRabEntity[ulIndex].enRabState,
                                        QOS_FC_RAB_STATE_NORMAL);

    g_stQosFcRabEntity[ulIndex].enRabState = QOS_FC_RAB_STATE_NORMAL;

    QosFc_UpdateRabStatus(g_stQosFcRabEntity[ulIndex].ucRabId, QOS_FC_RAB_STATE_NORMAL);

    return;
}
VOS_VOID CDS_ImsaSetImsBearerReqMsgProc(MsgBlock *pstMsg)
{
    IMSA_CDS_SET_IMS_BEARER_REQ_STRU   *pstReqMsg;
    CDS_ENTITY_STRU                    *pstCdsEntity;

    CDS_INFO_LOG(UEPS_PID_CDS,"Enter CDS_ImsaSetImsBearerReqMsgProc.");

    pstReqMsg = (IMSA_CDS_SET_IMS_BEARER_REQ_STRU *)((VOS_UINT32)pstMsg);
    if (pstReqMsg->ulImsBearerNum > IMSA_CDS_MAX_IMS_BEARER_NUM)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_ImsaSetImsBearerReqMsgProc : IMS Bearer Number Error.",pstReqMsg->ulImsBearerNum);
        CDS_SendImsaSetImsBearerCnfMsg(PS_FAIL);
        return;
    }

    /*默认按MODEM_0处理*/
    pstCdsEntity = CDS_GetCdsEntity(MODEM_ID_0);
    if (VOS_NULL_PTR == pstCdsEntity)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS,"CDS_ImsaSetImsBearerReqMsgProc : Get CDS Entity Fail.");
        CDS_SendImsaSetImsBearerCnfMsg(PS_FAIL);
        return;
    }

    /*注册IMS NIC回调函数*/
    if (PS_SUCC != IMS_NIC_RegUlDataSendCb((IMS_NIC_SEND_UL_DATA_FUNC)CDS_RxDataFromImsNIC,
                                            pstCdsEntity->usModemId))
    {
        CDS_ERROR_LOG(UEPS_PID_CDS,"CDS_ImsaSetImsBearerReqMsgProc : IMS_NIC_RegUlDataSendCb Fail.");
        CDS_SendImsaSetImsBearerCnfMsg(PS_FAIL);
        return;
    }

    /*更新CDS实体信息*/
    pstCdsEntity->ulImsBearerNum = pstReqMsg->ulImsBearerNum;
    PS_MEM_CPY(pstCdsEntity->astImsBearerInfo,
               pstReqMsg->astImsBearerArray,
               pstReqMsg->ulImsBearerNum * sizeof(IMSA_CDS_IMS_BEARER_STRU));

    pstCdsEntity->stImsPortInfo.usMinImsPort = pstReqMsg->stImsPortInfo.usMinImsPort;
    pstCdsEntity->stImsPortInfo.usMaxImsPort = pstReqMsg->stImsPortInfo.usMaxImsPort;

    /*发送成功消息*/
    CDS_SendImsaSetImsBearerCnfMsg(PS_SUCC);

    CDS_INFO_LOG(UEPS_PID_CDS,"Leave CDS_ImsaSetImsBearerReqMsgProc Succ.");

    return;
}
QOS_FC_RAB_STATE_ENUM_UINT32 QosFc_GetRabStatus(VOS_UINT8 ucRabId)
{
    MODEM_ID_ENUM_UINT16    enModemId;

    if(QosFc_IsInValidRabId(FC_MASK_RABID & ucRabId))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_GetRabStatus : Error RabId: ", ucRabId);
        /* 非法承载,丢包 */
        return QOS_FC_RAB_STATE_DISCARD;
    }

    enModemId = ucRabId >> FC_MODEMID_SHIFT;

    return g_enRabState[enModemId][(FC_MASK_RABID & ucRabId) - 5];
}
VOS_VOID CDS_SendNdDataIndMsg(TTF_MEM_ST *pstNdPkt, VOS_UINT8 ucRabId, const CDS_ENTITY_STRU *pstCdsEntity)
{
    CDS_NDCLIENT_ND_DATA_IND_STRU  *pstDataInd;
    VOS_UINT32                      ulMsgLen;
    VOS_UINT32                      ulPktLen;

    CDS_ASSERT(VOS_NULL_PTR != pstNdPkt);
    CDS_ASSERT(VOS_NULL_PTR != pstCdsEntity);

    CDS_INFO_LOG1(UEPS_PID_CDS,"Enter CDS_SendNdDataIndMsg.ucRabid=",ucRabId);

    /*申请消息内存*/
    ulPktLen = TTF_MemGetLen(UEPS_PID_CDS,pstNdPkt);
    ulMsgLen = sizeof(CDS_NDCLIENT_ND_DATA_IND_STRU) + ulPktLen;
    pstDataInd = CDS_ALLOC_MSG_WITH_HDR(ulMsgLen);
    if (VOS_NULL_PTR == pstDataInd)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_SendNdDataIndMsg : Alloc Msg Fail. Size=",ulMsgLen);
        return;
    }

    /*填写消息内容*/
    CDS_CFG_MSG_HDR(pstDataInd,UEPS_PID_NDCLIENT);
    pstDataInd->enMsgId   = ID_CDS_NDCLIENT_ND_DATA_IND;
    pstDataInd->enModemId = pstCdsEntity->usModemId;
    pstDataInd->ucRabId   = ucRabId;
    pstDataInd->ulLen     = ulPktLen;

    /*内存拷贝*/
    if (PS_SUCC != TTF_MemGetHeadData(UEPS_PID_CDS,
                                      pstNdPkt,
                                      pstDataInd->aucData,
                                      (VOS_UINT16)ulPktLen))
    {
        /*lint -e961*/
        PS_FREE_MSG(UEPS_PID_CDS, pstDataInd);
        /*lint +e961*/
        CDS_ERROR_LOG(UEPS_PID_CDS,"CDS_SendNdDataIndMsg : TTF_MemGetHeadData Error.");
        return ;
    }

    /*发送消息*/
    CDS_SEND_MSG(pstDataInd);

    CDS_INFO_LOG(UEPS_PID_CDS,"Leave CDS_SendNdDataIndMsg Succ.");

    return;
}
VOS_VOID QosFc_RabEntityInit(VOS_UINT32 ulIndex)
{
    if(FC_MAX_RAB_NUM <= ulIndex)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_RabEntityInit : Error Index: ", ulIndex);
        return;
    }

    g_stQosFcRabEntity[ulIndex].ucRabId = FC_INVALID_RABID;
    g_stQosFcRabEntity[ulIndex].enQci = QCI_TYPE_BUTT;
    g_stQosFcRabEntity[ulIndex].ucPriority = 0xff;
    g_stQosFcRabEntity[ulIndex].ucLinkRabId = FC_INVALID_RABID;
    g_stQosFcRabEntity[ulIndex].enRabState = QOS_FC_RAB_STATE_BUTT;

    return;

}
VOS_VOID QosFc_SetRabDiscard(VOS_UINT32 ulIndex)
{
    MODEM_ID_ENUM_UINT16    enModemId;

    if(FC_MAX_RAB_NUM <= ulIndex)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_SetRabDiscard : Invalid ulIndex:", ulIndex);
        return;
    }

    if(QOS_FC_RAB_STATE_DISCARD == g_stQosFcRabEntity[ulIndex].enRabState)
    {
        return;
    }

    enModemId = g_stQosFcRabEntity[ulIndex].ucRabId >> FC_MODEMID_SHIFT;
    FC_DBG_TO_DISCARD_STAT(enModemId, (FC_MASK_RABID & g_stQosFcRabEntity[ulIndex].ucRabId), 1);

    CDS_WARNING_LOG3(UEPS_PID_CDS, "QosFc_SetRabDiscard : RabId: -> ",
                                        g_stQosFcRabEntity[ulIndex].ucRabId,
                                        g_stQosFcRabEntity[ulIndex].enRabState,
                                        QOS_FC_RAB_STATE_DISCARD);

    g_stQosFcRabEntity[ulIndex].enRabState = QOS_FC_RAB_STATE_DISCARD;

    /* 最高优先级不丢包处理 */
    if((g_stQosFcCtrl.bHighDiscardEnable)
        || (g_stQosFcRabEntity[0].ucPriority != g_stQosFcRabEntity[ulIndex].ucPriority))
    {
        QosFc_UpdateRabStatus(g_stQosFcRabEntity[ulIndex].ucRabId, QOS_FC_RAB_STATE_DISCARD);
    }
    else
    {
        QosFc_UpdateRabStatus(g_stQosFcRabEntity[ulIndex].ucRabId, QOS_FC_RAB_STATE_NOT_DISCARD);
    }

    if(FC_INVALID_RABID == QosFc_OtherAvailRabOfPdn(g_stQosFcRabEntity[ulIndex].ucLinkRabId))
    {
        QosFc_ChannelControl(g_stQosFcRabEntity[ulIndex].ucLinkRabId);
    }

    return;
}
VOS_BOOL QosFc_RabNeedFlowCtrl(VOS_UINT32 ulIndex)
{
    if(FC_MAX_RAB_NUM <= ulIndex)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_RabNeedFlowCtrl : Invalid ulIndex:", ulIndex);
        return VOS_FALSE;
    }

    /* 判断是否不流控的优先级 */
    if(FC_NOT_FLOWCTRL_PRIO < g_stQosFcRabEntity[ulIndex].ucPriority)
    {
        /* 是否是更高优先级承载 */
        if((g_stQosFcCtrl.bHighFcEnable)
            || (g_stQosFcRabEntity[0].ucPriority != g_stQosFcRabEntity[ulIndex].ucPriority))
        {
            return VOS_TRUE;
        }
    }

    return VOS_FALSE;
}
예제 #17
0
VOS_UINT32 CDS_EnableDlIPFFilter(VOS_UINT16  usModemId)
{
    IPF_FILTER_CHAIN_TYPE_E  enFCType;

    /*根据ModemId区分过滤器首地址*/
    if (MODEM_ID_0 == usModemId)
    {
        enFCType = IPF_MODEM0_DLFC;
    }
    else if (MODEM_ID_1 == usModemId)
    {
        enFCType = IPF_MODEM1_DLFC;
    }
    else
    {
        CDS_ERROR_LOG2(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Input Para Error. ModemId,MaxModemNum:", usModemId,CDS_MAX_MODEM_NUM);
        return PS_FAIL;
    }

    /*改变下行IPF过滤器的类型*/
    if (PS_SUCC != CDS_ChangeDlIpfFilterType(usModemId))
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Change DL Filter Type Fail.");
        return PS_FAIL;
    }

    /*将已设置好的过滤器配置给下行IPF*/
    if (IPF_SUCCESS != BSP_IPF_SetFilter(enFCType,
                                         CDS_GET_DL_IPF_FILTER_ARRAY(),
                                         CDS_GET_DL_IPF_FILTER_NUM()))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Enable Dl IPF Filter Fail.Filter Num:", CDS_GET_DL_IPF_FILTER_NUM());
        return PS_FAIL;
    }
    else
    {
        CDS_INFO_LOG(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Enable Dl IPF Filter Success.");
        return PS_SUCC;
    }
}
예제 #18
0
VOS_UINT32 CDS_EnableDlIPFFilter(VOS_UINT16  usModemId)
{
    if (usModemId >= CDS_MAX_MODEM_NUM)
    {
        CDS_ERROR_LOG2(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Input Para Error. ModemId,MaxModemNum:", usModemId,CDS_MAX_MODEM_NUM);
        return PS_FAIL;
    }

    /*将已设置好的过滤器配置给下行IPF*/
    if (IPF_SUCCESS != BSP_IPF_SetFilter(IPF_CHANNEL_DOWN,
                                     CDS_GET_DL_IPF_FILTER_ARRAY(),
                                     CDS_GET_DL_IPF_FILTER_NUM()))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Enable Dl IPF Filter Fail.Filter Num:", CDS_GET_DL_IPF_FILTER_NUM());
        return PS_FAIL;
    }
    else
    {
        CDS_INFO_LOG(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Enable Dl IPF Filter Success.");
        return PS_SUCC;
    }
}
VOS_UINT32 QosFc_MoveDownEntityPos(VOS_UINT32 ulInitPos, VOS_UINT8 ucPriority)
{
    VOS_UINT32  j;

    for(j = ulInitPos; j < (FC_MAX_RAB_NUM - 1) ; j++)
    {
        if(ucPriority > g_stQosFcRabEntity[j+1].ucPriority)
        {
            VOS_MemCpy(&g_stQosFcRabEntity[j], &g_stQosFcRabEntity[j+1], sizeof(QOS_FC_RAB_ENTITY_STRU));
        }
        else
        {
            if(FC_INVALID_RABID == g_stQosFcRabEntity[j].ucRabId)
            {
                CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_MoveDownEntityPos : Error Prio:", g_stQosFcRabEntity[j].ucPriority);
            }
            /* 找到插入位置 j */
            break;
        }
    }

    return j;
}
예제 #20
0
VOS_UINT32 CDS_DisableDlIPFFilter(MODEM_ID_ENUM_UINT16 enModemId)
{
    VOS_UINT32        ulFilterNum = 0;

    if (enModemId >= CDS_MAX_MODEM_NUM)
    {
        CDS_ERROR_LOG2(UEPS_PID_CDS, "CDS_DisableDlIPFFilter : Input Para Error. ModemId,MaxModemNum:", enModemId,CDS_MAX_MODEM_NUM);
        return PS_FAIL;
    }

    if (IPF_SUCCESS != BSP_IPF_SetFilter(IPF_CHANNEL_DOWN,
                                     CDS_GET_DL_IPF_FILTER_ARRAY(),
                                     ulFilterNum))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Disable Dl IPF Filter Fail.Filter Num:", CDS_GET_DL_IPF_FILTER_NUM());
        return PS_FAIL;
    }
    else
    {
        CDS_INFO_LOG(UEPS_PID_CDS, "CDS_EnableDlIPFFilter : Disable Dl IPF Filter Success.");
        return PS_SUCC;
    }
}
QOS_FC_RAB_ENTITY_STRU* QosFc_CreateRabEntity(CONST QOS_FC_RAB_CREATE_IND_STRU *pstRabCreate, VOS_UINT8 *pucOldLinkRabId)
{
    VOS_UINT8   ucPriority;             /* 承载优先级 */
    VOS_UINT32  i;
    VOS_UINT32  idx = FC_MAX_RAB_NUM;

    if((VOS_NULL_PTR == pstRabCreate) || (VOS_NULL_PTR == pucOldLinkRabId))
    {
        CDS_ERROR_LOG(UEPS_PID_CDS,"QosFc_CreateRabEntity : Invalid parameter!");
        return VOS_NULL_PTR;
    }

    for(i = 0; i < FC_MAX_RAB_NUM; i++)
    {
        if((pstRabCreate->ucRabId == g_stQosFcRabEntity[i].ucRabId)
            || (FC_INVALID_RABID == g_stQosFcRabEntity[i].ucRabId))
        {
            break;
        }
    }

    if( FC_MAX_RAB_NUM == i )
    {
        /* 出现异常,超出可支持数量 */
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_CreateRabEntity : too many Rab Entity, fail to create Entity: ",pstRabCreate->ucRabId);
        return VOS_NULL_PTR;
    }

    ucPriority = g_ucQosFcQci2Priority[pstRabCreate->enQci];

    /* 新建承载 */
    if(FC_INVALID_RABID == g_stQosFcRabEntity[i].ucRabId)
    {
        /* 逆序排列,高 -> 低 */
        idx = QosFc_MoveUpEntityPos(i, ucPriority);

        /* 增加实体计数 */
        g_iRabEntityCnt++;
        if((g_iRabEntityCnt < 0)
            || (g_iRabEntityCnt > FC_MAX_RAB_NUM))
        {
            CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_CreateRabEntity : Error g_iRabEntityCnt:", g_iRabEntityCnt);
            g_iRabEntityCnt = FC_MAX_RAB_NUM;
        }

        CDS_WARNING_LOG4(UEPS_PID_CDS, "QosFc_CreateRabEntity : Create Entity RabId: LinkRabId: Qci: Prio:",
                        pstRabCreate->ucRabId, pstRabCreate->ucLinkRabId, pstRabCreate->enQci, ucPriority);

        FC_DBG_CREATE_RAB_STAT(1);
    }
    else
    {
        FC_DBG_UPDATE_RAB_STAT(1);
        *pucOldLinkRabId = g_stQosFcRabEntity[i].ucLinkRabId;

        CDS_WARNING_LOG3(UEPS_PID_CDS, "QosFc_CreateRabEntity : Update Entity  FROM  RabId: LinkRabId: Qci: ",
                        g_stQosFcRabEntity[i].ucRabId, g_stQosFcRabEntity[i].ucLinkRabId, g_stQosFcRabEntity[i].enQci);
        CDS_WARNING_LOG4(UEPS_PID_CDS, "QosFc_CreateRabEntity : Update Entity  TO  RabId: LinkRabId: Qci: Prio:",
                        pstRabCreate->ucRabId, pstRabCreate->ucLinkRabId, pstRabCreate->enQci, ucPriority);

        /* 更新承载 */
        /*if(pstRabCreate->ucRabId == g_stQosFcRabEntity[i].ucRabId)
 */
        {
            if(ucPriority == g_stQosFcRabEntity[i].ucPriority)
            {
                /* 优先级保持不变,实体排序不变 */
                idx = i;;
            }
            else if(ucPriority > g_stQosFcRabEntity[i].ucPriority)
            {
                idx = QosFc_MoveDownEntityPos(i, ucPriority);
            }
            else
            {
                idx = QosFc_MoveUpEntityPos(i, ucPriority);
            }
        }
    }

    if(FC_MAX_RAB_NUM <= idx)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_CreateRabEntity : Error Insert Position: ", idx);
        return VOS_NULL_PTR;
    }

    /* 承载恢复正常数传态 */
    QosFc_SetRabEntity(&g_stQosFcRabEntity[idx], pstRabCreate);

    return &g_stQosFcRabEntity[idx];
}
VOS_UINT32 CDS_RxDataFromImsNIC(const VOS_UINT8 *pData, VOS_UINT16 usLen,MODEM_ID_ENUM_UINT16 enModemId)
{
    CDS_ENTITY_STRU             *pstCdsEntity;
    TTF_MEM_ST                  *pstTtfPkt;
    VOS_INT32                    lLock;

    CDS_DBG_IMS_UL_RX_FUN_CALL_NUM(1);

    /*入参判断*/
    if (VOS_NULL_PTR == pData)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "CDS_RxPktFromImsNIC:Input Para is NULL");
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    if ((0 == usLen) || (usLen > ETH_MAX_MTU))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_RxPktFromImsNIC ; Packet Length Error.",usLen);
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    pstCdsEntity = CDS_GetCdsEntity(enModemId);
    if (VOS_NULL_PTR == pstCdsEntity)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_RxPktFromImsNIC ; Modem ID Error.",enModemId);
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    CDS_DBG_IMS_UL_RX_NIC_PKT_NUM(1);

    /*申请TTF内存,并将其拷贝到TTF内存中*/
    pstTtfPkt = CDS_AllocTtfMem(usLen);
    if (VOS_NULL_PTR == pstTtfPkt)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS,"CDS_RxDataFromImsNIC: Alloc Mem Fail.");
        CDS_DBG_IMS_UL_ALLOC_MEM_FAIL_NUM(1);
        return PS_FAIL;
    }
    PS_MEM_CPY(pstTtfPkt->pData,pData,usLen);

    /*入队*/
    lLock = VOS_SplIMP();
    if (PS_SUCC != LUP_EnQue(pstCdsEntity->pstIMSDataQue,pstTtfPkt))
    {
        VOS_Splx(lLock);
        CDS_DBG_IMS_UL_EN_QUE_FAIL_NUM(1);
        TTF_MemFree(UEPS_PID_CDS, pstTtfPkt);
        CDS_SendEventToCds(CDS_EVENT_UL_IMS_PROC);
        CDS_DBG_IMS_UL_TRIGGER_IMS_EVENT_NUM(1);
        return PS_FAIL;
    }
    VOS_Splx(lLock);
    CDS_DBG_IMS_UL_EN_QUE_SUCC_NUM(1);

    /*wakeup cds*/
    CDS_SendEventToCds(CDS_EVENT_UL_IMS_PROC);
    CDS_DBG_IMS_UL_TRIGGER_IMS_EVENT_NUM(1);
    return PS_SUCC;
}
VOS_VOID QosFc_RabCreate(CONST MsgBlock  *pstMsg)
{
    QOS_FC_RAB_CREATE_IND_STRU *pstRabCreate = (QOS_FC_RAB_CREATE_IND_STRU *)(VOS_VOID*)pstMsg;
    QOS_FC_RAB_ENTITY_STRU *pstQosFcRabEntity = VOS_NULL_PTR;
    QCI_TYPE_ENUM_UINT8     enQci;
    VOS_UINT8               ucOldLinkRabId = FC_INVALID_RABID;
    MODEM_ID_ENUM_UINT16    enModemId;

    FC_DBG_CREATE_MSG_STAT(1);

    /*入参判断*/
    if (VOS_NULL_PTR == pstRabCreate)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "QosFc_RabCreate : NULL pointer");
        return;
    }

    /*lint -e960*/
    if(QosFc_IsInValidRabId(pstRabCreate->ucRabId)
        || QosFc_IsInValidRabId(pstRabCreate->ucLinkRabId)
        || (pstRabCreate->enQci < QCI_TYPE_QCI1_GBR)
        || (pstRabCreate->enQci > QCI_TYPE_QCI9_NONGBR))
    {
        CDS_ERROR_LOG3(UEPS_PID_CDS, "QosFc_RabCreate : Invalid MSG RabId: LinkRabId: Qci:",
                                pstRabCreate->ucRabId, pstRabCreate->ucLinkRabId, pstRabCreate->enQci);
        return;
    }
    /*lint +e960*/

    /* 流控都按拼接处理 */
    enModemId = VOS_GetModemIDFromPid(TTF_GET_MSG_SENDER_PID(pstRabCreate));
    if (MODEM_ID_BUTT <= enModemId)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS, "QosFc_RabCreate : ModemId Error",enModemId);
        return;
    }

    /*lint -e734*/
    pstRabCreate->ucRabId |= (enModemId << FC_MODEMID_SHIFT);
    pstRabCreate->ucLinkRabId |= (enModemId << FC_MODEMID_SHIFT);
    /*lint +e734*/

    pstQosFcRabEntity = QosFc_CreateRabEntity(pstRabCreate, &ucOldLinkRabId);

    if(VOS_NULL_PTR != pstQosFcRabEntity)
    {
        /* 获得PDN上最高的QCI */
        enQci = QosFc_GetPdnQci(pstRabCreate->ucLinkRabId);
        QosFc_UpdateChannelQos(pstRabCreate->ucLinkRabId, enQci);
        /* 新建承载处于非流控状态,打开数传通道 */
        QosFc_ChannelRestore(pstRabCreate->ucLinkRabId);

        if((FC_INVALID_RABID != ucOldLinkRabId)
                && (ucOldLinkRabId != pstRabCreate->ucLinkRabId))
        {
            /* 获得PDN上最高的QCI */
            enQci = QosFc_GetPdnQci(ucOldLinkRabId);
            QosFc_UpdateChannelQos(ucOldLinkRabId, enQci);
            /* PDN是否需要流控 */
            /*lint -e960*/
            if((QCI_TYPE_BUTT != enQci) && (FC_INVALID_RABID == QosFc_OtherAvailRabOfPdn(ucOldLinkRabId)))
            /*lint +e960*/
            {
                QosFc_ChannelControl(ucOldLinkRabId);
            }
        }
    }

    return;

}
예제 #24
0
VOS_VOID CDS_ConfigDlIPF(VOS_VOID)
{
    VOS_UINT32              ulIdleBD;
    BSP_U32                 ulIdleCD;
    VOS_UINT32              ulCnt;
    VOS_UINT32              ulCfgCD;
    TTF_MEM_ST             *pstSrcMem;
    IPF_CONFIG_DLPARAM_S   *pstDlCfgPara;
    int                     intLockLevel;

    /*触发下行IPF释放源内存*/
    CDS_FreeIpfDlSrcMem();

    /*获得下行空闲BD/CD个数*/
    ulIdleBD = (VOS_UINT32)BSP_IPF_GetDlBDNum(&ulIdleCD);
    if (0 == ulIdleBD)
    {
        /*没有空闲BD*/
        CDS_DBG_DL_IPF_CFG_HAVE_NO_BD(1);
        return;
    }

    if (ulIdleBD > IPF_DLBD_DESC_SIZE)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_GUConfigDlIPF : DL Idle BD Num Error.",ulIdleBD);
        return;
    }

    if (0 == ulIdleCD)
    {
        /*没有空闲CD*/
        CDS_DBG_DL_IPF_CFG_HAVE_NO_CD(1);
        return;
    }

    ulCfgCD = 0;
    for (ulCnt = 0; ulCnt < ulIdleBD; ulCnt ++)
    {
        /**/
        pstDlCfgPara = &(g_stCdsIpfCtrlEntity.astDlIpfCfgPara[ulCnt]);
        if (PS_SUCC != LUP_PeekQueHead(CDS_GET_IPF_DL_SDU_QUE(),&pstSrcMem))
        {
            break;
        }

        /*Get BD*/
        ulCfgCD += CDS_GetTtfMemCnt(pstSrcMem);
        if (ulCfgCD > ulIdleCD)
        {
            CDS_DBG_DL_IPF_CFG_CD_NOT_ENOUGH(1);
            break;
        }

        /*真实出队*/
        intLockLevel = VOS_SplIMP();
        if (PS_SUCC != LUP_DeQue(CDS_GET_IPF_DL_SDU_QUE(),&pstSrcMem))
        {
            /*异常保护,应该不会*/
            VOS_Splx(intLockLevel);
            break;
        }
        VOS_Splx(intLockLevel);

        pstDlCfgPara->u32Data       = (VOS_UINT32)(pstSrcMem);
        pstDlCfgPara->u16Len        = CDS_DL_GET_PKT_LEN_FROM_TTF(pstSrcMem);
        pstDlCfgPara->u16UsrField1  = CDS_DL_GET_MODEMID_RABID_FROM_TTF(pstSrcMem);

        if (MODEM_ID_0 == CDS_DL_GET_MODEMID_FROM_TTF(pstSrcMem))
        {
            CDS_DL_BD_SET_ATTR_WITH_FC_HDR(pstDlCfgPara->u16Attribute,IPF_MODEM0_DLFC);
        }
        else
        {
            CDS_DL_BD_SET_ATTR_WITH_FC_HDR(pstDlCfgPara->u16Attribute,IPF_MODEM1_DLFC);
        }

    }

    /*配置下行过滤包数为0,直接返回*/
    if (0 == ulCnt)
    {
        return;
    }

    /*最后一个BD设置中断标志*/
    pstDlCfgPara = &(g_stCdsIpfCtrlEntity.astDlIpfCfgPara[ulCnt - 1]);
    CDS_DL_BD_SET_ATTR_INT_FLG(pstDlCfgPara->u16Attribute);

    /*配置上行IPF过滤*/
    if (IPF_SUCCESS != BSP_IPF_ConfigDownFilter(ulCnt,g_stCdsIpfCtrlEntity.astDlIpfCfgPara))
    {
        /*配置失败后,源内存释放*/
        ulIdleBD = ulCnt;
        for (ulCnt = 0; ulCnt < ulIdleBD; ulCnt ++)
        {
            pstDlCfgPara = &(g_stCdsIpfCtrlEntity.astDlIpfCfgPara[ulCnt]);
            pstSrcMem = (TTF_MEM_ST*)(pstDlCfgPara->u32Data);
            TTF_MemFree(UEPS_PID_CDS,pstSrcMem);
        }

        CDS_DBG_DL_IPF_CFG_BD_FAIL_NUM(ulIdleBD);
        return;
    }

    /*缓存Src Mem*/
    CDS_SaveIpfDlSrcMem(g_stCdsIpfCtrlEntity.astDlIpfCfgPara,ulCnt);

    CDS_DBG_DL_IPF_CFG_BD_SUCC_NUM(ulCnt);

    return;
}
VOS_BOOL QosFc_IsDiscard(VOS_UINT8 ucRabId, MODEM_ID_ENUM_UINT16 enModemId)
{
    static VOS_UINT32  ulPktCntVal = 0;         /* 包计数 */
    VOS_UINT32 ulRandValue = 0;

    if(VOS_TRUE != g_stQosFcCtrl.bQosFcEnable)
    {
        /* 流控没打开,不进流控状态 */
        return VOS_FALSE;
    }

    ulPktCntVal++;
    if(ulPktCntVal >= g_stQosFcCtrl.ulPktCntLimit)
    {
        ulPktCntVal = 0;
        QosFc_FlowCtrl();
    }

    if(QosFc_IsInValidRabId(ucRabId))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"QosFc_IsDiscard : Error RabId: ", ucRabId);
        /* 非法承载,丢包 */
        return VOS_TRUE;
    }

    switch( g_enRabState[enModemId][ucRabId - 5] )
    {
        case QOS_FC_RAB_STATE_NORMAL:
        case QOS_FC_RAB_STATE_NOT_DISCARD:
            /* 正常数传状态,不丢包 */
            return VOS_FALSE;

        case QOS_FC_RAB_STATE_RANDOM_DISCARD:
            FC_DBG_RCV_PKT_ONRD_STAT(enModemId, ucRabId, 1);
            /* 随机丢包 */
            ulRandValue = PS_RAND(101);
            if(ulRandValue > g_stQosFcCtrl.ulRandomDiscardRate)
            {
                return VOS_FALSE;
            }
            FC_DBG_DISCARD_PKT_ONRD_STAT(enModemId, ucRabId, 1);
            return VOS_TRUE;
        case QOS_FC_RAB_STATE_DISCARD:
            FC_DBG_RCV_PKT_OND_STAT(enModemId, ucRabId, 1);
            /* 丢包 */
            ulRandValue = PS_RAND(101);
            if(ulRandValue > g_stQosFcCtrl.ulDiscardRate)
            {
                return VOS_FALSE;
            }
            FC_DBG_DISCARD_PKT_OND_STAT(enModemId, ucRabId, 1);
            return VOS_TRUE;
        default:
             /* 非法状态 */
             CDS_ERROR_LOG3(UEPS_PID_CDS, "QosFc_IsDiscard : Rab invalid state::",enModemId, ucRabId, g_enRabState[enModemId][ucRabId - 5]);
             break;

    }

    /* 尽量不丢包 */
    return VOS_FALSE;
}
VOS_VOID CDS_DlProcImsData(CDS_IMS_SDU_STRU *pstImsSdu, const CDS_ENTITY_STRU *pstCdsEntity)
{
    TTF_MEM_ST          *pstImsPkt;

    CDS_DBG_IMS_DL_RX_IMS_PKT_NUM(1);

    /*如果是非连续内存,则拷贝到连续内存上;否则继续使用原来的内存*/
    if (VOS_NULL_PTR == pstImsSdu->pstSdu->pNext)
    {
        pstImsPkt = pstImsSdu->pstSdu;
    }
    else
    {
        pstImsPkt = CDS_TtfMemCopyAlloc(pstImsSdu->pstSdu,pstImsSdu->ulSduLen);
        TTF_MemFree(UEPS_PID_CDS,pstImsSdu->pstSdu);
    }

    if (VOS_NULL_PTR == pstImsPkt)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_DlProcImsData : Copy Alloc Ttf Mem Fail.Len=",pstImsSdu->ulSduLen);
        CDS_DBG_IMS_DL_ALLOC_MEM_FAIL_NUM(1);
        return ;
    }

    /*保存必要信息*/
    CDS_DL_SAVE_LEN_MODEMID_RABID_TO_TTF(pstImsPkt,
                                         pstImsPkt->usUsed,
                                         pstCdsEntity->usModemId,
                                         pstImsSdu->ucRabId);

    /*抓包*/
    CDS_SendIpPacket2PC(pstImsPkt);

    /*NDCLIENT数据包,发送到NDCLIENT*/
    if ((PS_TRUE == CDS_IsImsDefBearer(pstImsSdu->ucRabId,pstCdsEntity))
         && (PS_TRUE == CDS_IsNdClientPkt(pstImsPkt)))
    {
        CDS_SendNdDataIndMsg(pstImsPkt,pstImsSdu->ucRabId,pstCdsEntity);
        TTF_MemFree(UEPS_PID_CDS,pstImsPkt);
        CDS_DBG_IMS_DL_RX_ND_PKT_NUM(1);
        return;
    }
    else if (PS_TRUE == CDS_IsImsUtPkt(pstImsPkt, pstCdsEntity))
    {
        /*更新内存指针*/
        pstImsSdu->pstSdu = pstImsPkt;
        CDS_DlProcImsUtPkt(pstImsSdu,pstCdsEntity);
        return;
    }

    /*发送到IMS NIC*/
    if (PS_SUCC != IMS_NIC_DlDataRcv(pstImsPkt->pData,
                                     pstImsPkt->usUsed,
                                     pstCdsEntity->usModemId))
    {
        TTF_MemFree(UEPS_PID_CDS,pstImsPkt);
        CDS_DBG_IMS_DL_SEND_TO_NIC_FAIL_NUM(1);
        return;
    }

    /*释放内存*/
    TTF_MemFree(UEPS_PID_CDS,pstImsPkt);
    CDS_DBG_IMS_DL_SEND_TO_NIC_SUCC_NUM(1);
    return;
}
예제 #27
0
VOS_VOID CDS_ConfigDlIPF(VOS_VOID)
{
    VOS_UINT32              ulIdleBD;
    BSP_U32                 ulIdleCD;
    VOS_UINT32              ulCnt;
    VOS_UINT32              ulCfgCD;
    TTF_MEM_ST             *pstDestMem;
    TTF_MEM_ST             *pstSrcMem;
    IPF_CONFIG_DLPARAM_S   *pstDlCfgPara;
    int                     intLockLevel;
    VOS_UINT16              usSduLen;

    /*触发下行IPF释放源内存*/
    CDS_FreeIpfDlSrcMem();

    /*获得下行空闲BD/CD个数*/
    ulIdleBD = BSP_IPF_GetDlBDNum(&ulIdleCD);
    if (0 == ulIdleBD)
    {
        /*没有空闲BD*/
        CDS_DBG_DL_IPF_CFG_HAVE_NO_BD(1);
        return;
    }

    if (ulIdleBD > IPF_DLBD_DESC_SIZE)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_GUConfigDlIPF : DL Idle BD Num Error.",ulIdleBD);
        return;
    }

    if (0 == ulIdleCD)
    {
        /*没有空闲CD*/
        CDS_DBG_DL_IPF_CFG_HAVE_NO_CD(1);
        return;
    }

    ulCfgCD = 0;
    for (ulCnt = 0; ulCnt < ulIdleBD; ulCnt ++)
    {
        /**/
        pstDlCfgPara = &(g_stCdsIpfCtrlEntity.astDlIpfCfgPara[ulCnt]);
        if (PS_SUCC != LUP_PeekQueHead(CDS_GET_IPF_DL_SDU_QUE(),&pstSrcMem))
        {
            break;
        }

        /*Get BD*/
        ulCfgCD += CDS_GetTtfMemCnt(pstSrcMem);
        if (ulCfgCD > ulIdleCD)
        {
            CDS_DBG_DL_IPF_CFG_CD_NOT_ENOUGH(1);
            break;
        }

        /*申请目的内存*/
        usSduLen = CDS_DL_GET_PKT_LEN_FROM_TTF(pstSrcMem);
        pstDestMem = TTF_MemBlkAlloc(UEPS_PID_CDS, TTF_MEM_POOL_ID_DL_SHARE,usSduLen);
        if (VOS_NULL_PTR == pstDestMem)
        {
            if ((0 == usSduLen) || (CDS_DL_SDU_MAX_LEN < usSduLen))
            {
                intLockLevel = VOS_SplIMP();
                (VOS_VOID)LUP_DeQue(CDS_GET_IPF_DL_SDU_QUE(),&pstSrcMem);
                VOS_Splx(intLockLevel);
                TTF_MemFree(UEPS_PID_CDS,pstSrcMem);
                CDS_DBG_DL_IPF_CFG_BD_SDU_LEN_ERROR(1);
            }
            CDS_DBG_DL_IPF_CFG_BD_ALLOC_MEM_FAIL(1);
            break;
        }

        pstDestMem->usUsed = usSduLen;

        /*真实出队*/
        intLockLevel = VOS_SplIMP();
        if (PS_SUCC != LUP_DeQue(CDS_GET_IPF_DL_SDU_QUE(),&pstSrcMem))
        {
            /*异常保护,应该不会*/
            VOS_Splx(intLockLevel);
            vos_printf("CDS_GUConfigDlIPF : Should not be here !\r\n");
            TTF_MemFree(UEPS_PID_CDS,pstDestMem);
            break;
        }
        VOS_Splx(intLockLevel);

        pstDlCfgPara->u16UsrField = CDS_DL_GET_RABID_FROM_TTF(pstSrcMem);
        pstDlCfgPara->pstDstTtf   = pstDestMem;
        pstDlCfgPara->pstSrcTtf   = pstSrcMem;

    }

    /*配置下行过滤包数为0,直接返回*/
    if (0 == ulCnt)
    {
        return;
    }

    /*配置上行IPF过滤*/
    if (IPF_SUCCESS != BSP_IPF_ConfigDownFilter(ulCnt,g_stCdsIpfCtrlEntity.astDlIpfCfgPara,PS_TRUE))
    {
        /*配置失败后,源内存释放*/
        ulIdleBD = ulCnt;
        for (ulCnt = 0; ulCnt < ulIdleBD; ulCnt ++)
        {
            pstDlCfgPara = &(g_stCdsIpfCtrlEntity.astDlIpfCfgPara[ulCnt]);
            TTF_MemFree(UEPS_PID_CDS,pstDlCfgPara->pstDstTtf);
            TTF_MemFree(UEPS_PID_CDS,pstDlCfgPara->pstSrcTtf);
        }

        CDS_DBG_DL_IPF_CFG_BD_FAIL_NUM(ulIdleBD);
        return;
    }

    CDS_SaveIpfDlSrcMem(g_stCdsIpfCtrlEntity.astDlIpfCfgPara,ulCnt);

    CDS_DBG_DL_IPF_CFG_BD_SUCC_NUM(ulCnt);

    return;

}