⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ixethdbvlan.c

📁 AMCC POWERPC 44X系列的U-BOOT文件
💻 C
📖 第 1 页 / 共 3 页
字号:
IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID){    PortInfo *portInfo = &ixEthDBPortInfo[portID];    IxNpeMhMessage message;    IX_STATUS result;    FILL_SETRXTAGMODE_MSG(message, portID, portInfo->npeFrameFilter, portInfo->npeTaggingAction);    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);    return result;}/** * @brief sets the default Ingress tagging behavior * * @param portID ID of the port * @param taggingAction default tagging behavior * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction){    PortInfo *portInfo;        IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        portInfo = &ixEthDBPortInfo[portID];        if (taggingAction == IX_ETH_DB_PASS_THROUGH)    {        portInfo->npeTaggingAction = 0x00;    }    else if (taggingAction == IX_ETH_DB_ADD_TAG)    {        portInfo->npeTaggingAction = 0x02;    }    else if (taggingAction == IX_ETH_DB_REMOVE_TAG)    {        portInfo->npeTaggingAction = 0x01;    }    else    {        return IX_ETH_DB_INVALID_ARG;    }        portInfo->taggingAction = taggingAction;        return ixEthDBIngressVlanModeUpdate(portID);}/** * @brief retrieves the default Ingress tagging behavior of a port * * @param portID ID of the port * @param taggingAction location to save the default tagging behavior *  * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction){    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);    IX_ETH_DB_CHECK_REFERENCE(taggingAction);        *taggingAction = ixEthDBPortInfo[portID].taggingAction;        return IX_ETH_DB_SUCCESS;}/** * @brief sets the Ingress acceptable frame type filter * * @param portID ID of the port * @param frameFilter acceptable frame type filter *  * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter){    PortInfo *portInfo;    IxEthDBStatus result = IX_ETH_DB_SUCCESS;            IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        /* check parameter range        the ORed value of the valid values is 0x7       a value having extra bits is invalid */    if ((frameFilter | 0x7) != 0x7 || frameFilter == 0)    {        return IX_ETH_DB_INVALID_ARG;    }        portInfo = &ixEthDBPortInfo[portID];        portInfo->frameFilter    = frameFilter;    portInfo->npeFrameFilter = 0; /* allow all by default */        /* if accepting priority tagged but not all VLAN tagged       set the membership table to contain only VLAN ID 0        hence remove vlans 1-4094 and add VLAN ID 0 */    if (((frameFilter & IX_ETH_DB_PRIORITY_TAGGED_FRAMES) != 0)        && ((frameFilter & IX_ETH_DB_VLAN_TAGGED_FRAMES) == 0))    {        result = ixEthDBPortVlanMembershipRangeChange(portID,             1, IX_ETH_DB_802_1Q_MAX_VLAN_ID, portInfo->vlanMembership, REMOVE_VLAN);        if (result == IX_ETH_DB_SUCCESS)        {            ixEthDBLocalVlanMembershipChange(0, portInfo->vlanMembership, ADD_VLAN);            result = ixEthDBVlanTableRangeUpdate(portID);        }    }        /* untagged only? */    if (frameFilter == IX_ETH_DB_UNTAGGED_FRAMES)    {        portInfo->npeFrameFilter = 0x01;    }        /* tagged only? */    if ((frameFilter & IX_ETH_DB_UNTAGGED_FRAMES) == 0)    {        portInfo->npeFrameFilter = 0x02;    }    if (result == IX_ETH_DB_SUCCESS)    {        result = ixEthDBIngressVlanModeUpdate(portID);    }    return result;}/** * @brief retrieves the acceptable frame type filter for a port * * @param portID ID of the port * @param frameFilter location to store the frame filter * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter){    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        IX_ETH_DB_CHECK_REFERENCE(frameFilter);        *frameFilter = ixEthDBPortInfo[portID].frameFilter;        return IX_ETH_DB_SUCCESS;}/** * @brief sends an NPE the updated configuration related * to one QoS priority (associated traffic class and AQM mapping) * * @param portID ID of the port * @param classIndex QoS priority (traffic class index) * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise * * @internal */IX_ETH_DB_PUBLICIxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex){    IxNpeMhMessage message;    IX_STATUS result;    UINT32 trafficClass = ixEthDBPortInfo[portID].priorityTable[classIndex];    UINT32 aqmQueue     = ixEthDBPortInfo[portID].ixEthDBTrafficClassAQMAssignments[trafficClass];        FILL_SETRXQOSENTRY(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), classIndex, trafficClass, aqmQueue);        IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);        return result;}/** * @brief sets the priority mapping table * * @param portID ID of the port * @param priorityTable new priority mapping table * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable){    UINT32 classIndex;        IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        IX_ETH_DB_CHECK_REFERENCE(priorityTable);               for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)    {        /* check range */        if (priorityTable[classIndex] >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)        {            return IX_ETH_DB_INVALID_PRIORITY;        }    }        /* set new traffic classes */    for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)    {        ixEthDBPortInfo[portID].priorityTable[classIndex] = priorityTable[classIndex];                if (ixEthDBUpdateTrafficClass(portID, classIndex) != IX_ETH_DB_SUCCESS)        {            return IX_ETH_DB_FAIL;        }    }        return IX_ETH_DB_SUCCESS; }/** * @brief retrieves a port's priority mapping table * * @param portID ID of the port * @param priorityTable location to store the priority table * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable){    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        IX_ETH_DB_CHECK_REFERENCE(priorityTable);        memcpy(priorityTable, ixEthDBPortInfo[portID].priorityTable, sizeof (IxEthDBPriorityTable));        return IX_ETH_DB_SUCCESS;}/** * @brief sets one QoS priority => traffic class mapping * * @param portID ID of the port * @param userPriority QoS (user) priority * @param trafficClass associated traffic class * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass){    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);    /* check ranges for userPriority and trafficClass */    if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT || trafficClass >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)    {        return IX_ETH_DB_INVALID_PRIORITY;    }        ixEthDBPortInfo[portID].priorityTable[userPriority] = trafficClass;        return ixEthDBUpdateTrafficClass(portID, userPriority);}/** * @brief retrieves one QoS priority => traffic class mapping * * @param portID ID of the port * @param userPriority QoS (user) priority * @param trafficClass location to store the associated traffic class *  * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass){    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);        IX_ETH_DB_CHECK_REFERENCE(trafficClass);        /* check userPriority range */    if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT)    {        return IX_ETH_DB_INVALID_PRIORITY;    }        *trafficClass = ixEthDBPortInfo[portID].priorityTable[userPriority];        return IX_ETH_DB_SUCCESS;}/** * @brief enables or disables the source port extraction * from the VLAN TPID field * * @param portID ID of the port * @param enable TRUE to enable or FALSE to disable * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @return IX_ETH_DB_SUCCESS if the operation completed successfully * or an appropriate error message otherwise */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable){    IxNpeMhMessage message;    IX_STATUS result;    IX_ETH_DB_CHECK_PORT(portID);        IX_ETH_DB_CHECK_SINGLE_NPE(portID);        IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);    FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable);    IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);        return result;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -