Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

why the altera TSE is so slow in qsys_ghrd_3c120 + nios2 linux

hi, all,

my hardware is Cyclone III FPGA Development Kit (3C120 board), and the quartus project is qsys_ghrd_3c120

I have succeed running nios2 linux ( refer to http://rocketboards.org/foswiki/view/documentation/niosiilinuxusermanualforcycloneiii),

the altera TSE is verified to work in 1000M full duplex mode.

then I test the altera TSE speed between the nios2 linux and the PC Windows with the following function in linux , then I find the udp transaction speed is only about 40~50Mbps,

why so slow?

anyone can tell me what's the problem? and how to get higher speed for altera TSE +nios2 linux?

thanks!!

my udp transaction function is :

int udp_handshake( )

{

int ipLen,i,iRet;

unsigned short udp_marks[8];

int net_error;

net_error=0;

printf("now to handshake by udp\n");

m_udp_socket=socket(AF_INET,SOCK_DGRAM,0);

memset(&addrin,0, sizeof(struct sockaddr_in) );

addrin.sin_family=AF_INET;

addrin.sin_port = htons(3500);

memset(&addrin.sin_zero,0,8);

if(bind(m_udp_socket,(struct sockaddr *)&addrin, sizeof(struct sockaddr_in))) //int bind (int SOCKET, struct sockaddr *ADDR, socklen_t LENGTH)

{

printf("can't creat net interface.......\r\n");

close(m_udp_socket);

return 0;

}

ipLen=sizeof(struct sockaddr_in);

for(i=0;i<8;i++)

{

udp_marks[i]=0;

}

iRet=recvfrom(m_udp_socket, (char * )udp_marks, 16, 0,(struct sockaddr *)&addrin, &ipLen); //first recv mark by blocking mode

printf("pc IP:%s port:%d\r\n",inet_ntoa(addrin.sin_addr),ntohs(addrin.sin_port) );

addrin.sin_port=htons(3500); ipLen=sizeof(struct sockaddr_in);

//test altera TSE speed with udp sending loop, data_length is from 1 to 32, so 1K to 32K data is sent by one sendto

for (i=0;i<send_loop;i++)

{

iRet=sendto(m_udp_socket, (char *)pData_buff, data_length*1024,0,(struct sockaddr *)&addrin,ipLen); //second send back handshake

if (iRet==-1)

{

net_error=1;

}

}

shutdown(m_udp_socket,2); close(m_udp_socket);

return 1;

}

2 Replies