* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
@ 2007-03-06 5:33 Ed Swarthout
2007-03-06 15:56 ` Ben Warren
0 siblings, 1 reply; 13+ messages in thread
From: Ed Swarthout @ 2007-03-06 5:33 UTC (permalink / raw)
To: u-boot
Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
This permits the ping command to test the phy interface when the phy
is put in loopback mode (typically by setting register 0 bit 14).
It also allows the port to respond to an external ping when u-boot is
processing some other net command (such as tftp). This is useful when
tftp appears to hang.
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
net/net.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/net/net.c b/net/net.c
index 1d1c98f..3294380 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1424,6 +1424,30 @@ NetReceive(volatile uchar * inpkt, int len)
/* XXX point to ip packet */
(*packetHandler)((uchar *)ip, 0, 0, 0);
return;
+
+ case ICMP_ECHO_REQUEST:
+ {
+ int rlen = ETHER_HDR_SIZE + len;
+ int i;
+#ifdef ET_DEBUG
+ printf ("Got ICMP ECHO REQUEST, return %d bytes \n",rlen);
+#endif
+ memcpy (&et->et_dest[0], &et->et_src[0], 6);
+ memcpy (&et->et_src[ 0], NetOurEther, 6);
+
+ ip->ip_sum = 0;
+ ip->ip_off = 0;
+ NetCopyIP((void*)&ip->ip_dst, &ip->ip_src);
+ NetCopyIP((void*)&ip->ip_src, &NetOurIP);
+ ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP >> 1);
+
+ icmph->type = ICMP_ECHO_REPLY;
+ icmph->checksum = 0;
+ icmph->checksum = ~NetCksum((uchar *)icmph,
+ (len - IP_HDR_SIZE_NO_UDP) >> 1);
+ (void) eth_send((uchar *)et, rlen);
+ return;
+ }
#endif
default:
return;
--
1.5.0.2.279.g4808
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
@ 2007-03-06 7:20 Ed Swarthout
0 siblings, 0 replies; 13+ messages in thread
From: Ed Swarthout @ 2007-03-06 7:20 UTC (permalink / raw)
To: u-boot
Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
This permits the ping command to test the phy interface when the phy
is put in loopback mode (typically by setting register 0 bit 14).
It also allows the port to respond to an external ping when u-boot is
processing some other net command (such as tftp). This is useful when
tftp appears to hang.
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
This version does not add unused variable i.
net/net.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/net/net.c b/net/net.c
index 1d1c98f..2df52dc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1424,6 +1424,29 @@ NetReceive(volatile uchar * inpkt, int len)
/* XXX point to ip packet */
(*packetHandler)((uchar *)ip, 0, 0, 0);
return;
+
+ case ICMP_ECHO_REQUEST:
+ {
+ int rlen = ETHER_HDR_SIZE + len;
+#ifdef ET_DEBUG
+ printf ("Got ICMP ECHO REQUEST, return %d bytes \n",rlen);
+#endif
+ memcpy (&et->et_dest[0], &et->et_src[0], 6);
+ memcpy (&et->et_src[ 0], NetOurEther, 6);
+
+ ip->ip_sum = 0;
+ ip->ip_off = 0;
+ NetCopyIP((void*)&ip->ip_dst, &ip->ip_src);
+ NetCopyIP((void*)&ip->ip_src, &NetOurIP);
+ ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP >> 1);
+
+ icmph->type = ICMP_ECHO_REPLY;
+ icmph->checksum = 0;
+ icmph->checksum = ~NetCksum((uchar *)icmph,
+ (len - IP_HDR_SIZE_NO_UDP) >> 1);
+ (void) eth_send((uchar *)et, rlen);
+ return;
+ }
#endif
default:
return;
--
1.5.0.2.279.g4808
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-06 5:33 [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
@ 2007-03-06 15:56 ` Ben Warren
2007-03-06 17:59 ` [U-Boot-Users] HUSH shell in u-boot Leonid
2007-03-07 6:12 ` [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
0 siblings, 2 replies; 13+ messages in thread
From: Ben Warren @ 2007-03-06 15:56 UTC (permalink / raw)
To: u-boot
Ed,
This looks like a useful debug tool. Please fix a little nit. In the
meantime I'm going to play around with it a bit.
On Mon, 2007-03-05 at 23:33 -0600, Ed Swarthout wrote:
<SNIP>
> +
> + case ICMP_ECHO_REQUEST:
> + {
> + int rlen = ETHER_HDR_SIZE + len;
> + int i;
These variables aren't necessary. 'i' isn't even used. Please ditch
them along with the braces. You can calcalate the length in the two
places that it's referenced.
regards,
Ben
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] HUSH shell in u-boot.
2007-03-06 15:56 ` Ben Warren
@ 2007-03-06 17:59 ` Leonid
2007-03-06 21:40 ` Wolfgang Denk
2007-03-07 6:12 ` [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
1 sibling, 1 reply; 13+ messages in thread
From: Leonid @ 2007-03-06 17:59 UTC (permalink / raw)
To: u-boot
Hi:
I'm using HUSH shell in u-boot, it's very convenient - has for, if,
etc... constructions. Unfortunately DULG doesn't say much about it, so
couple questions:
1) Does any HUSH guide exist? At the very least where one can get list
of supported commands except of empirically trying them?
2) For several different reasons I'm using 1.1.4 version of u-boot, but
I am considering move to the latest 1.2.0. Is HUSH support much better
there?
3) u-boot CLI (even in HUSH mode) doesn't support command history. I
understand that there are good reasons for that (some terminals may not
interpret arrow key properly) but if I want to use history, is it just a
matter of enabling some configuration or the code just doesn't exist?
4) Regarding previous question, will be answer the same for 1.1.4 and
1.2.0 versions?
Thanks,
Leonid.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] HUSH shell in u-boot.
2007-03-06 17:59 ` [U-Boot-Users] HUSH shell in u-boot Leonid
@ 2007-03-06 21:40 ` Wolfgang Denk
2007-03-07 10:07 ` [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING Sam Song
0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2007-03-06 21:40 UTC (permalink / raw)
To: u-boot
In message <406A31B117F2734987636D6CCC93EE3CB058D9@ehost011-3.exch011.intermedia.net> you wrote:
>
> 1) Does any HUSH guide exist? At the very least where one can get list
> of supported commands except of empirically trying them?
We borrowed the code from the BusyBox project. You may look there for
more documentation. Please let me know if you find any :-(
> 2) For several different reasons I'm using 1.1.4 version of u-boot, but
> I am considering move to the latest 1.2.0. Is HUSH support much better
> there?
No, changes to the hush code were only minimal.
> 3) u-boot CLI (even in HUSH mode) doesn't support command history. I
Yes, it does. You have to enable it in the configuration, though.
> understand that there are good reasons for that (some terminals may not
> interpret arrow key properly) but if I want to use history, is it just a
> matter of enabling some configuration or the code just doesn't exist?
History and command line editing are config options.
> 4) Regarding previous question, will be answer the same for 1.1.4 and
> 1.2.0 versions?
No. I'm talking about recent code only.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I don't know if it's what you want, but it's what you get. :-)
- Larry Wall in <10502@jpl-devvax.JPL.NASA.GOV>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-06 15:56 ` Ben Warren
2007-03-06 17:59 ` [U-Boot-Users] HUSH shell in u-boot Leonid
@ 2007-03-07 6:12 ` Ed Swarthout
2007-03-07 14:51 ` Ben Warren
1 sibling, 1 reply; 13+ messages in thread
From: Ed Swarthout @ 2007-03-07 6:12 UTC (permalink / raw)
To: u-boot
Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
This permits the ping command to test the phy interface when the phy
is put in loopback mode (typically by setting register 0 bit 14).
It also allows the port to respond to an external ping when u-boot is
processing some other net command (such as tftp). This is useful when
tftp appears to hang.
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
Version 2. Style fixes - remove temp variable and braces.
net/net.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/net/net.c b/net/net.c
index 1d1c98f..63d090f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1424,6 +1424,26 @@ NetReceive(volatile uchar * inpkt, int len)
/* XXX point to ip packet */
(*packetHandler)((uchar *)ip, 0, 0, 0);
return;
+ case ICMP_ECHO_REQUEST:
+#ifdef ET_DEBUG
+ printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
+ ETHER_HDR_SIZE + len);
+#endif
+ memcpy (&et->et_dest[0], &et->et_src[0], 6);
+ memcpy (&et->et_src[ 0], NetOurEther, 6);
+
+ ip->ip_sum = 0;
+ ip->ip_off = 0;
+ NetCopyIP((void*)&ip->ip_dst, &ip->ip_src);
+ NetCopyIP((void*)&ip->ip_src, &NetOurIP);
+ ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP >> 1);
+
+ icmph->type = ICMP_ECHO_REPLY;
+ icmph->checksum = 0;
+ icmph->checksum = ~NetCksum((uchar *)icmph,
+ (len - IP_HDR_SIZE_NO_UDP) >> 1);
+ (void) eth_send((uchar *)et, ETHER_HDR_SIZE + len);
+ return;
#endif
default:
return;
--
1.5.0.2.279.g4808
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING
2007-03-06 21:40 ` Wolfgang Denk
@ 2007-03-07 10:07 ` Sam Song
2007-03-08 4:55 ` Swarthout Edward L-SWARTHOU
0 siblings, 1 reply; 13+ messages in thread
From: Sam Song @ 2007-03-07 10:07 UTC (permalink / raw)
To: u-boot
Wolfgang Denk <wd@denx.de> wrote:
> > 3) u-boot CLI (even in HUSH mode) doesn't support command history.
>
> Yes, it does. You have to enable it in the configuration, though.
It's realy a nice feature for debug. I just tried that for u-boot
1.1.6 and it worked fine. Enable CONFIG_CMDLINE_EDITING.
> History and command line editing are config options.
Hopefully, it will be an default config options for all developers
for it make work/life easier.
Thanks for releaving this option:-)
Sam
Best regards,
Sam
___________________________________________________________
????????-3.5G???20M???
http://cn.mail.yahoo.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-07 6:12 ` [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
@ 2007-03-07 14:51 ` Ben Warren
2007-03-07 15:09 ` Wolfgang Denk
2007-03-07 18:14 ` Ed Swarthout
0 siblings, 2 replies; 13+ messages in thread
From: Ben Warren @ 2007-03-07 14:51 UTC (permalink / raw)
To: u-boot
Ed,
On Wed, 2007-03-07 at 00:12 -0600, Ed Swarthout wrote:
> Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
>
> This permits the ping command to test the phy interface when the phy
> is put in loopback mode (typically by setting register 0 bit 14).
>
> It also allows the port to respond to an external ping when u-boot is
> processing some other net command (such as tftp). This is useful when
> tftp appears to hang.
>
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
Sorry for being a pain, but this patch doesn't apply cleanly, due to
whitespace issues. Please make sure you're using tabs for indentation
with TABSTOP=8. When I modified your patch to do this, it went in fine,
but I want it to come from you so all history is maintained.
regards,
Ben
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-07 14:51 ` Ben Warren
@ 2007-03-07 15:09 ` Wolfgang Denk
2007-03-07 18:14 ` Ed Swarthout
1 sibling, 0 replies; 13+ messages in thread
From: Wolfgang Denk @ 2007-03-07 15:09 UTC (permalink / raw)
To: u-boot
In message <1173279099.24846.135.camel@saruman.qstreams.net> you wrote:
>
> Sorry for being a pain, but this patch doesn't apply cleanly, due to
You're not a pain, but a highly appreciated Custodian at Work :-)
Thanks!
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Without freedom of choice there is no creativity.
-- Kirk, "The return of the Archons", stardate 3157.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-07 14:51 ` Ben Warren
2007-03-07 15:09 ` Wolfgang Denk
@ 2007-03-07 18:14 ` Ed Swarthout
2007-03-07 18:31 ` Ben Warren
1 sibling, 1 reply; 13+ messages in thread
From: Ed Swarthout @ 2007-03-07 18:14 UTC (permalink / raw)
To: u-boot
Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
This permits the ping command to test the phy interface when the phy
is put in loopback mode (typically by setting register 0 bit 14).
It also allows the port to respond to an external ping when u-boot is
processing some other net command (such as tftp). This is useful when
tftp appears to hang.
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
Version 3. Whitespace cleanup of patch.
Removed spaces used for indentation of descendant line.
80-char line-length is still violated (like other parts of file).
If I run Lident on the file, I get 67 changes and it still uses spaces
to indent descendant lines. Should I send that version instead?
Pain leads to strength...
net/net.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/net/net.c b/net/net.c
index 1d1c98f..2ff7bfc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1424,6 +1424,26 @@ NetReceive(volatile uchar * inpkt, int len)
/* XXX point to ip packet */
(*packetHandler)((uchar *)ip, 0, 0, 0);
return;
+ case ICMP_ECHO_REQUEST:
+#ifdef ET_DEBUG
+ printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
+ ETHER_HDR_SIZE + len);
+#endif
+ memcpy (&et->et_dest[0], &et->et_src[0], 6);
+ memcpy (&et->et_src[ 0], NetOurEther, 6);
+
+ ip->ip_sum = 0;
+ ip->ip_off = 0;
+ NetCopyIP((void*)&ip->ip_dst, &ip->ip_src);
+ NetCopyIP((void*)&ip->ip_src, &NetOurIP);
+ ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP >> 1);
+
+ icmph->type = ICMP_ECHO_REPLY;
+ icmph->checksum = 0;
+ icmph->checksum = ~NetCksum((uchar *)icmph,
+ (len - IP_HDR_SIZE_NO_UDP) >> 1);
+ (void) eth_send((uchar *)et, ETHER_HDR_SIZE + len);
+ return;
#endif
default:
return;
--
1.5.0.2.279.g4808
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop
2007-03-07 18:14 ` Ed Swarthout
@ 2007-03-07 18:31 ` Ben Warren
0 siblings, 0 replies; 13+ messages in thread
From: Ben Warren @ 2007-03-07 18:31 UTC (permalink / raw)
To: u-boot
Ed,
On Wed, 2007-03-07 at 12:14 -0600, Ed Swarthout wrote:
> Add ICMP_ECHO_REQUEST packet support by responding with a ICMP_ECHO_REPLY.
>
> This permits the ping command to test the phy interface when the phy
> is put in loopback mode (typically by setting register 0 bit 14).
>
> It also allows the port to respond to an external ping when u-boot is
> processing some other net command (such as tftp). This is useful when
> tftp appears to hang.
>
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
>
> ---
>
> Version 3. Whitespace cleanup of patch.
>
> Removed spaces used for indentation of descendant line.
> 80-char line-length is still violated (like other parts of file).
>
> If I run Lident on the file, I get 67 changes and it still uses spaces
> to indent descendant lines. Should I send that version instead?
>
> Pain leads to strength...
This one's fine. Thanks!
Ben
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING
2007-03-07 10:07 ` [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING Sam Song
@ 2007-03-08 4:55 ` Swarthout Edward L-SWARTHOU
2007-03-08 14:44 ` Sam Song
0 siblings, 1 reply; 13+ messages in thread
From: Swarthout Edward L-SWARTHOU @ 2007-03-08 4:55 UTC (permalink / raw)
To: u-boot
> From: Sam Song
>
> Wolfgang Denk <wd@denx.de> wrote:
> > History and command line editing are config options.
>
> Hopefully, it will be an default config options for all
> developers for it make work/life easier.
Running the u-boot serial console in an emacs shell provides
many more usability features. Two examples include unlimited
command recall that works across reset and a huge console scroll
buffer.
-EdS
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING
2007-03-08 4:55 ` Swarthout Edward L-SWARTHOU
@ 2007-03-08 14:44 ` Sam Song
0 siblings, 0 replies; 13+ messages in thread
From: Sam Song @ 2007-03-08 14:44 UTC (permalink / raw)
To: u-boot
Swarthout Edward L-SWARTHOU <ed.swarthout@freescale.com> wrote:
> Running the u-boot serial console in an emacs shell provides
> many more usability features. Two examples include unlimited
> command recall that works across reset and a huge console scroll
> buffer.
Thanks for pointing to emacs shell... A nice new thing to me:-)
Mostly I perfer to stay on bash shell for enough satisfaction.
Sam
Best regards,
Sam
___________________________________________________________
Mp3???-???????
http://music.yahoo.com.cn/?source=mail_mailbox_footer
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-03-08 14:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 5:33 [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
2007-03-06 15:56 ` Ben Warren
2007-03-06 17:59 ` [U-Boot-Users] HUSH shell in u-boot Leonid
2007-03-06 21:40 ` Wolfgang Denk
2007-03-07 10:07 ` [U-Boot-Users] HUSH shell in u-boot.- CONFIG_CMDLINE_EDITING Sam Song
2007-03-08 4:55 ` Swarthout Edward L-SWARTHOU
2007-03-08 14:44 ` Sam Song
2007-03-07 6:12 ` [U-Boot-Users] [PATCH] net - Support ping reply when processing net-loop Ed Swarthout
2007-03-07 14:51 ` Ben Warren
2007-03-07 15:09 ` Wolfgang Denk
2007-03-07 18:14 ` Ed Swarthout
2007-03-07 18:31 ` Ben Warren
-- strict thread matches above, loose matches on Subject: below --
2007-03-06 7:20 Ed Swarthout
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox