68 #define THIS_NAME "TOE/SLc"
70 #define TRACE_OFF 0x0000
71 #define TRACE_LRH 1 << 1
72 #define TRACE_RLT 1 << 2
73 #define TRACE_SIM 1 << 3
74 #define TRACE_URH 1 << 4
75 #define TRACE_URS 1 << 5
77 #define DEBUG_LEVEL (TRACE_OFF)
90 stream<RtlSessId> &siUrs_FreeId,
91 stream<RtlSessId> &soLrh_FreeList)
94 #pragma HLS PIPELINE II=1 enable_flush
95 #pragma HLS INLINE off
101 #pragma HLS reset variable=sim_counter
103 if (sim_counter < TOE_MAX_SESSIONS) {
105 soLrh_FreeList.write(sim_counter);
108 else if (!siUrs_FreeId.empty()) {
111 siUrs_FreeId.read(rtlSessId);
112 soLrh_FreeList.write(rtlSessId);
141 stream<CamSessionLookupRequest> &soCAM_SessLookupReq,
142 stream<CamSessionLookupReply> &siCAM_SessLookupRep,
143 stream<CamSessionUpdateReply> &siUrh_SessUpdateRsp,
144 stream<SessionLookupQuery> &siRXe_SessLookupReq,
145 stream<SessionLookupReply> &soRXe_SessLookupRep,
146 stream<SocketPair> &siTAi_SessLookupReq,
147 stream<SessionLookupReply> &soTAi_SessLookupRep,
148 stream<RtlSessId> &siSim_FreeList,
149 stream<CamSessionUpdateRequest> &soUrs_InsertSessReq,
150 stream<SLcReverseLkp> &soRlt_ReverseLkpRsp)
153 #pragma HLS PIPELINE II=1 enable_flush
154 #pragma HLS INLINE off
159 static stream<SLcFourTuple> ssInsertPipe (
"ssInsertPipe");
160 #pragma HLS STREAM variable=ssInsertPipe depth=4
162 static stream<SLcQuery> ssLookupPipe (
"ssLookupPipe");
163 #pragma HLS STREAM variable=ssLookupPipe depth=8
166 static enum FsmStates { WAIT_FOR_SESS_LKP_REQ=0, WAIT_FOR_CAM_LKP_REP, WAIT_FOR_CAM_UPD_REP } \
167 lrh_fsmState=WAIT_FOR_SESS_LKP_REQ;
168 #pragma HLS RESET variable=lrh_fsmState
170 switch (lrh_fsmState) {
171 case WAIT_FOR_SESS_LKP_REQ:
172 if (!siTAi_SessLookupReq.empty()) {
173 SocketPair sockPair = siTAi_SessLookupReq.read();
181 ssLookupPipe.write(slcQuery);
182 lrh_fsmState = WAIT_FOR_CAM_LKP_REP;
184 else if (!siRXe_SessLookupReq.empty()) {
192 ssLookupPipe.write(slcQuery);
193 lrh_fsmState = WAIT_FOR_CAM_LKP_REP;
196 case WAIT_FOR_CAM_LKP_REP:
197 if(!siCAM_SessLookupRep.empty() && !ssLookupPipe.empty()) {
199 SLcQuery slcQuery = ssLookupPipe.read();
201 RtlSessId freeID = siSim_FreeList.read();
204 ssInsertPipe.write(slcQuery.
tuple);
205 lrh_fsmState = WAIT_FOR_CAM_UPD_REP;
215 lrh_fsmState = WAIT_FOR_SESS_LKP_REQ;
219 case WAIT_FOR_CAM_UPD_REP:
220 if (!siUrh_SessUpdateRsp.empty() && !ssInsertPipe.empty()) {
230 lrh_fsmState = WAIT_FOR_SESS_LKP_REQ;
254 stream<CamSessionUpdateRequest> &siLrh_InsertSessReq,
255 stream<CamSessionUpdateRequest> &siRlt_SessDeleteReq,
256 stream<CamSessionUpdateRequest> &soCAM_SessUpdateReq,
257 stream<RtlSessId> &soSim_FreeId,
258 stream<ap_uint<16> > &soSssRelCnt,
259 stream<ap_uint<16> > &soSssRegCnt)
262 #pragma HLS PIPELINE II=1 enable_flush
263 #pragma HLS INLINE off
268 static ap_uint<16> urs_insertedSessions=0;
269 #pragma HLS RESET variable=urs_insertedSessions
270 static ap_uint<16> urs_releasedSessions=0;
271 #pragma HLS RESET variable=urs_releasedSessions
273 if (!siLrh_InsertSessReq.empty()) {
274 soCAM_SessUpdateReq.write(siLrh_InsertSessReq.read());
275 urs_insertedSessions++;
277 else if (!siRlt_SessDeleteReq.empty()) {
279 siRlt_SessDeleteReq.read(request);
280 soCAM_SessUpdateReq.write(request);
281 soSim_FreeId.write(request.
value);
282 urs_releasedSessions++;
285 if (!soSssRegCnt.full()) {
286 soSssRegCnt.write(urs_insertedSessions);
288 if (!soSssRelCnt.full()) {
289 soSssRelCnt.write(urs_releasedSessions);
301 stream<CamSessionUpdateReply> &siCAM_SessUpdateRep,
302 stream<CamSessionUpdateReply> &soLrh_SessUpdateRsp)
305 #pragma HLS PIPELINE II=1 enable_flush
306 #pragma HLS INLINE off
310 if (!siCAM_SessUpdateRep.empty()) {
312 siCAM_SessUpdateRep.read(upReply);
314 soLrh_SessUpdateRsp.write(upReply);
335 stream<SLcReverseLkp> &siLrh_ReverseLkpRsp,
336 stream<SessionId> &siSTt_SessReleaseCmd,
337 stream<SessionId> &siTXe_ReverseLkpReq,
338 stream<fourTuple> &soTXe_ReverseLkpRep,
339 stream<TcpPort> &soPRt_ClosePortCmd,
340 stream<CamSessionUpdateRequest> &soUrs_SessDeleteReq)
343 #pragma HLS PIPELINE II=1 enable_flush
344 #pragma HLS INLINE off
349 static SLcFourTuple REVERSE_LOOKUP_TABLE[TOE_MAX_SESSIONS];
350 #pragma HLS RESOURCE variable=REVERSE_LOOKUP_TABLE core=RAM_T2P_BRAM
351 #pragma HLS DEPENDENCE variable=REVERSE_LOOKUP_TABLE inter false
352 static ValBool TUPLE_VALID_TABLE[TOE_MAX_SESSIONS];
353 #pragma HLS DEPENDENCE variable=TUPLE_VALID_TABLE inter false
356 static bool rlt_isInit=
false;
357 #pragma HLS reset variable=rlt_isInit
359 #pragma HLS reset variable=rlt_counter
363 TUPLE_VALID_TABLE[rlt_counter] =
false;
364 if (rlt_counter < TOE_MAX_SESSIONS) {
373 if (!siLrh_ReverseLkpRsp.empty()) {
376 REVERSE_LOOKUP_TABLE[insert.
key] = insert.
value;
377 TUPLE_VALID_TABLE[insert.
key] =
true;
379 else if (!siSTt_SessReleaseCmd.empty()) {
384 soPRt_ClosePortCmd.write(releaseTuple.
myPort);
389 else if (!siTXe_ReverseLkpReq.empty()) {
396 REVERSE_LOOKUP_TABLE[
sessionId].theirPort));
431 stream<SessionLookupQuery> &siRXe_SessLookupReq,
432 stream<SessionLookupReply> &soRXe_SessLookupRep,
433 stream<SessionId> &siSTt_SessReleaseCmd,
434 stream<TcpPort> &soPRt_ClosePortCmd,
435 stream<SocketPair> &siTAi_SessLookupReq,
436 stream<SessionLookupReply> &soTAi_SessLookupRep,
437 stream<SessionId> &siTXe_ReverseLkpReq,
438 stream<fourTuple> &soTXe_ReverseLkpRep,
439 stream<CamSessionLookupRequest> &soCAM_SessLookupReq,
440 stream<CamSessionLookupReply> &siCAM_SessLookupRep,
441 stream<CamSessionUpdateRequest> &soCAM_SessUpdateReq,
442 stream<CamSessionUpdateReply> &siCAM_SessUpdateRep,
443 stream<ap_uint<16> > &soSssRelCnt,
444 stream<ap_uint<16> > &soSssRegCnt)
455 static stream<RtlSessId> ssSimToLrh_FreeList (
"ssSimToLrh_FreeList");
456 #pragma HLS stream variable=ssSimToLrh_FreeList depth=16384
459 static stream<RtlSessId> ssUrsToSim_FreeId (
"ssUrsToSim_FreeId");
460 #pragma HLS stream variable=ssUrsToSim_FreeId depth=2
462 static stream<CamSessionUpdateRequest> ssLrhToUrs_InsertSessReq (
"ssLrhToUrs_InsertSessReq");
463 #pragma HLS STREAM variable=ssLrhToUrs_InsertSessReq depth=4
465 static stream<SLcReverseLkp> ssLrhToRlt_ReverseLkpRsp (
"ssLrhToRlt_ReverseLkpRsp");
466 #pragma HLS STREAM variable=ssLrhToRlt_ReverseLkpRsp depth=4
469 static stream<CamSessionUpdateReply> ssUrhToLrh_SessUpdateRsp (
"ssUrhToLrh_SessUpdateRsp");
470 #pragma HLS STREAM variable=ssUrhToLrh_SessUpdateRsp depth=4
473 static stream<CamSessionUpdateRequest> ssRltToUrs_SessDeleteReq (
"ssRltToUrs_SessDeleteReq");
474 #pragma HLS STREAM variable=ssRltToUrs_SessDeleteReq depth=4
482 ssSimToLrh_FreeList);
487 ssUrhToLrh_SessUpdateRsp,
493 ssLrhToUrs_InsertSessReq,
494 ssLrhToRlt_ReverseLkpRsp);
497 ssLrhToUrs_InsertSessReq,
498 ssRltToUrs_SessDeleteReq,
506 ssUrhToLrh_SessUpdateRsp);
509 ssLrhToRlt_ReverseLkpRsp,
510 siSTt_SessReleaseCmd,
514 ssRltToUrs_SessDeleteReq);
void session_lookup_controller(stream< SessionLookupQuery > &siRXe_SessLookupReq, stream< SessionLookupReply > &soRXe_SessLookupRep, stream< SessionId > &siSTt_SessReleaseCmd, stream< TcpPort > &soPRt_ClosePortCmd, stream< SocketPair > &siTAi_SessLookupReq, stream< SessionLookupReply > &soTAi_SessLookupRep, stream< SessionId > &siTXe_ReverseLkpReq, stream< fourTuple > &soTXe_ReverseLkpRep, stream< CamSessionLookupRequest > &soCAM_SessLookupReq, stream< CamSessionLookupReply > &siCAM_SessLookupRep, stream< CamSessionUpdateRequest > &soCAM_SessUpdateReq, stream< CamSessionUpdateReply > &siCAM_SessUpdateRep, stream< ap_uint< 16 > > &soSssRelCnt, stream< ap_uint< 16 > > &soSssRegCnt)
Session Lookup Controller (SLc)
void pReverseLookupTable(stream< SLcReverseLkp > &siLrh_ReverseLkpRsp, stream< SessionId > &siSTt_SessReleaseCmd, stream< SessionId > &siTXe_ReverseLkpReq, stream< fourTuple > &soTXe_ReverseLkpRep, stream< TcpPort > &soPRt_ClosePortCmd, stream< CamSessionUpdateRequest > &soUrs_SessDeleteReq)
Reverse Lookup Table (Rlt)
void pSessionIdManager(stream< RtlSessId > &siUrs_FreeId, stream< RtlSessId > &soLrh_FreeList)
Session Id Manager (Sim)
void pLookupReplyHandler(stream< CamSessionLookupRequest > &soCAM_SessLookupReq, stream< CamSessionLookupReply > &siCAM_SessLookupRep, stream< CamSessionUpdateReply > &siUrh_SessUpdateRsp, stream< SessionLookupQuery > &siRXe_SessLookupReq, stream< SessionLookupReply > &soRXe_SessLookupRep, stream< SocketPair > &siTAi_SessLookupReq, stream< SessionLookupReply > &soTAi_SessLookupRep, stream< RtlSessId > &siSim_FreeList, stream< CamSessionUpdateRequest > &soUrs_InsertSessReq, stream< SLcReverseLkp > &soRlt_ReverseLkpRsp)
Lookup Reply Handler (Lrh)
void pUpdateReplyHandler(stream< CamSessionUpdateReply > &siCAM_SessUpdateRep, stream< CamSessionUpdateReply > &soLrh_SessUpdateRsp)
Update Reply Handler (Urh)
void pUpdateRequestSender(stream< CamSessionUpdateRequest > &siLrh_InsertSessReq, stream< CamSessionUpdateRequest > &siRlt_SessDeleteReq, stream< CamSessionUpdateRequest > &soCAM_SessUpdateReq, stream< RtlSessId > &soSim_FreeId, stream< ap_uint< 16 > > &soSssRelCnt, stream< ap_uint< 16 > > &soSssRegCnt)
Update Request Sender (Urs)
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
ap_uint< 32 > byteSwap32(ap_uint< 32 > inputVector)
ap_uint< 16 > byteSwap16(ap_uint< 16 > inputVector)