From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18922 invoked by alias); 19 Dec 2007 11:25:18 -0000 Received: (qmail 18905 invoked by uid 22791); 19 Dec 2007 11:25:16 -0000 X-Spam-Check-By: sourceware.org Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 19 Dec 2007 11:25:04 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1J4x2o-00026p-00; Wed, 19 Dec 2007 12:24:58 +0100 Date: Wed, 19 Dec 2007 14:17:00 -0000 From: Andrew Lunn To: ?yvind Harboe Cc: eCos Disuss Message-ID: <20071219112458.GB5944@lunn.ch> Mail-Followup-To: ?yvind Harboe , eCos Disuss References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: Improving TFTP performance X-SW-Source: 2007-12/txt/msg00114.txt.bz2 On Wed, Dec 19, 2007 at 11:38:22AM +0100, ?yvind Harboe wrote: > Take #2. Wrote up negotiation of segsize, passes first smoketest. > Anyone interesting helping to test/comment on the patch? > > Tested w/this server: http://tftpd32.jounin.net > > -- > ?yvind Harboe > http://www.zylin.com - eCos ARM & FPGA developer kit > ### Eclipse Workspace Patch 1.0 > #P ecos > Index: net/common/current/cdl/net.cdl > =================================================================== > RCS file: /cvs/ecos/ecos-opt/net/net/common/current/cdl/net.cdl,v > retrieving revision 1.17 > diff -u -r1.17 net.cdl > --- net/common/current/cdl/net.cdl 7 Jan 2007 14:46:55 -0000 1.17 > +++ net/common/current/cdl/net.cdl 19 Dec 2007 10:36:38 -0000 > @@ -167,6 +167,16 @@ > threads can have precedence over TFTP server processing." > } > > + cdl_option CYGPKG_NET_TFTPD_CLIENT_GET_PACKETSIZE { > + display "TFTP protocol allows negotiation of bigger packets." > + flavor data > + default_value 512 > + legal_values 512 to 65464 > + description " > + tftp blksize egotiation support. >512 byte block sizes improves > + tftp GET performance" > + } You should comment that this requires a server which implements the optional RFC 2348. > + if (ntohs(hdr->th_opcode) == OACK) { > + // We can have only *one* option, the one we sent.. > + if (strncmp(data+2, "blksize", from_len)==0) > + { > + blksize=atol(data+2+strlen("blksize")+1); > + } else > + { > + // option ignored, use default. > + } > + // Send out the ACK > + hdr->th_opcode = htons(ACK); > + hdr->th_block = htons(last_good_block); > + if (sendto(s, data, 4 /* FIXME */, 0, > + &from_addr, from_len) < 0) { > + // Problem sending request > + *err = TFTP_NETERR; > + goto out; > + } > + > + } This should be conditionally compiled. > + int * const err) { > + int result; > +#if CYGPKG_NET_TFTPD_CLIENT_GET_PACKETSIZE>512 > + char *data = malloc(CYGPKG_NET_TFTPD_CLIENT_GET_PACKETSIZE+sizeof(struct tftphdr)); No lines longer than 80 characters please. You probably need to look at the case of the server returning ERROR when you pass it the additional option during a get. You probably should try the GET again without the option and see if it works. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss