public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10
@ 2010-11-26 18:17 Stefan Roese
  2010-11-26 18:32 ` Wolfgang Denk
  2010-12-17  8:46 ` Stefan Roese
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2010-11-26 18:17 UTC (permalink / raw)
  To: u-boot

This patch changes the PPC4xx ethernet POST loop test count from
currently 192 (256 - 64) to a default of 10. While doing this the max
frame size is increased. Each loop run uses a different frame size,
starting with a max of 1514 bytes, down to 64. The default loop
count of 10 can be overriden using CONFIG_SYS_POST_ETH_LOOPS in the
board config header.

The TEST_NUM loop has been removed as it was never used.

The main reason for this change is to reduce the boot time on boards
using this POST test, like the lwmon5 board. This change reduces the
boot time by about 600ms on the lwmon5 board.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
---
Wolfgang, I changed the loop to start with the max frame size (so that
this value is really used) and decrease the size to the min value. Testing
on lwmon5 showed that 1514 is the biggest value for this test to pass.

Let me know if you ack this patch version and I'll queue it for
next in my ppc4xx repository.

Thanks.

 post/cpu/ppc4xx/ether.c |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/post/cpu/ppc4xx/ether.c b/post/cpu/ppc4xx/ether.c
index 7f44f38..c508670 100644
--- a/post/cpu/ppc4xx/ether.c
+++ b/post/cpu/ppc4xx/ether.c
@@ -34,7 +34,10 @@
  * are transmitted. The configurable test parameters are:
  *   MIN_PACKET_LENGTH - minimum size of packet to transmit
  *   MAX_PACKET_LENGTH - maximum size of packet to transmit
- *   TEST_NUM - number of tests
+ *   CONFIG_SYS_POST_ETH_LOOPS - Number of test loops. Each loop
+ *     is tested with a different frame length. Starting with
+ *     MAX_PACKET_LENGTH and going down to MIN_PACKET_LENGTH.
+ *     Defaults to 10 and can be overriden in the board config header.
  */
 
 #include <post.h>
@@ -77,8 +80,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #define MIN_PACKET_LENGTH	64
-#define MAX_PACKET_LENGTH	256
-#define TEST_NUM		1
+#define MAX_PACKET_LENGTH	1514
+#ifndef CONFIG_SYS_POST_ETH_LOOPS
+#define CONFIG_SYS_POST_ETH_LOOPS	10
+#endif
+#define PACKET_INCR	((MAX_PACKET_LENGTH - MIN_PACKET_LENGTH) / \
+			 CONFIG_SYS_POST_ETH_LOOPS)
 
 static volatile mal_desc_t tx __cacheline_aligned;
 static volatile mal_desc_t rx __cacheline_aligned;
@@ -361,29 +368,27 @@ static int packet_check (char *packet, int length)
 	return 0;
 }
 
+	char packet_send[MAX_PACKET_LENGTH];
+	char packet_recv[MAX_PACKET_LENGTH];
 static int test_ctlr (int devnum, int hw_addr)
 {
 	int res = -1;
-	char packet_send[MAX_PACKET_LENGTH];
-	char packet_recv[MAX_PACKET_LENGTH];
 	int length;
-	int i;
 	int l;
 
 	ether_post_init (devnum, hw_addr);
 
-	for (i = 0; i < TEST_NUM; i++) {
-		for (l = MIN_PACKET_LENGTH; l <= MAX_PACKET_LENGTH; l++) {
-			packet_fill (packet_send, l);
+	for (l = MAX_PACKET_LENGTH; l >= MIN_PACKET_LENGTH;
+	     l -= PACKET_INCR) {
+		packet_fill (packet_send, l);
 
-			ether_post_send (devnum, hw_addr, packet_send, l);
+		ether_post_send (devnum, hw_addr, packet_send, l);
 
-			length = ether_post_recv (devnum, hw_addr, packet_recv,
-						  sizeof (packet_recv));
+		length = ether_post_recv (devnum, hw_addr, packet_recv,
+					  sizeof (packet_recv));
 
-			if (length != l || packet_check (packet_recv, length) < 0) {
-				goto Done;
-			}
+		if (length != l || packet_check (packet_recv, length) < 0) {
+			goto Done;
 		}
 	}
 
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10
  2010-11-26 18:17 [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10 Stefan Roese
@ 2010-11-26 18:32 ` Wolfgang Denk
  2010-12-17  8:46 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2010-11-26 18:32 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

In message <1290795460-7097-1-git-send-email-sr@denx.de> you wrote:
> This patch changes the PPC4xx ethernet POST loop test count from
> currently 192 (256 - 64) to a default of 10. While doing this the max
> frame size is increased. Each loop run uses a different frame size,
> starting with a max of 1514 bytes, down to 64. The default loop
> count of 10 can be overriden using CONFIG_SYS_POST_ETH_LOOPS in the
> board config header.
> 
> The TEST_NUM loop has been removed as it was never used.
> 
> The main reason for this change is to reduce the boot time on boards
> using this POST test, like the lwmon5 board. This change reduces the
> boot time by about 600ms on the lwmon5 board.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> Wolfgang, I changed the loop to start with the max frame size (so that
> this value is really used) and decrease the size to the min value. Testing
> on lwmon5 showed that 1514 is the biggest value for this test to pass.
> 
> Let me know if you ack this patch version and I'll queue it for
> next in my ppc4xx repository.
> 
> Thanks.
> 
>  post/cpu/ppc4xx/ether.c |   35 ++++++++++++++++++++---------------
>  1 files changed, 20 insertions(+), 15 deletions(-)

Acked-by: Wolfgang Denk <wd@denx.de>

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a woman marries again it is because she detested her first  hus-
band.  When  a  man  marries again, it is because he adored his first
wife.                                                  -- Oscar Wilde

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10
  2010-11-26 18:17 [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10 Stefan Roese
  2010-11-26 18:32 ` Wolfgang Denk
@ 2010-12-17  8:46 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2010-12-17  8:46 UTC (permalink / raw)
  To: u-boot

On Friday 26 November 2010 19:17:40 Stefan Roese wrote:
> This patch changes the PPC4xx ethernet POST loop test count from
> currently 192 (256 - 64) to a default of 10. While doing this the max
> frame size is increased. Each loop run uses a different frame size,
> starting with a max of 1514 bytes, down to 64. The default loop
> count of 10 can be overriden using CONFIG_SYS_POST_ETH_LOOPS in the
> board config header.
> 
> The TEST_NUM loop has been removed as it was never used.
> 
> The main reason for this change is to reduce the boot time on boards
> using this POST test, like the lwmon5 board. This change reduces the
> boot time by about 600ms on the lwmon5 board.

Applied to u-boot-ppc4xx/next. Thanks.
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-17  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-26 18:17 [U-Boot] [PATCH] ppc4xx/POST: Change ethernet test loop count to a default of 10 Stefan Roese
2010-11-26 18:32 ` Wolfgang Denk
2010-12-17  8:46 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox