From 4b3efa14a324e6dfa2c482dd29cb2ba544f9b9f2 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 2 Jul 2011 03:10:07 -0700 Subject: [PATCH] add Simon's patch --- arch/x86/scc/iRCCE_mailbox.c | 146 +++++++++++++++++++++++++++++++---- 1 file changed, 132 insertions(+), 14 deletions(-) diff --git a/arch/x86/scc/iRCCE_mailbox.c b/arch/x86/scc/iRCCE_mailbox.c index ae3132cb..257a12c9 100644 --- a/arch/x86/scc/iRCCE_mailbox.c +++ b/arch/x86/scc/iRCCE_mailbox.c @@ -28,19 +28,31 @@ #include #include - #ifdef CONFIG_ROCKCREEK #include +/** + * + * @file contains implementation of the mailbox system + * @author Simon Pickartz + * + * + */ + + // forward declaration static int iRCCE_mailbox_close_one(int rank, int check); - //------------------------------------------------------------------------------ // FUNCTION: iRCCE_mailbox_print_header //------------------------------------------------------------------------------ // routine for printing given header (debugging purpose) //------------------------------------------------------------------------------ +/** + * @brief routine for printing a given header + * @param header is a pointer to a given iRCCE_MAIL_HEADER structure +*/ + void iRCCE_mailbox_print_header(iRCCE_MAIL_HEADER* header) { kprintf( "\n" @@ -59,9 +71,20 @@ void iRCCE_mailbox_print_header(iRCCE_MAIL_HEADER* header) { } //------------------------------------------------------------------------------ -// FUNCTION: iRCCE_mailbox_enqueue_header +// FUNCTION: iRCCE_mail_fetch //------------------------------------------------------------------------------ -// routine to put push received header into iRCCE_mailbox_recv_queue +/** + * @brief routine to check for new mail in a given mailbox + * @param rank is the ID of the ranks mailbox to be emptied + * + * The function checks if the mailbox has new mail for a given rank. In case of + * new mail it needs memory for the received header. Either there is memory + * in the internal garbage collection or it has to allocated. The next step is + * to check wheter a last-mail was received or a normal one. A last-mail is + * indicated by the iRCCE_LAST_MAIL tag. A last-mail entails the appropriate + * flag in the iRCCE_last_mail array to be set. Otherwise the header has to be + * enqueued in the mailbox_recv_queue accordingly to the priority field. + */ //------------------------------------------------------------------------------ static int iRCCE_mail_fetch( int rank // rank from whom to empty mailbox @@ -119,12 +142,23 @@ static int iRCCE_mail_fetch( //------------------------------------------------------------------------------ // FUNCTION: iRCCE_mailbox_check //------------------------------------------------------------------------------ -// routine to check for new mail in mailboxes +/** + * @brief routine to check for new mail in mailboxes + * + * This function has to be called from time to time. It empties all mailboxes of + * the participating cores if the corresponding sent-flag is set and the mailbox + * is not closed. After calling iRCCE_mail_fetch the sent-flag has to be reset. + * Here we have to use a little trick because we can only write to the MPB in + * cacheline granularity. We set the appropriate flag to zero and afterwords + * touch the MPB on another cacheline. That causes the write combine buffer to + * write out the data. + */ //------------------------------------------------------------------------------ static int iRCCE_mailbox_check() { int i; for( i=0; i