最近在调试DSP6678千兆以太网通信,希望实现500Mbps的通信速率;
采用两种方法进行了测试,结果发现通信速率都不高:
1. 采用NDK UDP发送,软件架构是开辟一个UDP_send任务线程while(1)循环sendto发送1024个字节到PC:
while(1)
{
nLen = 0;
I = sendto(sudp, (char *)dataNet, PACK_LEN, 0, (PSA)&sin1, m_nAddrLen);
TaskSleep(1);
//TaskSleep(1);
//asm(" NOP 5");
// uCounter = 0;
// while(uCounter<100000000)
// {
// uCounter++;
// }
}
为了调节发送速度,修改TaskSleep()的时间,最小设置为1,在PC端显示的接受速度为几十Mbps,然而改用自己设置的延时,发现根本就发送不出去,有些时候即使是使用TaskSleep(1),有些时候好像也会出现数据发送不出去的现象。
我想问一下,为何只能使用TaskSleep进行延时,而且延时时间短了,还会出现发送不出去的现象?
那么NDK发送数据到PC,最快的速度能到多少Mbps?
2. 使用PAexample中的配置如下:
Int32 SendPacket (Void)
{
Cppi_Desc* pCppiDesc;
UInt32 dataBufferSize;
char psFlags = (cpswSimTest)?pa_EMAC_PORT_0:pa_EMAC_PORT_1; /* pa_EMAC_PORT_1上挂的有RJ45 */
/* Get a free descriptor from the global free queue we setup
* during initialization.
*/
if ((pCppiDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL) /* 从发送free queues中pop出一个descriptors出来 */
{
System_printf ("No Tx free descriptor. Cant run send/rcv test \n");
return -1;
}
/* The descriptor address returned from the hardware has the
* descriptor size appended to the address in the last 4 bits.
*
* To get the true descriptor size, always mask off the last
* 4 bits of the address.
*/
pCppiDesc = (Ptr) ((UInt32) pCppiDesc & 0xFFFFFFF0);
dataBufferSize = sizeof (pktMatch);
/* 给 descriptors 设置数据,也就是要发送的数据pktMatch,UDP数据源包 */
Cppi_setData ( Cppi_DescType_HOST,
(Cppi_Desc *) pCppiDesc,
(UInt8 *) Convert_CoreLocal2GlobalAddr((UInt32)pktMatch),
dataBufferSize
);
/* 设置packet length */
Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, dataBufferSize);
if (cpswLpbkMode != CPSW_LOOPBACK_NONE)
{
/* Force the packet to the specific EMAC port if loopback is enabled */
Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, psFlags);
}
else
{
/* 这样去设置PS flags */
Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, 0);
}
/* Send the packet out the mac. It will loop back to PA if the mac/switch
* have been configured properly
*/
/* 将这个描述符descriptor压入到PA的Tx queue中,这里选择的是queue 648 SwTx0, 送入到队列尾部 */
Qmss_queuePush (gPaTxQHnd[8], pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);
/* Increment the application transmit counter */
gTxCounter ++;
/* Give some time for the PA to process the packet */
CycleDelay (200000); // 1ms
// 试试能不能回收
Qmss_queuePush (gTxFreeQHnd, pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);
return 0;
}
这里面发送最后也要进行延时等待,等待PA处理完毕,我想知道PA处理得多快?我设置延时时间稍微短一下,就出现数据没有发送出去的现象,感觉GbE千兆以太网只有百兆以太网的效果,根本达不到我想要实现的高速接口的作用。
想问一下,TI有没有相关的测试文档说明GbE究竟能够实现多少通信速率?