Ejemplo n.º 1
0
IX_STATUS 
ixEthAccCodeletSwLoopback(void)
{
    IxEthAccPortId portId;
 
    IX_ETHACC_IS_CODELET_INITIALISED();

    /* Configure all available ports */
    for (portId = 0; portId < IX_ETHACC_CODELET_MAX_PORT; portId++)
    {
	if (ixEthAccCodeletHardwareExists[portId])
	{
	    if (ixEthAccCodeletSwLoopbackStart(portId) 
		!= IX_ETH_ACC_SUCCESS)
	    {
		printf("CodeletMain: Failed to configure the RX Sink Operation Port %u\n",
		       (UINT32)portId);
		return IX_FAIL;
	    }
	}
    }

    printf("\n");
    printf("Software loopback successfully started.\n");
    printf("Begin sending packets from external source\n");  
    printf("\n");

    /* wait for user input */
    if(ixEthAccCodeletLoop() != IX_SUCCESS)
    {
	return (IX_FAIL);
    }

    /* Stop traffic and unconfigure all available ports */
    for (portId = 0; portId < IX_ETHACC_CODELET_MAX_PORT; portId++)
    {
	if (ixEthAccCodeletHardwareExists[portId])
	{
	    if (ixEthAccCodeletSwLoopbackStop(portId) 
		!= IX_ETH_ACC_SUCCESS)
	    {
		printf("CodeletMain: Failed to unconfigure the RX Sink Operation Port %u\n",
		       (UINT32)portId);
		return IX_FAIL;
	    }
	}
    }

    /* wait for pending traffic to be completely received */
    if (ixEthAccCodeletRecoverBuffers() 
	!= IX_SUCCESS)
    {
	printf("CodeletMain: Warning! Not all buffers are accounted for\n");
    }

    return (IX_SUCCESS);
}
Ejemplo n.º 2
0
IX_STATUS 
ixEthAccCodeletTxGenRxSinkLoopbackStart(IxEthAccPortId sinkPortId,
					IxEthAccPortId loopPortId)
{
    IX_STATUS ret = IX_SUCCESS;

    if (sinkPortId == loopPortId)
    {
	printf("TxGenRxSinkLoopback: Cannot configure a Port %u in both txGenRxSink and Loopback (Ports must be different)\n", sinkPortId);
	return (IX_FAIL);
    }

    ret = ixEthAccCodeletTxGenRxSinkStart(sinkPortId);

    if (ret != IX_SUCCESS)
	return ret;
    else
	return ixEthAccCodeletSwLoopbackStart(loopPortId);
}