예제 #1
0
/*
 * Function definition: ixEthAccCodeletSwBridgeStop()
 *
 * Stop bridge datapath
 */
IX_STATUS ixEthAccCodeletSwBridgeStop(IxEthAccPortId firstPortId, 
				      IxEthAccPortId secondPortId)
{
    /* Unconfigure the traffic callbacks for both ports */
    if ( ixEthAccCodeletPortUnconfigure(firstPortId)
	 != IX_SUCCESS)
    {
	printf("SwBridge: Failed to unconfigure Port %u\n", firstPortId);
	return (IX_FAIL);
    }

    if ( ixEthAccCodeletPortUnconfigure(secondPortId)
	 != IX_SUCCESS)
    {
	printf("SwBridge: Failed to unconfigure Port %u\n", secondPortId);
	return (IX_FAIL);
    }

    /* Disable the traffic over both ports */
    if ( ixEthAccPortDisable(firstPortId)
	 != IX_SUCCESS)
    {
	printf("SwBridge: Failed to disable Port %u\n", firstPortId);
	return (IX_FAIL);
    }

    if ( ixEthAccPortDisable(secondPortId)
	 != IX_SUCCESS)
    {
	printf("SwBridge: Failed to disable Port %u\n", secondPortId);
	return (IX_FAIL);
    }

    return (IX_SUCCESS);
}
예제 #2
0
/*
 * 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);
}