Merge branch 'mailbox_integration' of git.lfbs.rwth-aachen.de:metalsvm into mailbox_integration

This commit is contained in:
Simon Pickartz 2011-06-06 23:30:44 -07:00
commit 02037f6ba5
4 changed files with 33 additions and 8 deletions

View file

@ -134,6 +134,7 @@ typedef struct _iRCCE_MAIL_TRASH_BIN {
//
// Initialize/Finalize functions:
int iRCCE_init(void);
int iRCCE_finalize(void);
//
// Non-blocking send/recv functions:
int iRCCE_isend(char *, ssize_t, int, iRCCE_SEND_REQUEST *);

View file

@ -109,4 +109,23 @@ int iRCCE_init(void) {
return (iRCCE_SUCCESS);
}
//--------------------------------------------------------------------------------------
// FUNCTION: iRCCE_finalize
//--------------------------------------------------------------------------------------
// finalize the library
//--------------------------------------------------------------------------------------
int iRCCE_finalize(void) {
// empty iRCCE_mail_garbage
iRCCE_MAIL_HEADER* run;
iRCCE_MAIL_HEADER* erase_header;
for( run = iRCCE_mail_garbage.first; run != NULL; ) {
erase_header = run;
run = run->next;
kfree( erase_header, sizeof(iRCCE_MAIL_HEADER) );
}
iRCCE_mail_garbage.first = iRCCE_mail_garbage.last = NULL;
return iRCCE_SUCCESS;
}
#endif

View file

@ -33,6 +33,10 @@
#ifdef CONFIG_ROCKCREEK
#include <asm/iRCCE_lib.h>
// forward declaration
static int iRCCE_mailbox_close_one(int rank, int check);
//------------------------------------------------------------------------------
// FUNCTION: iRCCE_mailbox_print_header
//------------------------------------------------------------------------------
@ -90,8 +94,8 @@ static int iRCCE_mail_fetch(
// check if received a last-mail
if( header->tag == iRCCE_LAST_MAIL ) {
iRCCE_last_mail[rank] = 1;
iRCCE_mailbox_close( rank ); // we can close respective mailbox
kfree( header, sizeof(iRCCE_MAIL_HEADER) );
iRCCE_mailbox_close_one( rank, 0 ); // we can close respective mailbox
iRCCE_mail_release( &header );
}
else {
// check mail priority
@ -119,8 +123,7 @@ static int iRCCE_mail_fetch(
// routine to check for new mail in mailboxes
//------------------------------------------------------------------------------
static int iRCCE_mailbox_check() {
int i, j;
int tmp;
int i;
for( i=0; i<RCCE_NP; ++i ) {
// only check open mailboxes
@ -317,12 +320,12 @@ int iRCCE_mailbox_flush(void) {
//------------------------------------------------------------------------------
// routine to close one mailbox
//------------------------------------------------------------------------------
static int iRCCE_mailbox_close_one(int rank) {
static int iRCCE_mailbox_close_one(int rank, int check) {
RCCE_acquire_lock( RCCE_IAM );
// check if it contains new mail
RC_cache_invalidate();
if( iRCCE_mailbox_recv[rank]->sent ) {
if( check && iRCCE_mailbox_recv[rank]->sent ) {
iRCCE_mail_fetch(rank);
}
@ -352,11 +355,11 @@ int iRCCE_mailbox_close(int rank) {
if( rank == iRCCE_MAILBOX_ALL ) {
int i;
for( i=0; i<RCCE_NP; ++i ) {
iRCCE_mailbox_close_one( i );
iRCCE_mailbox_close_one( i, 1 );
}
}
else {
iRCCE_mailbox_close_one( rank );
iRCCE_mailbox_close_one( rank, 1 );
}
return iRCCE_SUCCESS;

View file

@ -190,6 +190,8 @@ int icc_halt(void)
irq_nested_enable(flags);
} while(do_send);
iRCCE_finalize();
HALT;
return 0;