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

📄 ixethacccodeletmain.c

📁 intel IXP400系列cpu(2.3版)的库文件
💻 C
📖 第 1 页 / 共 4 页
字号:
{    IX_ETHACC_IS_CODELET_INITIALISED();    #if defined(__linux) && (IX_ETH_CODELET_QMGR_DISPATCH_MODE==TRUE)    printf("\n*********************************************************************\n");    printf("WARNING: This operation uses too much CPU time in interrupt mode to display\n");    printf("         any counters. Please recompile the codelet for polled mode when\n");    printf("         using this operation\n\n");    printf("Polled mode: set IX_ETH_CODELET_QMGR_DISPATCH_MODE to FALSE in IxEthAccCodelet_p.h\n");    printf("*********************************************************************\n\n");#endif    /* This configuration requires two NPE be available to use */    if ( !((ixEthAccCodeletHardwareExists[inPort]) &&	   (ixEthAccCodeletHardwareExists[outPort]) ))    {	printf("CodeletMain: Failed to start Tx Gen RX Sink Operation as two NPEs are needed\n");	return (IX_FAIL);    }    if (ixEthAccCodeletTxGenRxSinkLoopbackStart(outPort, inPort)        != IX_ETH_ACC_SUCCESS)    {	printf("CodeletMain: Failed to start the Tx Gen RX Sink Operation\n");	return IX_FAIL;    }    printf("\n");    printf("TxGen RxSink successfully started.\n");    printf("Begin sending packets from external source\n");      printf("Or use a crossover cable between port %d and port %d\n",inPort,outPort);      printf("\n");    /* wait for user input */    if (ixEthAccCodeletLoop() != IX_SUCCESS)    {	return (IX_FAIL);    }        /* stop traffic, recover buffers */    if (ixEthAccCodeletTxGenRxSinkLoopbackStop(outPort, inPort)	    != IX_ETH_ACC_SUCCESS)    {	printf("CodeletMain: Failed to stop the Tx Gen RX Sink Operation\n");	return (IX_FAIL);    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning : Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletPhyLoopback() * * See header file for documentation. */IX_STATUSixEthAccCodeletPhyLoopback(void){    IxEthAccPortId portId;     IX_ETHACC_IS_CODELET_INITIALISED();#if defined(__linux) && (IX_ETH_CODELET_QMGR_DISPATCH_MODE==TRUE)    printf("\n*********************************************************************\n");    printf("WARNING: This operation uses too much CPU time in interrupt mode to display\n");    printf("         any counters. Please recompile the codelet for polled mode when\n");    printf("         using this operation.\n\n");    printf("Polled mode: set IX_ETH_CODELET_QMGR_DISPATCH_MODE to FALSE in IxEthAccCodelet_p.h\n");    printf("*********************************************************************\n\n");#endif    /* Configure all available ports */    for (portId = 0; portId < IX_ETHACC_CODELET_MAX_PORT; portId++)    {	if (ixEthAccCodeletHardwareExists[portId])	{	    if (ixEthAccCodeletPhyLoopbackStart(portId) 		!= IX_ETH_ACC_SUCCESS)	    {		printf("CodeletMain: Failed to configure the PHY Loopback Operation on Port %u\n",		       (UINT32)portId);		return IX_FAIL;	    }	}    }    printf("\n");    printf("PHY Loopback operation successfully started\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 (ixEthAccCodeletPhyLoopbackStop(portId) 		!= IX_ETH_ACC_SUCCESS)	    {		printf("CodeletMain: Failed to unconfigure the PHY Loopback Operation on Port %u\n",		       (UINT32)portId);		return IX_FAIL;	    }	}    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning: Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletBridge() * * See header file for documentation. */IX_STATUS ixEthAccCodeletSwBridge(IxEthAccPortId inPort,			IxEthAccPortId outPort){    IX_ETHACC_IS_CODELET_INITIALISED();    if (!ixEthAccCodeletHardwareExists[inPort]	|| !ixEthAccCodeletHardwareExists[outPort])    {	/* Bridge operation only works 	 * when two Eth NPEs are available	 *	 * B0 silicon may have only one eth coprocessor	 * A0 silicon has two Eth coprocessors	 */	printf("\n*********************************************************************\n");	printf ("Bridge operation needs two Eth coprocessors.\n");	printf ("Underlying silicon has only one Eth coprocessor!\n");	printf("\n*********************************************************************\n");	return IX_FAIL ;     }    if ( ixEthAccCodeletSwBridgeStart(inPort, 				      outPort)	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to start the Bridge Operation\n");	return (IX_FAIL);    }    printf("\n");    printf("Bridge Operation started. Begin sending packets from\n");    printf("external source between port %u and port %u\n", 	   (UINT32)inPort, 	   (UINT32)outPort);    printf("\n");    if(ixEthAccCodeletLoop()       != IX_SUCCESS)    {	return (IX_FAIL);    }    if ( ixEthAccCodeletSwBridgeStop(inPort, 				     outPort) 	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to stop the Bridge Operation\n");	return (IX_FAIL);    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning : Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletBridge() * * See header file for documentation. */IX_STATUS ixEthAccCodeletSwBridgeQoS(IxEthAccPortId inPort,			   IxEthAccPortId outPort){    IX_ETHACC_IS_CODELET_INITIALISED();    if (!ixEthAccCodeletHardwareExists[inPort]	|| !ixEthAccCodeletHardwareExists[outPort])    {	/* Bridge operation only works 	 * when both Eth NPEs are available	 *	 * B0 silicon may have only one eth coprocessor	 * A0 silicon has two Eth coprocessors	 */	printf("\n*********************************************************************\n");	printf ("Bridge operation needs two Eth coprocessors.\n");	printf ("Underlying silicon has only one Eth coprocessor!\n");	printf("\n*********************************************************************\n");	return IX_FAIL ;     }    if ( ixEthAccCodeletSwBridgeQoSStart(inPort, 					 outPort)	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to start the QoS Bridge Operation\n");	return (IX_FAIL);    }    printf("\n");    printf("Bridge Operation started. Begin sending packets from\n");    printf("external source between port %u and port %u\n", 	   (UINT32)inPort, 	   (UINT32)outPort);    printf("\n");    if(ixEthAccCodeletLoop()       != IX_SUCCESS)    {	return (IX_FAIL);    }    if ( ixEthAccCodeletSwBridgeQoSStop(inPort, 					outPort) 	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to stop the QoS Bridge Operation\n");	return (IX_FAIL);    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning : Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletBridgeFirewall() * * See header file for documentation. */IX_STATUS ixEthAccCodeletSwBridgeFirewall(IxEthAccPortId inPort,				IxEthAccPortId outPort){    IX_ETHACC_IS_CODELET_INITIALISED();    if (!ixEthAccCodeletHardwareExists[inPort]	|| !ixEthAccCodeletHardwareExists[outPort])    {	/* Bridge operation only works 	 * when both Eth NPEs are available	 *	 * B0 silicon may have only one eth coprocessor	 * A0 silicon has two Eth coprocessors	 */	printf("\n*********************************************************************\n");	printf ("Bridge operation needs two Eth coprocessors.\n");	printf ("Underlying silicon has only one Eth coprocessor!\n");	printf("\n*********************************************************************\n");	return IX_FAIL ;     }    if ( ixEthAccCodeletSwBridgeFirewallStart(inPort, 					      outPort)	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to start the Firewall Bridge Operation\n");	return (IX_FAIL);    }    printf("\n");    printf("Bridge Operation started. Begin sending packets from\n");    printf("external source between port %u and port %u\n", 	   (UINT32)inPort, 	   (UINT32)outPort);    printf("All frame with unknown source MAC addresses are filtered\n");    printf("\n");    if(ixEthAccCodeletLoop()       != IX_SUCCESS)    {	return (IX_FAIL);    }    if ( ixEthAccCodeletSwBridgeFirewallStop(inPort, 					     outPort) 	 != IX_SUCCESS)    {	printf("CodeletMain: Failed to stop the Firewall Bridge Operation\n");	return (IX_FAIL);    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning : Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletSwBridgeWiFi() * * See header file for documentation. */IX_STATUS ixEthAccCodeletSwBridgeWiFi(IxEthAccPortId inPort,			    IxEthAccPortId outPort){    IX_ETHACC_IS_CODELET_INITIALISED();    if (!ixEthAccCodeletHardwareExists[inPort]	|| !ixEthAccCodeletHardwareExists[outPort])    {	/* Bridge operation only works 	 * when both Eth NPEs are available	 *	 * B0 silicon may have only one eth coprocessor	 * A0 silicon has two Eth coprocessors	 */	printf("\n*********************************************************************\n");	printf ("Bridge operation needs two Eth coprocessors.\n");	printf ("Underlying silicon has only one Eth coprocessor!\n");	printf("\n*********************************************************************\n");	return IX_FAIL ;     }    if ( ixEthAccCodeletSwBridgeWiFiStart(inPort, 					      outPort)	 != IX_SUCCESS)    {	printf("Failed to start the Bridge Operation\n");	return (IX_FAIL);    }    if(ixEthAccCodeletLoop()       != IX_SUCCESS)    {	return (IX_FAIL);    }    if ( ixEthAccCodeletSwBridgeWiFiStop(inPort, 					     outPort) 	 != IX_SUCCESS)    {	printf("Failed to stop the Bridge Operation\n");	return (IX_FAIL);    }    /* wait for pending traffic to be completely received */    if (ixEthAccCodeletRecoverBuffers() 	!= IX_SUCCESS)    {	printf("Warning : Not all buffers are accounted for!\n");    }    return (IX_SUCCESS);}/* * Function definition: ixEthAccCodeletDBLearning() * * See header file for documentation. */IX_STATUS ixEthAccCodeletDBLearning(void){    IX_ETHACC_IS_CODELET_INITIALISED();    /* Configure ethDB tests for all available ports */    if (ixEthAccCodeletDBLearningRun(ixEthAccCodeletHardwareExists) 	!= IX_ETH_ACC_SUCCESS)    {	printf("CodeletMain: Failed to run ethDB configuration\n");	return IX_FAIL;    }    return (IX_SUCCESS);}/*********************************************************************** * * Codelet utility functions * ***********************************************************************//* * Function definition: ixEthAccCodeletShow() * * See header file for documentation.

⌨️ 快捷键说明

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