added mailbox-support
This commit is contained in:
parent
683f36b83e
commit
75ed99db86
2 changed files with 69 additions and 6 deletions
|
@ -30,12 +30,29 @@
|
|||
#ifndef IRCCE_H
|
||||
#define IRCCE_H
|
||||
|
||||
#include <asm/RCCE.h>
|
||||
#include "RCCE.h"
|
||||
|
||||
#define iRCCE_SUCCESS RCCE_SUCCESS
|
||||
#define iRCCE_PENDING -1
|
||||
#define iRCCE_RESERVED -2
|
||||
#define iRCCE_NOT_ENQUEUED -3
|
||||
#define iRCCE_PENDING -1
|
||||
#define iRCCE_RESERVED -2
|
||||
#define iRCCE_NOT_ENQUEUED -3
|
||||
|
||||
#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
|
||||
|
||||
// iRCCE-mailbox-system tags
|
||||
#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 {
|
||||
char *privbuf; // source buffer in local private memory (send buffer)
|
||||
|
@ -94,15 +111,32 @@ typedef struct _iRCCE_WAIT_LIST {
|
|||
} iRCCE_WAIT_LIST;
|
||||
|
||||
|
||||
#define iRCCE_MAIL_HEADER_PAYLOAD 13
|
||||
typedef struct _iRCCE_MAIL_HEADER {
|
||||
int source; // UE that will send the header
|
||||
size_t size; // size of the message which will be send/received
|
||||
int tag; // tag indicating which kind of message we have
|
||||
struct _iRCCE_MAIL_HEADER* next;// pointer for queue - could be replaced by list-object
|
||||
char prio; // priority of the mail
|
||||
iRCCE_SHORT_FLAG sent; // flag indicating that header is new
|
||||
iRCCE_SHORT_FLAG closed; // flag indication that mailbox is closed
|
||||
char payload[iRCCE_MAIL_HEADER_PAYLOAD]; // payload for small messages
|
||||
} iRCCE_MAIL_HEADER;
|
||||
|
||||
typedef struct _iRCCE_MAIL_TRASH_BIN {
|
||||
iRCCE_MAIL_HEADER* first;
|
||||
iRCCE_MAIL_HEADER* last;
|
||||
} iRCCE_MAIL_TRASH_BIN;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// THE iRCCE API:
|
||||
//
|
||||
// Initialize function:
|
||||
// Initialize/Finalize functions:
|
||||
int iRCCE_init(void);
|
||||
//
|
||||
// Non-blocking send/recv functions:
|
||||
int iRCCE_isend(char *, size_t, int, iRCCE_SEND_REQUEST *);
|
||||
int iRCCE_isend(char *, ssize_t, int, iRCCE_SEND_REQUEST *);
|
||||
int iRCCE_isend_test(iRCCE_SEND_REQUEST *, int *);
|
||||
int iRCCE_isend_wait(iRCCE_SEND_REQUEST *);
|
||||
int iRCCE_isend_push(void);
|
||||
|
@ -133,6 +167,18 @@ int iRCCE_wait_any(iRCCE_WAIT_LIST*, iRCCE_SEND_REQUEST **, iRCCE_RECV_REQUEST
|
|||
int iRCCE_isend_cancel(iRCCE_SEND_REQUEST *, int *);
|
||||
int iRCCE_irecv_cancel(iRCCE_RECV_REQUEST *, int *);
|
||||
//
|
||||
// Blocking send/recv functions for mailbox system
|
||||
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:
|
||||
int iRCCE_mail_release(iRCCE_MAIL_HEADER**);
|
||||
int iRCCE_last_mail_recv(void);
|
||||
int iRCCE_mailbox_wait(void);
|
||||
int iRCCE_mailbox_flush(void);
|
||||
int iRCCE_mailbox_close(int);
|
||||
void iRCCE_mailbox_print_header(iRCCE_MAIL_HEADER*);
|
||||
//
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Just for for convenience:
|
||||
|
|
|
@ -29,6 +29,23 @@
|
|||
|
||||
extern iRCCE_SEND_REQUEST* iRCCE_isend_queue;
|
||||
extern iRCCE_RECV_REQUEST* iRCCE_irecv_queue[RCCE_MAXNP];
|
||||
extern iRCCE_RECV_REQUEST* iRCCE_irecv_any_source_queue;
|
||||
|
||||
// pointer to MPB-mailbox-space
|
||||
extern volatile iRCCE_MAIL_HEADER* iRCCE_mailbox_send[RCCE_MAXNP];
|
||||
extern volatile iRCCE_MAIL_HEADER* iRCCE_mailbox_recv[RCCE_MAXNP];
|
||||
|
||||
// queue for received headers
|
||||
extern iRCCE_MAIL_HEADER* iRCCE_mailbox_recv_queue[iRCCE_PRIOS];
|
||||
|
||||
// flags for last mail
|
||||
extern iRCCE_SHORT_FLAG iRCCE_last_mail[RCCE_MAXNP];
|
||||
|
||||
// field to store open/closed status of mailboxes
|
||||
extern iRCCE_SHORT_FLAG iRCCE_mailbox_status[RCCE_MAXNP];
|
||||
|
||||
// garbage collection for mailbox
|
||||
extern iRCCE_MAIL_TRASH_BIN iRCCE_mail_garbage;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp threadprivate (iRCCE_isend_queue, iRCCE_irecv_queue)
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue