merge
This commit is contained in:
commit
736d221022
4 changed files with 64 additions and 19 deletions
|
@ -40,19 +40,22 @@
|
|||
#define iRCCE_ANY_SOURCE -1
|
||||
|
||||
#define iRCCE_PRIOS 5
|
||||
#define iRCCE_MAILBOX_EMPTY -2
|
||||
#define iRCCE_LAST_MAILS_NOT_RECV -3
|
||||
#define iRCCE_MAILBOX_ALL -4
|
||||
#define iRCCE_MAILBOX_OPEN 0
|
||||
#define iRCCE_MAILBOX_CLOSED 1
|
||||
#define iRCCE_MAILBOX_INVALID -1
|
||||
|
||||
// status codes
|
||||
#define iRCCE_ERROR_ID RCCE_ERROR_ID
|
||||
#define iRCCE_MAILBOX_OPEN -1
|
||||
#define iRCCE_MAILBOX_CLOSED -2
|
||||
#define iRCCE_MAILBOX_INVALID -3
|
||||
#define iRCCE_MAILBOX_EMPTY -4
|
||||
#define iRCCE_LAST_MAILS_NOT_RECV -5
|
||||
|
||||
// iRCCE-mailbox-system tags
|
||||
#define iRCCE_LAST_MAIL -1
|
||||
#define iRCCE_LAST_MAIL -1
|
||||
#define iRCCE_ANYLENGTH -2
|
||||
#define iRCCE_ANYLENGTH_PIGGYBACK -3
|
||||
|
||||
|
||||
typedef volatile char iRCCE_SHORT_FLAG;
|
||||
|
||||
typedef struct _iRCCE_SEND_REQUEST {
|
||||
|
@ -182,7 +185,8 @@ int iRCCE_irecv_cancel(iRCCE_RECV_REQUEST *, int *);
|
|||
int iRCCE_mail_send(size_t, int, char, char*, int);
|
||||
int iRCCE_mail_recv(iRCCE_MAIL_HEADER**);
|
||||
//
|
||||
// functions to empty mailbox-queue and to check for last mails:
|
||||
// functions to empty mailbox-queue and to check for mails:
|
||||
int iRCCE_mail_check(int);
|
||||
int iRCCE_mail_release(iRCCE_MAIL_HEADER**);
|
||||
int iRCCE_last_mail_recv(void);
|
||||
int iRCCE_mailbox_wait(void);
|
||||
|
|
|
@ -46,6 +46,7 @@ extern iRCCE_SHORT_FLAG iRCCE_mailbox_status[RCCE_MAXNP];
|
|||
|
||||
// garbage collection for mailbox
|
||||
extern iRCCE_MAIL_HEADER_LIST iRCCE_mail_garbage;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp threadprivate (iRCCE_isend_queue, iRCCE_irecv_queue)
|
||||
#endif
|
||||
|
|
|
@ -66,8 +66,6 @@ iRCCE_SHORT_FLAG iRCCE_last_mail[RCCE_MAXNP];
|
|||
// field to store open/closed status of mailboxes
|
||||
iRCCE_SHORT_FLAG iRCCE_mailbox_status[RCCE_MAXNP];
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// FUNCTION: iRCCE_init
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -105,6 +103,7 @@ int iRCCE_init(void) {
|
|||
iRCCE_mailbox_recv_queue[i].first = NULL;
|
||||
iRCCE_mailbox_recv_queue[i].last = NULL;
|
||||
}
|
||||
|
||||
// allocate space in MPB for mailbox and set senders mailbox-pointer
|
||||
for( i=0; i<RCCE_NP; i++ ) {
|
||||
iRCCE_mailbox_recv[i] = (iRCCE_MAIL_HEADER*)RCCE_malloc(RCCE_LINE_SIZE);
|
||||
|
@ -129,6 +128,8 @@ int iRCCE_finalize(void) {
|
|||
iRCCE_MAIL_HEADER* run;
|
||||
iRCCE_MAIL_HEADER* erase_header;
|
||||
|
||||
iRCCE_mailbox_flush();
|
||||
|
||||
for( run = iRCCE_mail_garbage.first; run != NULL; ) {
|
||||
erase_header = run;
|
||||
run = run->next;
|
||||
|
@ -136,6 +137,7 @@ int iRCCE_finalize(void) {
|
|||
}
|
||||
|
||||
iRCCE_mail_garbage.first = iRCCE_mail_garbage.last = NULL;
|
||||
|
||||
return iRCCE_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
#include <asm/irqflags.h>
|
||||
|
||||
// forward declaration
|
||||
static int iRCCE_mailbox_close_one(int rank, int check);
|
||||
|
||||
int iRCCE_mailbox_close_one(int rank, int check);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FUNCTION: iRCCE_mailbox_print_header
|
||||
|
@ -112,7 +111,7 @@ static int iRCCE_mail_fetch(
|
|||
|
||||
|
||||
// copy header to allocated memory
|
||||
RC_cache_invalidate();
|
||||
//RC_cache_invalidate();
|
||||
iRCCE_memcpy_get( (void*)header, (void*)iRCCE_mailbox_recv[rank],
|
||||
RCCE_LINE_SIZE );
|
||||
|
||||
|
@ -160,6 +159,9 @@ static int iRCCE_mail_fetch(
|
|||
* write out the data.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
iRCCE_MAIL_HEADER dummy_header = {0, 0, 0, NULL, 0, 0, 0, {[0 ... iRCCE_MAIL_HEADER_PAYLOAD-1] = 0} };
|
||||
|
||||
|
||||
static int iRCCE_mailbox_check() {
|
||||
int i,j;
|
||||
uint32_t flags;
|
||||
|
@ -170,8 +172,6 @@ static int iRCCE_mailbox_check() {
|
|||
for( j=1; j<RCCE_NP; ++j ) {
|
||||
i = (j+RCCE_IAM)%RCCE_NP;
|
||||
|
||||
if( i == RCCE_IAM ) continue;
|
||||
|
||||
// only check open mailboxes
|
||||
if( iRCCE_mailbox_status[i] == iRCCE_MAILBOX_OPEN ) {
|
||||
|
||||
|
@ -181,8 +181,7 @@ static int iRCCE_mailbox_check() {
|
|||
|
||||
// reset senders flag
|
||||
RC_cache_invalidate();
|
||||
iRCCE_mailbox_recv[i]->sent = RCCE_FLAG_UNSET;
|
||||
*(int *)RCCE_fool_write_combine_buffer = 1;
|
||||
*(iRCCE_mailbox_recv[i]) = dummy_header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +192,45 @@ static int iRCCE_mailbox_check() {
|
|||
return iRCCE_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FUNCTION: iRCCE_mail_check
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief routine to check one specific mailbox
|
||||
* @param sender is the core ID from which the mailbox is checked
|
||||
*
|
||||
* This function may be called by the user application to check one specific
|
||||
* mailbox. It is recommended to use it in combination with an inter core
|
||||
* interrupt.
|
||||
*
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
int iRCCE_mail_check(int sender) {
|
||||
// verify sender's ID
|
||||
if( (sender < 0) || (sender > RCCE_NP) || (sender == RCCE_IAM) ) {
|
||||
return iRCCE_ERROR_ID;
|
||||
}
|
||||
|
||||
// check if mailbox is open
|
||||
if( iRCCE_mailbox_status[sender] == iRCCE_MAILBOX_CLOSED ) {
|
||||
return iRCCE_MAILBOX_CLOSED;
|
||||
}
|
||||
|
||||
RC_cache_invalidate();
|
||||
if( iRCCE_mailbox_recv[sender]->sent ) {
|
||||
iRCCE_mail_fetch(sender);
|
||||
|
||||
// reset senders flag
|
||||
RC_cache_invalidate();
|
||||
*(iRCCE_mailbox_recv[sender]) = dummy_header;
|
||||
|
||||
return iRCCE_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return iRCCE_MAILBOX_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FUNCTION: iRCCE_mail_recv
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -338,7 +376,7 @@ int iRCCE_mail_send(
|
|||
) {
|
||||
uint32_t flags;
|
||||
|
||||
// check for an attempt to send in own mailbox
|
||||
// check for an attempt to send to own mailbox
|
||||
if( dest == RCCE_IAM ) {
|
||||
return iRCCE_MAILBOX_INVALID;
|
||||
}
|
||||
|
@ -486,8 +524,8 @@ int iRCCE_mailbox_flush(void) {
|
|||
* last-mail.
|
||||
*
|
||||
* This function closes a mailbox of the given rank. If the check flag is set
|
||||
* an iRCCE_mail_check()-call is performed. The close procedure has to be locked
|
||||
* to be sure that no UE sends any mail while closing the mailbox.
|
||||
* an iRCCE_mailbox_check()-call is performed. The close procedure has to be
|
||||
* locked to be sure that no UE sends any mail while closing the mailbox.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static int iRCCE_mailbox_close_one(int rank, int check) {
|
||||
|
|
Loading…
Add table
Reference in a new issue