* clarification required on UDP sendfile()
@ 2005-09-10 1:37 Ananda Raju
0 siblings, 0 replies; only message in thread
From: Ananda Raju @ 2005-09-10 1:37 UTC (permalink / raw)
To: netdev; +Cc: 'Leonid Grossman', ravinandan.arakali
Hi,
We are implementing UDP Large send offload (USO) feature for our Xframe-II
10g Ethernet adapter. We are facing problem in using sendfile().
we have written a client server program which uses sendfile() over udp. We
are facing a problem in which the last sendfile() operation fails to reach
server. This behavior is irrespective of USO feature.
Client.c has following code. Size of file iperf-2.0.1.tar.gz used for
transfer is 222957
--------------------------------------------------
Main()
{
portno=16000;
fd1 = open("iperf-2.0.1.tar.gz",O_RDWR);
fd = socket(AF_INET,SOCK_DGRAM,0);
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(portno);
serv_addr.sin_addr.s_addr = inet_addr("172.10.1.227");
ret = connect(fd,&serv_addr,sizeof(serv_addr));
len = sizeof(client_addr);
off=0;
while (1) {
size = 40*1024;
ret = sendfile(fd,fd1,NULL,size);
printf("size %d \n",ret);
sleep(1);
if (ret<=0)
exit(0);
}
close(fd);
close(fd1);
}
--------------------------------------------
Server.c has following code
--------------------------------------------
int portno=16000;
char buf[65000];
main()
{
fd = socket(AF_INET,SOCK_DGRAM,0);
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(portno);
ret = bind(fd,(struct sockaddr*)&serv_addr,sizeof(serv_addr));
len = sizeof(client_addr);
while (1){
ret = recvfrom(fd,&buf,sizeof(buf),0,(struct
sockaddr*)&client_addr,&len);
printf("size %d \n",ret);
}
}
-------------------------------------------
# ls -l |grep iperf-2.0.1.tar.gz
-rw-r--r-- 1 root root 222957 Sep 8 08:31 iperf-2.0.1.tar.gz
#
#./client
size 40960
size 40960
size 40960
size 40960
size 40960
size 18157 <<< Didn't reach server
size 0
#
#./server
size 40960
size 40960
size 40960
size 40960
size 40960
The last transmit of 18157 bytes didn't reach the server, any reason why
this happens. Also some time the middle frames also won't reach the server.
We did tcpdump and observed that the packets are not put on the wire. The
packets are getting lost in the host network stack. Is this behavior is
expected or We are doing wrong somewhere?
Regards,
Ananda
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-09-10 1:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-10 1:37 clarification required on UDP sendfile() Ananda Raju
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox