Commit 91713cc9 authored by Michael Quigley's avatar Michael Quigley
Browse files

Finish tests with larger number of messages and added extra asserts to ensure correctness.

parent b47f1d2f
......@@ -79,7 +79,6 @@ thc_ipc_recv(struct fipc_ring_channel *chnl,
}
else if( ret == -ENOMSG ) //message not for us
{
printk(KERN_ERR "yielding to\n");
THCYieldToIdAndSave((uint32_t)payload.actual_msg_id, (uint32_t) msg_id);
}
else if( ret == -EWOULDBLOCK ) //no message, Yield
......@@ -139,7 +138,6 @@ thc_poll_recv(struct thc_channel_group_item* item,
}
else if( ret == -ENOMSG ) //message not for us
{
printk(KERN_ERR "yielding to\n");
THCYieldToId((uint32_t)payload.actual_msg_id);
}
else if( ret == -EWOULDBLOCK ) //no message, return
......
......@@ -13,6 +13,34 @@
#define BATCH_INTERVAL 100
static struct fipc_ring_channel* channel;
static volatile int num_responses = 0;
static void check_response(unsigned long lhs,
unsigned long rhs,
unsigned long response,
int fn_type)
{
unsigned long result = 0;
switch( fn_type )
{
case ADD_2_FN:
result = lhs + rhs;
break;
case ADD_10_FN:
result = lhs + rhs + 10;
break;
default:
printk(KERN_ERR "invalid fn_type %d\n", fn_type);
BUG();
break;
}
if( response != result )
{
printk(KERN_ERR "response = %lu, result = %lu, fn_type = %d\n", response, result, fn_type);
BUG();
}
}
static unsigned long add_nums_async(unsigned long lhs, unsigned long rhs, unsigned long msg_id, int fn_type)
{
......@@ -31,7 +59,6 @@ static unsigned long add_nums_async(unsigned long lhs, unsigned long rhs, unsign
send_and_get_response(channel, msg, &response, msg_id);
fipc_recv_msg_end(channel, response);
result = fipc_get_reg0(response);
printk(KERN_ERR "result is %lu\n", result);
return result;
}
......@@ -39,47 +66,64 @@ static unsigned long add_nums_async(unsigned long lhs, unsigned long rhs, unsign
static int run_thread1(void* chan)
{
int num_transactions = 0;
volatile int num_transactions = 0;
int print_transactions_threshold = 0;
unsigned long msg_response = 0;
uint32_t id_num;
channel = chan;
num_responses = 0;
channel = chan;
thc_init();
DO_FINISH_(thread1_fn,{
while (num_transactions < TRANSACTIONS) {
printk(KERN_ERR "num_transactions: %d\n", num_transactions);
while ( num_transactions < TRANSACTIONS ) {
if( num_transactions >= print_transactions_threshold )
{
print_transactions_threshold += 300;
printk(KERN_ERR "num_transactions: %d\n", num_transactions);
}
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 1,(unsigned long) id_num, ADD_2_FN);
volatile int old_trans = num_transactions;
msg_response = add_nums_async(old_trans, 1,(unsigned long) id_num, ADD_2_FN);
check_response(old_trans, 1, msg_response, ADD_2_FN);
num_responses++;
);
if( (num_transactions) % THD3_INTERVAL == 0 )
{
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 2,(unsigned long) id_num, ADD_10_FN);
volatile int old_trans = num_transactions;
msg_response = add_nums_async(old_trans, 2,(unsigned long) id_num, ADD_10_FN);
check_response(old_trans, 2, msg_response, ADD_10_FN);
num_responses++;
);
}
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 3,(unsigned long) id_num, ADD_2_FN);
volatile int old_trans = num_transactions;
msg_response = add_nums_async(old_trans, 3,(unsigned long) id_num, ADD_2_FN);
check_response(old_trans, 3, msg_response, ADD_2_FN);
num_responses++;
);
msleep(10);
//msleep(1);
}
printk(KERN_ERR "done with transactions\n");
});
printk(KERN_ERR "lcd async exiting module and deleting ptstate");
printk(KERN_ERR "Expected number of responses %d, actual number of responses %d\n", num_transactions, num_responses);
thc_done();
if( num_responses != num_transactions )
{
printk(KERN_ERR "Invalid number of responses\n");
BUG();
}
return 1;
return 0;
}
......
......@@ -112,8 +112,8 @@ int thread2_fn(void* group)
rx_group = (struct thc_channel_group*)group;
thc_channel_group_item_get(rx_group, 0, &thrd1_item);
thrd1_item->dispatch_fn = thread1_dispatch_fn;
LCD_MAIN(thc_dispatch_loop_test(rx_group, TRANSACTIONS););
LCD_MAIN(thc_dispatch_loop_test(rx_group, TRANSACTIONS + TRANSACTIONS/THD3_INTERVAL););
thc_done();
return 1;
return 0;
}
......@@ -28,7 +28,6 @@ static int add_10_fn(struct fipc_ring_channel* chan, struct fipc_message* msg)
{
printk(KERN_ERR "Error getting send message for add_10_fn.\n");
}
printk(KERN_ERR "got to thread3\n");
fipc_set_reg0(out_msg, result);
THC_MSG_ID(out_msg) = msg_id;
set_fn_type(out_msg, ADD_10_FN);
......@@ -44,7 +43,6 @@ static int add_10_fn(struct fipc_ring_channel* chan, struct fipc_message* msg)
static int thread2_dispatch_fn(struct fipc_ring_channel* chan, struct fipc_message* msg)
{
printk(KERN_ERR "in thread 2 dispatch function with message %p\n", msg);
switch( get_fn_type(msg) )
{
case ADD_10_FN:
......@@ -65,5 +63,5 @@ int thread3_fn(void* group)
LCD_MAIN(thc_dispatch_loop_test(rx_group, TRANSACTIONS / THD3_INTERVAL););
thc_done();
return 1;
return 0;
}
......@@ -28,7 +28,6 @@ int send_and_get_response(
goto fail2;
}
*response = resp;
printk(KERN_ERR "got result\n");
return 0;
......
......@@ -5,8 +5,8 @@
#define ADD_2_FN 1
#define ADD_10_FN 2
#define TRANSACTIONS 60
#define THD3_INTERVAL 11
#define TRANSACTIONS 3000
#define THD3_INTERVAL 61
int thread1_fn(void* data);
int thread2_fn(void* data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment