From: Luca Ceresoli <luca.ceresoli@comelit.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/6] TFTP: net/tftp.c: add server mode receive
Date: Tue, 17 May 2011 10:06:31 +0200 [thread overview]
Message-ID: <4DD22C87.4050206@comelit.it> (raw)
In-Reply-To: <m2aafmjoho.fsf@ohwell.denx.de>
Detlev Zundel wrote:
> Hi Luca,
>
>> Signed-off-by: Luca Ceresoli<luca.ceresoli@comelit.it>
>> Cc: Wolfgang Denk<wd@denx.de>
>> ---
>> Changes in v2: none.
> Only one comment below
>
>> net/tftp.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
>> net/tftp.h | 6 +++++
>> 2 files changed, 74 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/tftp.c b/net/tftp.c
>> index e166a63..87eb0b8 100644
>> --- a/net/tftp.c
>> +++ b/net/tftp.c
>> @@ -2,6 +2,8 @@
>> * Copyright 1994, 1995, 2000 Neil Russell.
>> * (See License)
>> * Copyright 2000, 2001 DENX Software Engineering, Wolfgang Denk, wd at denx.de
>> + * Copyright 2011 Comelit Group SpA,
>> + * Luca Ceresoli<luca.ceresoli@comelit.it>
>> */
>>
>> #include<common.h>
>> @@ -74,6 +76,7 @@ static short TftpNumchars; /* The number of hashes we printed */
>> #define STATE_TOO_LARGE 3
>> #define STATE_BAD_MAGIC 4
>> #define STATE_OACK 5
>> +#define STATE_RECV_WRQ 6
>>
>> #define TFTP_BLOCK_SIZE 512 /* default TFTP block size */
>> #define TFTP_SEQUENCE_SIZE ((ulong)(1<<16)) /* sequence number is 16 bit */
>> @@ -241,6 +244,10 @@ TftpSend (void)
>> TftpBlock=ext2_find_next_zero_bit(Bitmap,(Mapsize*8),0);
>> /*..falling..*/
>> #endif
>> +
>> +#ifdef CONFIG_CMD_TFTPSRV
>> + case STATE_RECV_WRQ:
>> +#endif
>> case STATE_DATA:
>> xp = pkt;
>> s = (ushort *)pkt;
>> @@ -293,7 +300,11 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
>> #endif
>> return;
>> }
>> - if (TftpState != STATE_SEND_RRQ&& src != TftpRemotePort)
>> + if (TftpState != STATE_SEND_RRQ&&
>> +#ifdef CONFIG_CMD_TFTPSRV
>> + TftpState != STATE_RECV_WRQ&&
>> +#endif
>> + src != TftpRemotePort)
>> return;
> Hm, I have to admit that I do not really like adding so many ifdefs into
> the tftp code and even into the state machine code. Can you give me a
> number on how much larger u-boot gets on your platform with and without
> the server support? If this is not too much, maybe we should include
> support always. If it is too much, maybe we can at least keep the state
> machine without ifdefs - if I see it correctly, this will only add at
> maximum a few bytes and STATE_RECW_WRQ will simply never be entered,
> correct?
Here are my measurements for the dig297 board (ARMV7 OMAP3):
text data bss dec hex
357085 8684 214264 580033 8d9c1 TFTPSRV on
356327 8660 214264 579251 8d6b3 TFTPSRV off, without #ifs
356355 8660 214268 579283 8d6d3 TFTPSRV off, with #ifs (as in PATCH v2)
The TFTP server adds 730 bytes to the text, so I guess it's worth to keep it
optional.
To my big surprise, removing most bad-looking #ifs (all of those that save just
one line) I got a *smaller* U-Boot! I repeated the test three times to be extra
sure, the figures are correct: without the #ifs we save a few bytes.
Obvious enough, I'm going to remove the #ifs.
Luca
next prev parent reply other threads:[~2011-05-17 8:06 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-13 9:08 [U-Boot] [RFC] Act as a TFTP server Luca Ceresoli
2011-04-13 11:37 ` Wolfgang Denk
2011-04-13 12:47 ` Luca Ceresoli
2011-04-30 19:53 ` Wolfgang Denk
2011-05-03 12:23 ` Luca Ceresoli
2011-05-03 12:36 ` Wolfgang Denk
2011-05-16 20:57 ` Luca Ceresoli
2011-04-14 10:31 ` Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 0/6] " Luca Ceresoli
2011-04-14 16:13 ` Albert ARIBAUD
2011-04-18 16:19 ` [U-Boot] [PATCH v2 " Luca Ceresoli
2011-04-19 14:05 ` Detlev Zundel
2011-05-17 10:03 ` [U-Boot] [PATCH v3 0/5] " Luca Ceresoli
2011-05-17 10:03 ` [U-Boot] [PATCH v3 1/5] TFTP: replace "server" with "remote" in local variable names Luca Ceresoli
2011-05-19 8:11 ` Detlev Zundel
2011-05-19 19:39 ` Wolfgang Denk
2011-05-17 10:03 ` [U-Boot] [PATCH v3 2/5] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-05-19 8:12 ` Detlev Zundel
2011-05-19 19:39 ` Wolfgang Denk
2011-05-17 10:03 ` [U-Boot] [PATCH v3 3/5] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-05-19 8:13 ` Detlev Zundel
2011-05-19 19:48 ` Wolfgang Denk
2011-05-17 10:03 ` [U-Boot] [PATCH v3 4/5] TFTP: add tftpsrv command Luca Ceresoli
2011-05-19 8:12 ` Detlev Zundel
2011-05-19 19:48 ` Wolfgang Denk
2011-05-17 10:03 ` [U-Boot] [PATCH v3 5/5] net/tftp.c: fix typo Luca Ceresoli
2011-05-19 8:13 ` Detlev Zundel
2011-05-19 19:48 ` Wolfgang Denk
2011-04-18 16:19 ` [U-Boot] [PATCH v2 1/6] README: remove spurious line Luca Ceresoli
2011-04-19 14:07 ` Detlev Zundel
2011-04-18 16:19 ` [U-Boot] [PATCH v2 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-19 14:15 ` Detlev Zundel
2011-04-19 15:26 ` Luca Ceresoli
2011-05-12 17:38 ` Wolfgang Denk
2011-04-18 16:19 ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-04-19 14:18 ` Detlev Zundel
2011-04-19 15:29 ` Luca Ceresoli
2011-04-19 16:28 ` Detlev Zundel
2011-04-19 21:56 ` Luca Ceresoli
2011-04-20 8:17 ` Detlev Zundel
2011-05-04 7:58 ` Luca Ceresoli
2011-05-04 10:37 ` Detlev Zundel
2011-04-20 8:41 ` Detlev Zundel
2011-04-20 10:55 ` Luca Ceresoli
2011-04-20 13:27 ` [U-Boot] checkpatch - theory and practice [was: [PATCH v2 3/6] TFTP: rename "server" to "remote"] Detlev Zundel
2011-05-16 20:35 ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-05-17 9:38 ` Detlev Zundel
2011-04-30 4:36 ` Mike Frysinger
2011-05-16 20:16 ` Luca Ceresoli
2011-05-12 17:46 ` Wolfgang Denk
2011-05-13 7:36 ` Luca Ceresoli
2011-05-14 16:07 ` Luca Ceresoli
2011-04-18 16:19 ` [U-Boot] [PATCH v2 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-19 14:22 ` Detlev Zundel
2011-04-18 16:19 ` [U-Boot] [PATCH v2 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-19 14:37 ` Detlev Zundel
2011-05-17 8:06 ` Luca Ceresoli [this message]
2011-05-17 9:41 ` Detlev Zundel
2011-04-18 16:19 ` [U-Boot] [PATCH v2 6/6] TFTP: add tftpsrv command Luca Ceresoli
2011-04-19 14:39 ` Detlev Zundel
2011-04-30 4:32 ` Mike Frysinger
2011-05-04 7:02 ` Mike Frysinger
2011-04-14 15:52 ` [U-Boot] [PATCH 1/6] README: remove spurious line Luca Ceresoli
2011-04-30 20:19 ` Wolfgang Denk
2011-04-14 15:52 ` [U-Boot] [PATCH 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-30 20:22 ` Wolfgang Denk
2011-04-30 20:24 ` Wolfgang Denk
2011-05-03 8:54 ` Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 6/6] TFTP: add tftpsrv command Luca Ceresoli
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=4DD22C87.4050206@comelit.it \
--to=luca.ceresoli@comelit.it \
--cc=u-boot@lists.denx.de \
/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