68 #define THIS_NAME "TOE/TIm"
70 #define TRACE_OFF 0x0000
71 #define TRACE_CLT 1 << 1
72 #define TRACE_PBT 1 << 2
73 #define TRACE_RTT 1 << 3
74 #define TRACE_ALL 0xFFFF
76 #define DEBUG_LEVEL (TRACE_OFF)
96 #pragma HLS PIPELINE II=1 enable_flush
97 #pragma HLS INLINE off
100 so.write(si1.read());
101 else if (!si2.empty())
102 so.write(si2.read());
136 stream<RXeReTransTimerCmd> &siRXe_ReTxTimerCmd,
137 stream<TXeReTransTimerCmd> &siTXe_ReTxTimerCmd,
138 stream<Event> &soEmx_Event,
139 stream<SessionId> &soSmx_SessCloseCmd,
140 stream<SessState> &soTAi_Notif,
141 stream<TcpAppNotif> &soRAi_Notif)
144 #pragma HLS PIPELINE II=1 enable_flush
145 #pragma HLS INLINE off
151 #pragma HLS RESOURCE variable=RETRANSMIT_TIMER_TABLE core=RAM_T2P_BRAM
152 #pragma HLS DEPENDENCE variable=RETRANSMIT_TIMER_TABLE inter false
153 #pragma HLS RESET variable=RETRANSMIT_TIMER_TABLE
156 static bool rtt_waitForWrite=
false;
157 #pragma HLS RESET variable=rtt_waitForWrite
159 #pragma HLS RESET variable=rtt_prevPosition
161 #pragma HLS RESET variable=rtt_position
172 if (rtt_waitForWrite and (rtt_rxeCmd.
sessionID != rtt_prevPosition)) {
179 printInfo(myName,
"Session #%d - Reloading RTO timer (value=%d i.e. %d clock cycles).\n",
181 TOE_MAX_SESSIONS * RETRANSMIT_TIMER_TABLE[rtt_rxeCmd.
sessionID].
time.to_uint());
188 printInfo(myName,
"Session #%d - Stopping RTO timer.\n",
193 rtt_waitForWrite =
false;
195 else if (!siRXe_ReTxTimerCmd.empty() and !rtt_waitForWrite) {
200 siRXe_ReTxTimerCmd.read(rtt_rxeCmd);
201 rtt_waitForWrite =
true;
204 if (!siTXe_ReTxTimerCmd.empty()) {
208 txeCmd = siTXe_ReTxTimerCmd.read();
211 if ( (txeCmd.
sessionID-3 < rtt_position) and
218 currID = rtt_position;
221 if (rtt_position >= TOE_MAX_SESSIONS) {
227 currEntry = RETRANSMIT_TIMER_TABLE[currID];
232 if (not currEntry.
active) {
235 currEntry.
time = TIME_3s;
238 currEntry.
time = TIME_6s;
241 currEntry.
time = TIME_12s;
244 currEntry.
time = TIME_30s;
249 printInfo(myName,
"Session #%d - Starting RTO timer (value=%d i.e. %d clock cycles).\n",
250 currID.to_int(), currEntry.
time.to_uint(),
251 currEntry.
time.to_uint()*TOE_MAX_SESSIONS);
256 printInfo(myName,
"Session #%d - Current RTO timer (value=%d i.e. %d clock cycles).\n",
257 currID.to_int(), currEntry.
time.to_uint(),
258 currEntry.
time.to_uint()*TOE_MAX_SESSIONS);
265 if (currEntry.
time > 0) {
271 else if (!soEmx_Event.full()) {
280 printWarn(myName,
"Session #%d - RTO Timeout (retries=%d).\n",
281 currID.to_int(), currEntry.
retries.to_uint());
285 soSmx_SessCloseCmd.write(currID);
289 printWarn(myName,
"Notifying [TAi] - Failed to open session %d (event=\'%s\').\n",
296 printWarn(myName,
"Notifying [RAi] - Session %d timeout (event=\'%s\').\n",
306 RETRANSMIT_TIMER_TABLE[currID] = currEntry;
307 rtt_prevPosition = currID;
328 stream<SessionId> &siRXe_ClrProbeTimer,
329 stream<SessionId> &siTXe_SetProbeTimer,
330 stream<Event> &soEmx_Event)
333 #pragma HLS INLINE off
334 #pragma HLS PIPELINE II=1 enable_flush
340 #pragma HLS RESOURCE variable=PROBE_TIMER_TABLE core=RAM_T2P_BRAM
341 #pragma HLS DATA_PACK variable=PROBE_TIMER_TABLE
342 #pragma HLS DEPENDENCE variable=PROBE_TIMER_TABLE inter false
343 #pragma HLS RESET variable=PROBE_TIMER_TABLE
346 static bool pbt_WaitForWrite=
false;
347 #pragma HLS RESET variable=pbt_WaitForWrite
349 #pragma HLS RESET variable=pbt_currSessId
351 #pragma HLS RESET variable=pbt_updtSessId
353 #pragma HLS RESET variable=pbt_prevSessId
356 bool fastResume =
false;
358 if (pbt_WaitForWrite) {
360 if (pbt_updtSessId != pbt_prevSessId) {
361 PROBE_TIMER_TABLE[pbt_updtSessId].
time = TIME_10s;
365 PROBE_TIMER_TABLE[pbt_updtSessId].
active =
false;
366 pbt_WaitForWrite =
false;
370 else if (!siTXe_SetProbeTimer.empty()) {
372 siTXe_SetProbeTimer.read(pbt_updtSessId);
373 pbt_WaitForWrite =
true;
378 if (!siRXe_ClrProbeTimer.empty()) {
380 sessIdToProcess = siRXe_ClrProbeTimer.read();
384 sessIdToProcess = pbt_currSessId;
386 if (pbt_currSessId == TOE_MAX_SESSIONS) {
391 if (PROBE_TIMER_TABLE[sessIdToProcess].active) {
394 PROBE_TIMER_TABLE[sessIdToProcess].
time = 0;
395 PROBE_TIMER_TABLE[sessIdToProcess].
active =
false;
398 else if (PROBE_TIMER_TABLE[sessIdToProcess].time == 0 and !soEmx_Event.full()) {
400 PROBE_TIMER_TABLE[sessIdToProcess].
time = 0;
401 PROBE_TIMER_TABLE[sessIdToProcess].
active =
false;
409 PROBE_TIMER_TABLE[sessIdToProcess].
time -= 1;
412 pbt_prevSessId = sessIdToProcess;
427 stream<SessionId> &siRXe_CloseTimer,
428 stream<SessionId> &soSmx_SessCloseCmd)
431 #pragma HLS PIPELINE II=1 enable_flush
432 #pragma HLS INLINE off
436 #pragma HLS RESOURCE variable=CLOSE_TIMER_TABLE core=RAM_T2P_BRAM
437 #pragma HLS DATA_PACK variable=CLOSE_TIMER_TABLE
438 #pragma HLS DEPENDENCE variable=CLOSE_TIMER_TABLE inter false
439 #pragma HLS RESET variable=CLOSE_TIMER_TABLE
442 static bool clt_waitForWrite=
false;
443 #pragma HLS RESET variable=clt_waitForWrite
445 #pragma HLS RESET variable=clt_currSessId
447 #pragma HLS RESET variable=clt_prevSessId
452 if (clt_waitForWrite) {
454 if (clt_sessIdToSet != clt_prevSessId) {
455 CLOSE_TIMER_TABLE[clt_sessIdToSet].
time = TIME_60s;
456 CLOSE_TIMER_TABLE[clt_sessIdToSet].
active =
true;
457 clt_waitForWrite =
false;
461 else if (!siRXe_CloseTimer.empty()) {
463 siRXe_CloseTimer.read(clt_sessIdToSet);
464 clt_waitForWrite =
true;
467 clt_prevSessId = clt_currSessId;
469 if (CLOSE_TIMER_TABLE[clt_currSessId].active) {
470 if (CLOSE_TIMER_TABLE[clt_currSessId].time > 0) {
471 CLOSE_TIMER_TABLE[clt_currSessId].
time -= 1;
474 CLOSE_TIMER_TABLE[clt_currSessId].
time = 0;
475 CLOSE_TIMER_TABLE[clt_currSessId].
active =
false;
476 soSmx_SessCloseCmd.write(clt_currSessId);
480 if (clt_currSessId == TOE_MAX_SESSIONS) {
506 stream<RXeReTransTimerCmd> &siRXe_ReTxTimerCmd,
507 stream<SessionId> &siRXe_ClrProbeTimer,
508 stream<SessionId> &siRXe_CloseTimer,
509 stream<TXeReTransTimerCmd> &siTXe_ReTxTimerCmd,
510 stream<SessionId> &siTXe_SetProbeTimer,
511 stream<SessionId> &soSTt_SessCloseCmd,
512 stream<Event> &soEVe_Event,
513 stream<SessState> &soTAi_Notif,
514 stream<TcpAppNotif> &soRAi_Notif)
522 static stream<SessionId> ssClsToSmx_SessCloseCmd (
"ssClsToSmx_SessCloseCmd");
523 #pragma HLS stream variable=ssClsToSmx_SessCloseCmd depth=2
525 static stream<SessionId> ssRttToSmx_SessCloseCmd (
"ssRttToSmx_SessCloseCmd");
526 #pragma HLS stream variable=ssRttToSmx_SessCloseCmd depth=2
528 static stream<Event> ssRttToEmx_Event (
"ssRttToEmx_Event");
529 #pragma HLS stream variable=ssRttToEmx_Event depth=2
530 #pragma HLS DATA_PACK variable=ssRttToEmx_Event
532 static stream<Event> ssPbtToEmx_Event (
"ssPbtToEmx_Event");
533 #pragma HLS stream variable=ssPbtToEmx_Event depth=2
534 #pragma HLS DATA_PACK variable=ssPbtToEmx_Event
548 ssRttToSmx_SessCloseCmd,
560 ssClsToSmx_SessCloseCmd);
564 ssClsToSmx_SessCloseCmd,
565 ssRttToSmx_SessCloseCmd,
void pStreamMux(stream< T > &si1, stream< T > &si2, stream< T > &so)
A 2-to-1 generic Stream Multiplexer.
void timers(stream< RXeReTransTimerCmd > &siRXe_ReTxTimerCmd, stream< SessionId > &siRXe_ClrProbeTimer, stream< SessionId > &siRXe_CloseTimer, stream< TXeReTransTimerCmd > &siTXe_ReTxTimerCmd, stream< SessionId > &siTXe_SetProbeTimer, stream< SessionId > &soSTt_SessCloseCmd, stream< Event > &soEVe_Event, stream< SessState > &soTAi_Notif, stream< TcpAppNotif > &soRAi_Notif)
The Timers (TIm)
const char * getEventName(EventType evType)
Returns the name of an enum-based event as a user friendly string.
void pRetransmitTimer(stream< RXeReTransTimerCmd > &siRXe_ReTxTimerCmd, stream< TXeReTransTimerCmd > &siTXe_ReTxTimerCmd, stream< Event > &soEmx_Event, stream< SessionId > &soSmx_SessCloseCmd, stream< SessState > &soTAi_Notif, stream< TcpAppNotif > &soRAi_Notif)
ReTransmit Timer (Rtt) process.
void pCloseTimer(stream< SessionId > &siRXe_CloseTimer, stream< SessionId > &soSmx_SessCloseCmd)
Close Timer (Clt) process.
void pProbeTimer(stream< SessionId > &siRXe_ClrProbeTimer, stream< SessionId > &siTXe_SetProbeTimer, stream< Event > &soEmx_Event)
Probe Timer (Prb) process.
#define printInfo(callerName, format,...)
A macro to print an information message.
#define printWarn(callerName, format,...)
A macro to print a warning message.
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
: Timers (TIm) for the TCP Offload Engine (TOE)