00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef COMPONENTS_TRIG_NIC_H
00014 #define COMPONENTS_TRIG_NIC_H
00015
00016 #include <queue>
00017 #include <map>
00018
00019 #include "sst/elements/SS_router/SS_router/RtrIF.h"
00020 #include "sst/elements/portals4_sm/trig_cpu/portals_types.h"
00021 #include "trig_nic_event.h"
00022
00023 using namespace SST;
00024
00025 struct MessageStream {
00026 void* start;
00027 int current_offset;
00028 int remaining_length;
00029 ptl_handle_ct_t ct_handle;
00030 };
00031
00032 class trig_nic : public RtrIF {
00033
00034 private:
00035
00036 Link* cpu_link;
00037
00038 Link* self_link;
00039
00040
00041 Link* ptl_link;
00042 Link* dma_link;
00043
00044 int msg_latency;
00045 int ptl_latency;
00046 int ptl_msg_latency;
00047 int rtr_q_size;
00048 int rtr_q_max_size;
00049
00050 int timing_set;
00051 int latency_ct_post;
00052 int latency_ct_host_update;
00053 int ptl_unit_latency;
00054
00055
00056 #define MAX_PORTAL_TABLE_ENTRY 32
00057 ptl_entry_t* ptl_table[MAX_PORTAL_TABLE_ENTRY];
00058
00059 #define MAX_CT_EVENTS 32
00060 ptl_int_ct_t ptl_ct_events[MAX_CT_EVENTS];
00061
00062 std::queue<ptl_int_trig_op_t*> already_triggered_q;
00063
00064
00065
00066 std::queue<trig_nic_event*> pio_q;
00067 std::queue<trig_nic_event*> dma_q;
00068 std::queue<ptl_int_dma_t*> dma_req_q;
00069 std::queue<trig_nic_event*> dma_hdr_q;
00070
00071
00072
00073
00074
00075 int dma_q_max_size;
00076
00077 std::map<int,MessageStream*> streams;
00078
00079 ptl_int_dma_t* dma_req;
00080 bool dma_in_progress;
00081
00082 bool rr_dma;
00083 bool new_dma;
00084 bool send_recv;
00085
00086 public:
00087 trig_nic( ComponentId_t id, Params_t& params );
00088
00089 virtual int Finish() {
00090 return 0;
00091 }
00092
00093 virtual int Setup() {
00094 return 0;
00095 }
00096
00097 private:
00098
00099
00100 RtrEvent* nextToRtr;
00101
00102 bool clock_handler(Cycle_t cycle);
00103 bool processCPUEvent( Event* e);
00104 bool processPtlEvent( Event* e);
00105 bool processDMAEvent( Event* e);
00106 void setTimingParams(int set);
00107
00108 inline bool PtlCTCheckThresh(ptl_handle_ct_t ct_handle, ptl_size_t test) {
00109 if ( (ptl_ct_events[ct_handle].ct_event.success +
00110 ptl_ct_events[ct_handle].ct_event.failure ) >= test ) {
00111
00112
00113
00114 return true;
00115 }
00116 return false;
00117
00118 }
00119
00120 void scheduleUpdateHostCT(ptl_handle_ct_t ct_handle);
00121 void scheduleCTInc(ptl_handle_ct_t ct_handle);
00122
00123 };
00124
00125 #endif