diff --git a/arch/x86/scc/iRCCE_mailbox.c b/arch/x86/scc/iRCCE_mailbox.c index 4680a34d..8b14480a 100644 --- a/arch/x86/scc/iRCCE_mailbox.c +++ b/arch/x86/scc/iRCCE_mailbox.c @@ -33,6 +33,10 @@ #ifdef CONFIG_ROCKCREEK #include +// 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 @@ -316,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); } @@ -351,11 +355,11 @@ int iRCCE_mailbox_close(int rank) { if( rank == iRCCE_MAILBOX_ALL ) { int i; for( i=0; i