Netdev List
 help / color / mirror / Atom feed
From: "Ananda Raju" <ananda.raju@neterion.com>
To: <netdev@oss.sgi.com>
Cc: "'Leonid Grossman'" <Leonid.Grossman@neterion.com>,
	<ravinandan.arakali@neterion.com>
Subject: clarification required on UDP sendfile()
Date: Fri, 9 Sep 2005 18:37:16 -0700	[thread overview]
Message-ID: <200509100138.j8A1c8lb003006@guinness.s2io.com> (raw)

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 

                 reply	other threads:[~2005-09-10  1:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200509100138.j8A1c8lb003006@guinness.s2io.com \
    --to=ananda.raju@neterion.com \
    --cc=Leonid.Grossman@neterion.com \
    --cc=netdev@oss.sgi.com \
    --cc=ravinandan.arakali@neterion.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox