TMS320C6678如何发挥GbE千兆以太网的性能达到500Mbps?

2019-03-26 15:12发布

最近在调试DSP6678千兆以太网通信,希望实现500Mbps的通信速率;采用两种方法进行了测试,结果发现通信速率都不高:1. 采用NDK UDP发送,软件架构是开辟一个UDP_send任务线程while(1)循环sendto发送1024个字节到PC:
  1.   while(1)
  2.     {
  3.         nLen = 0;

  4.         I = sendto(sudp, (char *)dataNet, PACK_LEN, 0, (PSA)&sin1, m_nAddrLen);
  5.         TaskSleep(1);
  6.         //TaskSleep(1);
  7.         //asm(" NOP 5");
  8. //      uCounter = 0;
  9. //      while(uCounter<100000000)
  10. //      {
  11. //          uCounter++;
  12. //      }
  13.     }
复制代码为了调节发送速度,修改TaskSleep()的时间,最小设置为1,在PC端显示的接受速度为几十Mbps,然而改用自己设置的延时,发现根本就发送不出去,有些时候即使是使用TaskSleep(1),有些时候好像也会出现数据发送不出去的现象。我想问一下,为何只能使用TaskSleep进行延时,而且延时时间短了,还会出现发送不出去的现象?那么NDK发送数据到PC,最快的速度能到多少Mbps?2. 使用PAexample中的配置如下:
  1. Int32 SendPacket (Void)
  2. {
  3.     Cppi_Desc*      pCppiDesc;
  4.     UInt32          dataBufferSize;
  5.     char            psFlags = (cpswSimTest)?pa_EMAC_PORT_0:pa_EMAC_PORT_1; /* pa_EMAC_PORT_1上挂的有RJ45 */

  6.     /* Get a free descriptor from the global free queue we setup
  7.      * during initialization.
  8.      */
  9.     if ((pCppiDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL) /* 从发送free queues中pop出一个descriptors出来 */
  10.     {
  11.         System_printf ("No Tx free descriptor. Cant run send/rcv test ");
  12.         return -1;
  13.     }

  14.     /* The descriptor address returned from the hardware has the
  15.      * descriptor size appended to the address in the last 4 bits.
  16.      *
  17.      * To get the true descriptor size, always mask off the last
  18.      * 4 bits of the address.
  19.      */
  20.     pCppiDesc = (Ptr) ((UInt32) pCppiDesc & 0xFFFFFFF0);   

  21.     dataBufferSize  =   sizeof (pktMatch);

  22.     /* 给 descriptors 设置数据,也就是要发送的数据pktMatch,UDP数据源包 */
  23.     Cppi_setData (  Cppi_DescType_HOST,
  24.                     (Cppi_Desc *) pCppiDesc,
  25.                     (UInt8 *) Convert_CoreLocal2GlobalAddr((UInt32)pktMatch),
  26.                     dataBufferSize
  27.                  );
  28.     /* 设置packet length */
  29.     Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, dataBufferSize);
  30.    
  31.     if (cpswLpbkMode != CPSW_LOOPBACK_NONE)
  32.     {
  33.         /* Force the packet to the specific EMAC port if loopback is enabled */
  34.         Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, psFlags);
  35.     }
  36.     else
  37.     {
  38.         /* 这样去设置PS flags */
  39.         Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, 0);
  40.     }
  41.   
  42.     /* Send the packet out the mac. It will loop back to PA if the mac/switch
  43.      * have been configured properly
  44.      */  
  45.     /* 将这个描述符descriptor压入到PA的Tx queue中,这里选择的是queue 648 SwTx0, 送入到队列尾部 */
  46.     Qmss_queuePush (gPaTxQHnd[8], pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);

  47.     /* Increment the application transmit counter */
  48.     gTxCounter ++;

  49.     /* Give some time for the PA to process the packet */
  50.     CycleDelay (200000); // 1ms

  51.     // 试试能不能回收
  52.     Qmss_queuePush (gTxFreeQHnd, pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);


  53.     return 0;
  54. }
复制代码这里面发送最后也要进行延时等待,等待PA处理完毕,我想知道PA处理得多快?我设置延时时间稍微短一下,就出现数据没有发送出去的现象,感觉GbE千兆以太网只有百兆以太网的效果,根本达不到我想要实现的高速接口的作用。想问一下,TI有没有相关的测试文档说明GbE究竟能够实现多少通信速率?
此帖出自小平头技术问答
0条回答

一周热门 更多>