Skip to content

Commit

Permalink
Reduced stack sizes of IDLE, LOAD and TMAIN threads as well as NUM_LO…
Browse files Browse the repository at this point in the history
…AD_THREADS to 5 (was 10) in order to fit the test for targets with as low as 128KiB RAM. Bug fix: MAX_BUF fixed so that in_buf[] and out_buf[] can accomodate up to messages of up to 10KiB used by some tests.[ Bugzilla 1001344 ]
  • Loading branch information
vae committed May 27, 2012
1 parent 208987a commit 94d777e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
9 changes: 9 additions & 0 deletions packages/net/lwip_tcpip/current/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2012-05-26 Ilija Kocho <[email protected]>

* tests/nc_test_slave.c: Reduced stack sizes of IDLE, LOAD and TMAIN
threads as well as NUM_LOAD_THREADS to 5 (was 10) in order to fit the
test for targets with as low as 128KiB RAM.
Bug fix: MAX_BUF fixed so that in_buf[] and out_buf[] can accomodate
10KiB messages.
[ Bugzilla 1001344 ]

2012-03-06 Ilija Kocho <[email protected]>

* src/core/tcp_out.c: Fix compiler warning about unused variables.
Expand Down
31 changes: 16 additions & 15 deletions packages/net/lwip_tcpip/current/tests/nc_test_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
#include "nc_test_framework.h"


#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000)
#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_MINIMUM + \
4*CYGNUM_HAL_STACK_FRAME_SIZE)
#define MAX_LOAD_THREAD_LEVEL 20
#define MIN_LOAD_THREAD_LEVEL 0
#define NUM_LOAD_THREADS 10
Expand Down Expand Up @@ -90,7 +91,7 @@ static void do_some_random_computation(int p);
extern void show_net_times(void);
#endif

#define MAX_BUF 8192
#define MAX_BUF (sizeof(struct nc_test_data)+10240)
static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF];

extern void
Expand Down Expand Up @@ -186,13 +187,13 @@ do_udp_test(int s1, struct nc_request *req, struct sockaddr_in *master)
if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) &&
(ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) {
if (ntohl(tdp->seq) != seq) {
test_printf("Packets out of sequence - recvd: %lu, expected: %d\n",
test_printf("Packets out of sequence - recvd: %u, expected: %d\n",
ntohl(tdp->seq), seq);
seq = ntohl(tdp->seq);
seq_errors++;
}
} else {
test_printf("Bad data packet - key: %lx/%lx, seq: %lu\n",
test_printf("Bad data packet - key: %x/%x, seq: %u\n",
ntohl(tdp->key1), ntohl(tdp->key2),
ntohl(tdp->seq));
}
Expand Down Expand Up @@ -362,13 +363,13 @@ do_tcp_test(int s1, struct nc_request *req, struct sockaddr_in *master)
if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) &&
(ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) {
if (ntohl(tdp->seq) != seq) {
test_printf("Packets out of sequence - recvd: %lu, expected: %d\n",
test_printf("Packets out of sequence - recvd: %u, expected: %d\n",
ntohl(tdp->seq), seq);
seq = ntohl(tdp->seq);
seq_errors++;
}
} else {
test_printf("Bad data packet - key: %lx/%lx, seq: %lu\n",
test_printf("Bad data packet - key: %x/%x, seq: %u\n",
ntohl(tdp->key1), ntohl(tdp->key2),
ntohl(tdp->seq));
}
Expand Down Expand Up @@ -446,7 +447,7 @@ nc_slave(test_param_t param)
if (recvfrom(s, &req, sizeof(req), 0, (struct sockaddr *)&master, &masterlen) < 0) {
pexit("recvfrom");
}
test_printf("Request %lu from %s:%d\n", ntohl(req.type),
test_printf("Request %u from %s:%d\n", ntohl(req.type),
inet_ntoa(master.sin_addr), ntohs(master.sin_port));
reply.response = htonl(NC_REPLY_ACK);
reply.seq = req.seq;
Expand All @@ -455,22 +456,22 @@ nc_slave(test_param_t param)
done = true;
break;
case NC_REQUEST_UDP_SEND:
test_printf("UDP send - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("UDP send - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_UDP_RECV:
test_printf("UDP recv - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("UDP recv - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_UDP_ECHO:
test_printf("UDP echo - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("UDP echo - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_TCP_SEND:
test_printf("TCP send - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("TCP send - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_TCP_RECV:
test_printf("TCP recv - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("TCP recv - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_TCP_ECHO:
test_printf("TCP echo - %lu buffers, %lu bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
test_printf("TCP echo - %u buffers, %u bytes\n", ntohl(req.nbufs), ntohl(req.buflen));
break;
case NC_REQUEST_SET_LOAD:
start_load(ntohl(req.nbufs));
Expand All @@ -490,7 +491,7 @@ nc_slave(test_param_t param)
reply.misc.idle_results.count[1] = htonl((long)idle_thread_count);
break;
default:
test_printf("Unrecognized request: %lu\n", ntohl(req.type));
test_printf("Unrecognized request: %u\n", ntohl(req.type));
reply.response = htonl(NC_REPLY_NAK);
reply.reason = htonl(NC_REPLY_NAK_UNKNOWN_REQUEST);
break;
Expand Down Expand Up @@ -678,7 +679,7 @@ static void
do_some_random_computation(int p)
{
// Just something that might be "hard"
volatile double x;
volatile double x CYGBLD_ATTRIB_UNUSED;
x = ((p * 10) * 3.14159) / 180.0; // radians
}

Expand Down

0 comments on commit 94d777e

Please sign in to comment.