예제 #1
0
Int			bfqGetEmptyCount	( BufferQueue_Handle queue )
{
	return SEM_count( &(queue->semEmptyBuffers) );
}
void CleanupDirectData(void* parameter, Uint16 followUpItemIndex)
{
	Uint16 i, j, port, virtualChannel;
	struct Mail message;

	// Check if there are any virtual channels that need to be cleared
	for(i = 0; i < NUM_PORTS; i++)
	{
		for(j = 0; j < NUM_VIRTUAL_DATA_CHANNELS; j++)
		{
			// Check if this virtual channel is active
			if(globals.processing.virtualChannels[i][j].virtualChannelBlockedCount > 0)
				globals.processing.virtualChannels[i][j].virtualChannelBlockedCount--;
		}
	}

	// Check if there are any data transfers that need to be tagged or removed
	for(i = 0; i < NUM_DATA_PACKET_LOOKUPS; i++)
	{
		// Check if this data transfer is active
		if(globals.processing.dataTransferPackets[i].transferInfo.packetID != 0)
		{
			// Decrement the time to live for the transfer
			globals.processing.dataTransferPackets[i].dataBufferInfo.timeToLive--;
			
			// Check if this transfer has expired
			if(globals.processing.dataTransferPackets[i].dataBufferInfo.timeToLive <= 0)
			{
#if TEST == TEST_PROTOCOL
				
				if(globals.processing.dataTransferPackets[i].transferInfo.packetID == protocolTestPacketIDs[0])
					receivedResponse[0] = true;
				if(globals.processing.dataTransferPackets[i].transferInfo.packetID == protocolTestPacketIDs[1])
					receivedResponse[1] = true;
				if(globals.processing.dataTransferPackets[i].transferInfo.packetID == protocolTestPacketIDs[2])
					receivedResponse[2] = true;
				if(SEM_count(&TestServiceSem) == 0)
					SEM_post(&TestServiceSem);

#elif TEST == TEST_MPI
				
				// Send a message to the MPI send service
				CreateMessage(&message, 
					NULL,
					0,
					MAIL_DATA_TRANSFER_FAILED,
					globals.processing.dataTransferPackets[i].transferInfo.packetID,
					MPI_ANY_REQUEST->requestType,
					MPI_ANY_REQUEST->requestID,
					ADDRESS_UNDEFINED,
					ADDRESS_UNDEFINED,
					TEST_SERVICE_TAG,
					TEST_SERVICE_TAG);
				SendMail(TEST_SERVICE_TAG, &message);

#endif
				port = globals.processing.dataTransferPackets[i].transferInfo.port;
				virtualChannel = globals.processing.dataTransferPackets[i].transferInfo.virtualChannel;
				ClearDataTransferLookup(globals.processing.dataTransferPackets[i].transferInfo.packetID);
				globals.processing.virtualChannels[port][virtualChannel].virtualChannelBlockedCount = VIRTUAL_CHANNEL_INITIAL_BLOCKED_COUNT;
				globals.statistics.packet.numDataTransfersExpired++;
			}
		}
	}

	// Check if there are any direct transfers that need to be tagged or removed
	for(i = 0; i < NUM_PORTS; i++)
	{
		for(j = 0; j < NUM_VIRTUAL_DATA_CHANNELS; j++)
		{
			// Check if this direct transfer is active
			if(globals.processing.directTransfers[i][j].destinationPort != PORT_UNDEFINED)
			{
				// Decrement the time to live for the transfer
				globals.processing.directTransfers[i][j].timeToLive--;
					
				// Check if this transfer has expired
				if(globals.processing.directTransfers[i][j].timeToLive <= 0)
				{
					ReleaseVirtualChannel(globals.processing.directTransfers[i][j].destinationPort,
						globals.processing.directTransfers[i][j].destinationVirtualChannel);
					globals.processing.directTransfers[i][j].destinationPort = PORT_UNDEFINED;
					globals.statistics.packet.numDirectTransfersExpired++;
				}
			}
		}
	}

	// Check if there are any direct buffers that need to be tagged or removed
	for(i = 0; i < NUM_PORTS; i++)
	{
		for(j = 0; j < NUM_VIRTUAL_DATA_CHANNELS; j++)
		{
			// Check if this direct buffer is active
			if(globals.processing.directBuffer[i][j].packet.dataBuffer != NULL)
			{
				// Decrement the time to live for the buffer
				globals.processing.directBuffer[i][j].bufferStatus.timeToLive--;
				
				// Check if this buffer has expired
				if(globals.processing.directBuffer[i][j].bufferStatus.timeToLive <= 0)
				{
					MemFree(globals.processing.directBuffer[i][j].packet.dataBuffer);
					globals.processing.directBuffer[i][j].packet.dataBuffer = NULL;
					globals.statistics.packet.numDirectBuffersExpired++;
				}
			}
		}
	}
}
예제 #3
0
Int			bfqGetCount			( BufferQueue_Handle queue )
{
	return SEM_count( &(queue->semFullBuffers) );
}
void FollowUpMonitorWakeup()
{
	globals.statistics.system.ticksPassed++;
	if(SEM_count(&FollowUpMonitorSem) == 0)
		SEM_post(&FollowUpMonitorSem);
}