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

📄 ixethacccodeletswbridgeqos.c

📁 intel IXP400系列cpu(2.3版)的库文件
💻 C
📖 第 1 页 / 共 2 页
字号:
     * VLAN/QoS configuration information     */     if ((ixEthDBPortEnable(firstPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQoS: Cannot enable port %u\n", firstPortId);        return (IX_FAIL);    }    if ((ixEthDBPortEnable(secondPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQos: Cannot enable port %u\n", secondPortId);        return (IX_FAIL);    }    /* Configure Xscale QoS : the access layer datapath      * prioritizes the different classes of traffic.     */    printf("Set Tx Scheduling discipline...\n");    if (ixEthAccTxSchedulingDisciplineSet(firstPortId, 					  FIFO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Tx Scheduling for discipline port %u\n",	       (UINT32)firstPortId);	return (IX_FAIL);    }    if (ixEthAccTxSchedulingDisciplineSet(secondPortId, 					  FIFO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Tx Scheduling for discipline port %u\n",	       (UINT32)secondPortId);	return (IX_FAIL);    }    printf("Set Rx Scheduling discipline...\n");    if (ixEthAccRxSchedulingDisciplineSet(FIFO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Rx Scheduling discipline!\n");	return (IX_FAIL);    }    /* NPE QoS : Configure VLAN traffic for highest priority      * on first port. Tagging is enabled on Egress (use default tag     * for this port) and untagging is enabled on ingress.     * The traffic running on this bridge will be untagged.     */    printf("Set VLAN default tag...\n");    if (ixEthDBPortVlanTagSet(firstPortId, 			      IX_ETHACC_CODELET_VLANID_DEFAULT)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to set the default VLAN ID for port %u\n",	       firstPortId);	return (IX_FAIL);    }    printf("Enable tagged frames...\n");    if (ixEthDBAcceptableFrameTypeSet(firstPortId,				      IX_ETH_DB_VLAN_TAGGED_FRAMES				      | IX_ETH_DB_UNTAGGED_FRAMES)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to set the acceptable frame type for port %u\n",	       firstPortId);	return (IX_FAIL);    }    printf("Setting VLAN membership...\n");    /* by default the entire VLAN range 0-4094 is included in the       port VLAN membership table, therefore we need to remove all        VLAN IDs but 0 (which is required to accept untagged frames) */    if (ixEthDBPortVlanMembershipRangeRemove(firstPortId, 
        1, IX_ETH_DB_802_1Q_MAX_VLAN_ID) != IX_ETH_DB_SUCCESS)
    {
        printf("SwBridgeQos: Failed to set VLAN membership for port %u\n", firstPortId);
        return (IX_FAIL);    }    /* now add the range used by this codelet */    if (ixEthDBPortVlanMembershipRangeAdd(firstPortId, 					  IX_ETHACC_CODELET_VLANID_MIN,					  IX_ETHACC_CODELET_VLANID_MAX)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to set VLAN membership for port %u\n",	       firstPortId);	return (IX_FAIL);    }    printf("Enable Egress VLAN tagging...\n");    if (ixEthDBEgressVlanRangeTaggingEnabledSet(firstPortId, 						IX_ETHACC_CODELET_VLANID_MIN,						IX_ETHACC_CODELET_VLANID_MAX,						TRUE)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to enable VLAN Egress tagging for port %u\n",	       firstPortId);	return (IX_FAIL);    }    printf("Enable Ingress VLAN untagging...\n");    if (ixEthDBIngressVlanTaggingEnabledSet(firstPortId, 					    IX_ETH_DB_REMOVE_TAG)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to enable VLAN Ingress untagging for port %u\n",	       firstPortId);	return (IX_FAIL);    }        printf("Setup priority mapping table...\n");    if (ixEthDBPriorityMappingTableSet(firstPortId,				       priorityTable)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to set the priority mapping Table for port %u\n",	       firstPortId);	return (IX_FAIL);	    }        /* Configure 10 mb/s on second port to create a      * traffic congestion on the bridge : the high      * priority traffic should pass, the low priority     * traffic should starve.     */    if (ixEthAccCodeletLinkSlowSpeedSet(secondPortId)	!= IX_SUCCESS)    {	printf("SwBridgeQos: Failed to set port %u to 10 Mbit\n", 	       secondPortId);	return (IX_FAIL);    }    /* Allow RX and TX traffic to run */    if ( ixEthAccPortEnable(firstPortId) != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to start the Bridge Operation for port %u\n",	       firstPortId);	return (IX_FAIL);    }    if ( ixEthAccPortEnable(secondPortId) != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to start the Bridge Operation for port %u\n",	       secondPortId);	return (IX_FAIL);    }    /* display the default settings for both ports */    printf("Port %u configuration:\n", 	   (UINT32)firstPortId);    printf("- Accept Ingress VLAN-tagged traffic, VLAN tag range is [%u-%u]\n",	   (UINT32)IX_ETHACC_CODELET_VLANID_MIN,	   (UINT32)IX_ETHACC_CODELET_VLANID_MAX);    printf("- Strip tag from ingress traffic\n");    printf("- Bridge Ingress to port %u without tag\n",	   (UINT32)secondPortId);    printf("- Frame priorities may change the frame order (QoS enabled)\n");    printf("- Insert a default tag [%u] to egress traffic\n",	   (UINT32)IX_ETHACC_CODELET_VLANID_DEFAULT);     printf("Port %u configuration:\n", 	   (UINT32)secondPortId);    printf("- Set as default\n\n");    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletSwBridgeQoSStop() * * Unconfigure QoS and Stop bridge datapath */IX_STATUS ixEthAccCodeletSwBridgeQoSStop(IxEthAccPortId firstPortId, 					 IxEthAccPortId secondPortId){    /* Stop the receive and transmit traffic */    if ( ixEthAccCodeletPortUnconfigure(firstPortId)	 != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to unconfigure the Bridge Operation for port %u\n",	       firstPortId);	return (IX_FAIL);    }    if ( ixEthAccCodeletPortUnconfigure(secondPortId)	 != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to unconfigure the Bridge Operation for port %u\n",	       secondPortId);	return (IX_FAIL);    }    if ( ixEthAccPortDisable(firstPortId)	 != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to stop the Bridge Operation for port %u\n",	       firstPortId);	return (IX_FAIL);    }    if ( ixEthAccPortDisable(secondPortId)	 != IX_SUCCESS)    {	printf("SwBridgeQos: Failed to stop the Bridge Operation for port %u\n",	       secondPortId);	return (IX_FAIL);    }    /* Disable Xscale QoS */    printf("Set Tx Scheduling discipline...\n");    if (ixEthAccTxSchedulingDisciplineSet(firstPortId, 					  FIFO_NO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Tx Scheduling discipline port %u\n",	       (UINT32)firstPortId);	return (IX_FAIL);    }    if (ixEthAccTxSchedulingDisciplineSet(secondPortId, 					  FIFO_NO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Tx Scheduling discipline port %u\n",	       (UINT32)secondPortId);	return (IX_FAIL);    }    printf("Set Rx Scheduling discipline...\n");    if (ixEthAccRxSchedulingDisciplineSet(FIFO_NO_PRIORITY)	!= IX_ETH_ACC_SUCCESS)    {	printf("SwBridgeQos: Failed to set Rx Scheduling discipline\n");	return (IX_FAIL);    }    /* Enable the EDB Port again and disable the VLAN/QoS configuration     * note that no traffic will pass in this mode. After the restoring the     * configuration to a known state that will not affect other operation     * modes the ethDB port will be disabled     */    if ((ixEthDBPortEnable(firstPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQoS: Cannot enable port %u\n", firstPortId);        return (IX_FAIL);    }    if ((ixEthDBPortEnable(secondPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQoS: Cannot enable port %u\n", secondPortId);        return (IX_FAIL);    }        /* Disable NPE QoS and VLAN setup */    printf("Disable VLAN tagging...\n");    if (ixEthDBEgressVlanRangeTaggingEnabledSet(firstPortId, 						IX_ETHACC_CODELET_VLANID_MIN,						IX_ETHACC_CODELET_VLANID_MAX,						FALSE)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to disable VLAN Egress tagging for port %u\n",	       firstPortId);	return (IX_FAIL);    }    printf("Disable tagged frames...\n");    if (ixEthDBAcceptableFrameTypeSet(firstPortId,				      IX_ETH_DB_UNTAGGED_FRAMES)	!= IX_ETH_DB_SUCCESS)    {	printf("SwBridgeQos: Failed to set the acceptable frame type for port %u\n",	       firstPortId);	return (IX_FAIL);    }    /* Disable the VLAN/QoS Feature to return to the initial processing     * capabilities     */    if ( ixEthDBFeatureEnable((IxEthDBPortId) firstPortId, 			      IX_ETH_DB_VLAN_QOS, 			      FALSE) != IX_ETH_DB_SUCCESS )    {	printf("SwBridgeQoS: Failed to disable the VLAN/QoS Feature for port %u\n", 	       firstPortId);	return (IX_FAIL);    }    /* disable the ethDB port */    if ((ixEthDBPortDisable(firstPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQoS: Cannot disable port %u\n", firstPortId);        return (IX_FAIL);    }    if ((ixEthDBPortDisable(secondPortId)) != IX_ETH_DB_SUCCESS)    {        printf("SwBridgeQoS: Cannot disable port %u\n", secondPortId);        return (IX_FAIL);    }        /* Restore the link speed to 100 Mbit */    if (ixEthAccCodeletLinkDefaultSpeedSet(secondPortId)	!= IX_SUCCESS)    {	printf("SwBridgeQos: Failed to reset port %u to a 100 Mbit port!\n",	       secondPortId);	return (IX_FAIL);    }    return (IX_SUCCESS);}

⌨️ 快捷键说明

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