68 #define THIS_NAME "TOE/STt"
70 #define TRACE_OFF 0x0000
71 #define TRACE_STT 1 << 1
72 #define TRACE_ALL 0xFFFF
74 #define DEBUG_LEVEL (TRACE_OFF)
100 stream<StateQuery> &siRXe_SessStateQry,
101 stream<TcpState> &soRXe_SessStateRep,
102 stream<StateQuery> &siTAi_ConnectStateQry,
103 stream<TcpState> &soTAi_ConnectStateRep,
104 stream<SessionId> &siTAi_StreamStateReq,
105 stream<TcpState> &soTAi_StreamStateRep,
106 stream<SessionId> &siTIm_SessCloseCmd,
107 stream<SessionId> &soSLc_SessReleaseCmd)
110 #pragma HLS PIPELINE II=1 enable_flush
111 #pragma HLS INLINE off
114 static TcpState SESS_STATE_TABLE[TOE_MAX_SESSIONS];
115 #pragma HLS RESOURCE variable=SESS_STATE_TABLE core=RAM_2P_BRAM
116 #pragma HLS DEPENDENCE variable=SESS_STATE_TABLE inter false
119 static bool stt_rxWait=
false;
120 #pragma HLS RESET variable=stt_rxWait
121 static bool stt_txWait=
false;
122 #pragma HLS RESET variable=stt_txWait
123 static bool stt_rxSessionLocked=
false;
124 #pragma HLS RESET variable=stt_rxSessionLocked
125 static bool stt_txSessionLocked=
false;
126 #pragma HLS RESET variable=stt_txSessionLocked
127 static bool stt_closeWait=
false;
128 #pragma HLS RESET variable=stt_closeWait
137 if(!siTAi_ConnectStateQry.empty() && !stt_txWait) {
141 siTAi_ConnectStateQry.read(stt_txAccess);
142 if ((stt_txAccess.
sessionID == stt_rxSessionID) && stt_rxSessionLocked) {
146 if (stt_txAccess.
write) {
148 stt_txSessionLocked =
false;
156 soTAi_ConnectStateRep.write(SESS_STATE_TABLE[stt_txAccess.
sessionID]);
158 stt_txSessionID = stt_txAccess.
sessionID;
159 stt_txSessionLocked =
true;
163 else if (!siTAi_StreamStateReq.empty()) {
168 siTAi_StreamStateReq.read(sessionID);
169 soTAi_StreamStateRep.write(SESS_STATE_TABLE[sessionID]);
171 else if(!siRXe_SessStateQry.empty() && !stt_rxWait) {
175 siRXe_SessStateQry.read(stt_rxAccess);
176 if ((stt_rxAccess.
sessionID == stt_txSessionID) && stt_txSessionLocked) {
180 if (stt_rxAccess.
write) {
184 soSLc_SessReleaseCmd.write(stt_rxAccess.
sessionID);
187 stt_rxSessionLocked =
false;
195 soRXe_SessStateRep.write(SESS_STATE_TABLE[stt_rxAccess.
sessionID]);
196 stt_rxSessionID = stt_rxAccess.
sessionID;
197 stt_rxSessionLocked =
true;
201 else if (!siTIm_SessCloseCmd.empty() && !stt_closeWait) {
205 siTIm_SessCloseCmd.read(stt_closeSessionID);
206 if (((stt_closeSessionID == stt_rxSessionID) && stt_rxSessionLocked) || \
207 ((stt_closeSessionID == stt_txSessionID) && stt_txSessionLocked)) {
209 stt_closeWait =
true;
212 SESS_STATE_TABLE[stt_closeSessionID] =
CLOSED;
213 soSLc_SessReleaseCmd.write(stt_closeSessionID);
216 stt_closeSessionID.to_uint());
220 else if (stt_txWait) {
224 if ((stt_txAccess.
sessionID != stt_rxSessionID) || !stt_rxSessionLocked) {
225 if (stt_txAccess.
write) {
227 stt_txSessionLocked =
false;
230 soTAi_ConnectStateRep.write(SESS_STATE_TABLE[stt_txAccess.
sessionID]);
231 stt_txSessionID = stt_txAccess.
sessionID;
232 stt_txSessionLocked =
true;
237 else if (stt_rxWait) {
241 if ((stt_rxAccess.
sessionID != stt_txSessionID) || !stt_txSessionLocked) {
242 if (stt_rxAccess.
write) {
244 soSLc_SessReleaseCmd.write(stt_rxAccess.
sessionID);
247 stt_rxSessionLocked =
false;
250 soRXe_SessStateRep.write(SESS_STATE_TABLE[stt_rxAccess.
sessionID]);
251 stt_rxSessionID = stt_rxAccess.
sessionID;
252 stt_rxSessionLocked =
true;
257 else if (stt_closeWait) {
261 if (((stt_closeSessionID != stt_rxSessionID) || !stt_rxSessionLocked) && \
262 ((stt_closeSessionID != stt_txSessionID) || !stt_txSessionLocked)) {
263 SESS_STATE_TABLE[stt_closeSessionID] =
CLOSED;
264 soSLc_SessReleaseCmd.write(stt_closeSessionID);
265 stt_closeWait =
false;
void state_table(stream< StateQuery > &siRXe_SessStateQry, stream< TcpState > &soRXe_SessStateRep, stream< StateQuery > &siTAi_ConnectStateQry, stream< TcpState > &soTAi_ConnectStateRep, stream< SessionId > &siTAi_StreamStateReq, stream< TcpState > &soTAi_StreamStateRep, stream< SessionId > &siTIm_SessCloseCmd, stream< SessionId > &soSLc_SessReleaseCmd)
State Table (STt)
const char * getTcpStateName(TcpState tcpState)
Returns the name of an enum-based TCP-State as a user friendly string.
#define printInfo(callerName, format,...)
A macro to print an information message.
#define printWarn(callerName, format,...)
A macro to print a warning message.
: State Table (STt) for the TCP Offload Engine (TOE)