cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
tcp_shell_if.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016 -- 2021 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
47 #include "tcp_shell_if.hpp"
48 
49 using namespace hls;
50 using namespace std;
51 
52 
59 #undef USE_INTERRUPTS
60 
61 
65 #ifndef __SYNTHESIS__
66  extern bool gTraceEvent;
67 #endif
68 
69 #define THIS_NAME "TSIF" // TcpShellInterface
70 
71 #define TRACE_OFF 0x0000
72 #define TRACE_IRB 1 << 1
73 #define TRACE_RDP 1 << 2
74 #define TRACE_WRP 1 << 3
75 #define TRACE_LSN 1 << 4
76 #define TRACE_CON 1 << 5
77 #define TRACE_RNH 1 << 6
78 #define TRACE_RRH 1 << 7
79 #define TRACE_RRM 1 << 8
80 #define TRACE_ALL 0xFFFF
81 #define DEBUG_LEVEL (TRACE_OFF)
82 
83 
90 template <class Type>
92  stream<Type>& si,
93  stream<Type>& so)
94 {
95  #pragma HLS INLINE
96  Type currChunk;
97  si.read(currChunk); // Blocking read
98  so.write(currChunk); // Blocking write
99  // [TODO] so.write(si.read());
100 }
101 
102 
127 void pConnect(
128  CmdBit *piSHL_Enable,
129  stream<SockAddr> &siRDp_OpnSockReq,
130  stream<Ly4Len> &siRDp_TxCountReq,
131  stream<Ly4Len> &soWRp_TxBytesReq,
132  stream<SessionId> &soWRp_TxSessId,
133  stream<TcpAppOpnReq> &soSHL_OpnReq,
134  stream<TcpAppOpnRep> &siSHL_OpnRep,
135  stream<TcpAppClsReq> &soSHL_ClsReq)
136 {
137  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
138  #pragma HLS INLINE off
139  #pragma HLS PIPELINE II=1 enable_flush
140 
141  const char *myName = concat3(THIS_NAME, "/", "COn");
142 
143  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
144  static enum FsmStates{ CON_IDLE, CON_RD_RDp, CON_WR_WRp, \
145  CON_OPN_REQ, CON_OPN_REP } \
146  con_fsmState=CON_IDLE;
147  #pragma HLS reset variable=con_fsmState
148  static SockAddr con_testSockAddr;
149  #pragma HLS reset variable=con_testSockAddr
150 
151  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
152  static TcpAppOpnRep con_opnRep;
153  static Ly4Len con_txBytesReq;
154  static ap_uint< 12> con_watchDogTimer;
155 
156  switch (con_fsmState) {
157  case CON_IDLE:
158  if (*piSHL_Enable != 1) {
159  if (!siSHL_OpnRep.empty()) {
160  // Drain any potential status data
161  siSHL_OpnRep.read(con_opnRep);
162  printWarn(myName, "Draining unexpected residue from the \'OpnRep\' stream. As a result, request to close sessionId=%d.\n", con_opnRep.sessId.to_uint());
163  soSHL_ClsReq.write(con_opnRep.sessId);
164  }
165  }
166  else {
167  con_fsmState = CON_RD_RDp;
168  }
169  break;
170  case CON_RD_RDp:
171  if (!siRDp_OpnSockReq.empty() and !siRDp_TxCountReq.empty()) {
172  siRDp_TxCountReq.read(con_txBytesReq);
173  SockAddr currSockAddr = siRDp_OpnSockReq.read();
174  if (con_txBytesReq == 0) {
175  con_fsmState = CON_OPN_REQ;
176  con_testSockAddr = currSockAddr;
177  if (DEBUG_LEVEL & TRACE_CON) {
178  printInfo(myName, "Client is requesting to connect to new remote socket:\n");
179  printSockAddr(myName, con_testSockAddr);
180  }
181  }
182  else if (currSockAddr == con_testSockAddr) {
183  con_fsmState = CON_WR_WRp;
184  if (DEBUG_LEVEL & TRACE_CON) {
185  printInfo(myName, "Client is requesting the FPGA to send %d bytes to the last opened socket:\n", con_txBytesReq.to_uint());
186  printSockAddr(myName, currSockAddr);
187  }
188  }
189  else {
190  con_fsmState = CON_RD_RDp;
191  printInfo(myName, "Client is requesting the FPGA to send traffic to a none opened connection:\n");
192  printSockAddr(myName, currSockAddr);
193  printFatal(myName, "Error.\n");
194  }
195  }
196  break;
197  case CON_OPN_REQ:
198  if (!soSHL_OpnReq.full()) {
199  soSHL_OpnReq.write(con_testSockAddr);
200  #ifndef __SYNTHESIS__
201  con_watchDogTimer = 250;
202  #else
203  con_watchDogTimer = 10000;
204  #endif
205  con_fsmState = CON_OPN_REP;
206  }
207  break;
208  case CON_OPN_REP:
209  con_watchDogTimer--;
210  if (!siSHL_OpnRep.empty()) {
211  // Read the reply stream
212  siSHL_OpnRep.read(con_opnRep);
213  if (con_opnRep.tcpState == ESTABLISHED) {
214  if (DEBUG_LEVEL & TRACE_CON) {
215  printInfo(myName, "Client successfully established connection.\n");
216  }
217  }
218  else {
219  printError(myName, "Client failed to establish connection with remote socket (TCP state is '%s'):\n",
220  getTcpStateName(con_opnRep.tcpState));
221  }
222  con_fsmState = CON_IDLE;
223  }
224  else {
225  if (con_watchDogTimer == 0) {
226  if (DEBUG_LEVEL & TRACE_CON) {
227  printError(myName, "Timeout: Failed to establish connection.\n");
228  }
229  #ifndef __SYNTHESIS__
230  con_watchDogTimer = 250;
231  #else
232  con_watchDogTimer = 10000;
233  #endif
234  }
235  }
236  break;
237  case CON_WR_WRp:
238  if(!soWRp_TxBytesReq.full() and !soWRp_TxSessId.full()) {
239  //-- Request [WRp] to start the xmit test
240  soWRp_TxBytesReq.write(con_txBytesReq);
241  soWRp_TxSessId.write(con_opnRep.sessId);
242  con_fsmState = CON_IDLE;
243  }
244  break;
245  }
246 }
247 
248 
267 void pListen(
268  CmdBit *piSHL_Enable,
269  stream<TcpAppLsnReq> &soSHL_LsnReq,
270  stream<TcpAppLsnRep> &siSHL_LsnRep)
271 {
272  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
273  #pragma HLS INLINE off
274  #pragma HLS PIPELINE II=1 enable_flush
275 
276  const char *myName = concat3(THIS_NAME, "/", "LSn");
277 
278  //-- STATIC CONTROL VARIABLES (with RESET) ---------------------------------
279  static enum FsmStates { LSN_IDLE, LSN_SEND_REQ, LSN_WAIT_REP, LSN_DONE } \
280  lsn_fsmState=LSN_IDLE;
281  #pragma HLS reset variable=lsn_fsmState
282  static ap_uint<3> lsn_i = 0;
283  #pragma HLS reset variable=lsn_i
284 
285  //-- STATIC ARRAYS --------------------------------------------------------
286  static const TcpPort LSN_PORT_TABLE[6] = { RECV_MODE_LSN_PORT, XMIT_MODE_LSN_PORT,
289  #pragma HLS RESOURCE variable=LSN_PORT_TABLE core=ROM_1P
290 
291  //-- STATIC DATAFLOW VARIABLES ---------------------------------------------
292  static ap_uint<8> lsn_watchDogTimer;
293 
294  switch (lsn_fsmState) {
295  case LSN_IDLE:
296  if (*piSHL_Enable != 1) {
297  return;
298  }
299  else {
300  if (lsn_i == 0) {
301  lsn_fsmState = LSN_SEND_REQ;
302  }
303  else {
304  //-- Port are already opened
305  lsn_fsmState = LSN_DONE;
306  }
307  }
308  break;
309  case LSN_SEND_REQ:
310  if (!soSHL_LsnReq.full()) {
311  switch (lsn_i) {
312  case 0:
313  soSHL_LsnReq.write(RECV_MODE_LSN_PORT);
314  break;
315  case 1:
316  soSHL_LsnReq.write(XMIT_MODE_LSN_PORT);
317  break;
318  case 2:
319  soSHL_LsnReq.write(ECHO_MOD2_LSN_PORT);
320  break;
321  case 3:
322  soSHL_LsnReq.write(ECHO_MODE_LSN_PORT);
323  break;
324  case 4:
325  soSHL_LsnReq.write(IPERF_LSN_PORT);
326  break;
327  case 5:
328  soSHL_LsnReq.write(IPREF3_LSN_PORT);
329  break;
330  }
331  if (DEBUG_LEVEL & TRACE_LSN) {
332  printInfo(myName, "Server is requested to listen on port #%d (0x%4.4X).\n",
333  LSN_PORT_TABLE[lsn_i].to_uint(), LSN_PORT_TABLE[lsn_i].to_uint());
334  }
335  #ifndef __SYNTHESIS__
336  lsn_watchDogTimer = 10;
337  #else
338  lsn_watchDogTimer = 100;
339  #endif
340  lsn_fsmState = LSN_WAIT_REP;
341  }
342  else {
343  printWarn(myName, "Cannot send a listen port request to [TOE] because stream is full!\n");
344  }
345  break;
346  case LSN_WAIT_REP:
347  lsn_watchDogTimer--;
348  if (!siSHL_LsnRep.empty()) {
349  TcpAppLsnRep listenDone;
350  siSHL_LsnRep.read(listenDone);
351  if (listenDone) {
352  if (DEBUG_LEVEL & TRACE_LSN) {
353  printInfo(myName, "Received OK listen reply from [TOE] for port %d.\n", LSN_PORT_TABLE[lsn_i].to_uint());
354  }
355  if (lsn_i == sizeof(LSN_PORT_TABLE)/sizeof(LSN_PORT_TABLE[0])-1) {
356  lsn_fsmState = LSN_DONE;
357  }
358  else {
359  //-- Set next listen port number
360  lsn_i += 1;
361  lsn_fsmState = LSN_SEND_REQ;
362  }
363  }
364  else {
365  printWarn(myName, "TOE denied listening on port %d (0x%4.4X).\n",
366  LSN_PORT_TABLE[lsn_i].to_uint(), LSN_PORT_TABLE[lsn_i].to_uint());
367  lsn_fsmState = LSN_SEND_REQ;
368  }
369  }
370  else {
371  if (lsn_watchDogTimer == 0) {
372  printError(myName, "Timeout: Server failed to listen on port %d (0x%4.4X).\n",
373  LSN_PORT_TABLE[lsn_i].to_uint(), LSN_PORT_TABLE[lsn_i].to_uint());
374  lsn_fsmState = LSN_SEND_REQ;
375  }
376  }
377  break;
378  case LSN_DONE:
379  break;
380  } // End-of: switch()
381 } // End-of: pListen()
382 
383 #if defined USE_INTERRUPTS
384 
402 void pInputReadBuffer(
403  CmdBit *piSHL_Enable,
404  stream<TcpAppData> &siSHL_Data,
405  stream<TcpAppMeta> &siSHL_Meta,
406  stream<SigBit> &soRRh_EnquSig,
407  stream<TcpAppData> &soRDp_Data,
408  stream<TcpAppMeta> &soRDp_Meta)
409 {
410  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
411  #pragma HLS INLINE off
412  #pragma HLS PIPELINE II=1 enable_flush
413 
414  const char *myName = concat3(THIS_NAME, "/", "IRb");
415 
416  //-- STATIC CONTROL VARIABLES (with RESET) ---------------------------------
417  static enum FsmStates { IRB_IDLE=0, IRB_STREAM } \
418  irb_fsmState=IRB_IDLE;
419  #pragma HLS reset variable=irb_fsmState
420 
421  if (*piSHL_Enable != 1) {
422  return;
423  }
424 
425  switch (irb_fsmState ) {
426  case IRB_IDLE:
427  if (!siSHL_Meta.empty() and !soRDp_Meta.full()) {
428  soRDp_Meta.write(siSHL_Meta.read());
429  irb_fsmState = IRB_STREAM;
430  }
431  break;
432  case IRB_STREAM:
433  if (!siSHL_Data.empty() and !soRDp_Data.full() and !soRRh_EnquSig.full()) {
434  TcpAppData currChunk = siSHL_Data.read();
435  soRDp_Data.write(currChunk);
436  soRRh_EnquSig.write(1);
437  if (currChunk.getTLast()) {
438  irb_fsmState = IRB_IDLE;
439  }
440  }
441  break;
442  }
443 }
444 
445 
453 void pRxBufferOccupancy(
454  stream<SigBit> &siEnqueueSig,
455  stream<SigBit> &siDequeueSig,
456  stream<ap_uint<log2Ceil<cIBuffBytes>::val+1> > &soFreeSpace)
457 {
458  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
459  #pragma HLS INLINE off
460  #pragma HLS PIPELINE II=1 enable_flush
461 
462  const char *myName = concat3(THIS_NAME, "/", "RRh/Rxb");
463 
464  static ap_uint<log2Ceil<cIBuffBytes>::val+1> rrh_freeSpace=cIBuffBytes;
465  #pragma HLS reset variable=rrh_freeSpace
466 
467  bool traceInc = false;
468  bool traceDec = false;
469 
470  if (!siEnqueueSig.empty() and siDequeueSig.empty()) {
471  siEnqueueSig.read();
472  rrh_freeSpace -= (ARW/8);
473  traceInc = true;
474  } else if (siEnqueueSig.empty() and !siDequeueSig.empty()) {
475  siDequeueSig.read();
476  rrh_freeSpace += (ARW/8);
477  traceDec = true;
478  } else if (!siEnqueueSig.empty() and !siDequeueSig.empty()) {
479  siEnqueueSig.read();
480  siDequeueSig.read();
481  traceInc = true;
482  traceDec = true;
483  }
484  //-- Always
485  soFreeSpace.write(rrh_freeSpace);
486 
487  if (DEBUG_LEVEL & TRACE_RRH_IBO) {
488  if (traceInc or traceDec) {
489  printInfo(myName, "Input buffer occupancy = %d bytes (%c|%c)\n",
490  (cIBuffBytes - rrh_freeSpace.to_uint()),
491  (traceInc ? '+' : ' '), (traceDec ? '-' : ' '));
492  }
493  }
494 }
495 
496 
516 void pRxPostNotification(
517  stream<TcpAppNotif> &siSHL_Notif,
518  stream<InterruptQuery> &soRit_InterruptQry,
519  stream<InterruptEntry> &siRit_InterruptRep,
520  stream<SessionId> &soRsr_SessId)
521 {
522  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
523  #pragma HLS INLINE off
524  #pragma HLS PIPELINE II=1 enable_flush
525 
526  const char *myName = concat3(THIS_NAME, "/", "RRh/Rxp");
527 
528  //-- STATIC VARIABLES W/ RESET ---------------------------------------------
529  static enum PostFsmStates { RPN_IDLE, RPN_INC, RPN_POST } \
530  rpn_fsmState=RPN_IDLE;
531  #pragma HLS reset variable=rpn_fsmState
532 
533  //-- STATIC DATAFLOW VARIABLES ---------------------------------------------
534  static TcpAppNotif rpn_notif;
535  static TcpDatLen rpn_newPendingByteCnt;
536 
537  //-- PROCESS FUNCTION ------------------------------------------------------
538 
539  switch (rpn_fsmState) {
540  case RPN_IDLE:
541  if (!siSHL_Notif.empty() and !soRit_InterruptQry.full()) {
542  rpn_notif = siSHL_Notif.read();
543  if (rpn_notif.tcpDatLen != 0) {
544  InterruptQuery getQuery(rpn_notif.sessionID, GET);
545  soRit_InterruptQry.write(getQuery);
546  rpn_fsmState = RPN_INC;
547  }
548  }
549  break;
550  case RPN_INC:
551  if (!siRit_InterruptRep.empty()) {
552  InterruptEntry currEntry = siRit_InterruptRep.read();
553  rpn_newPendingByteCnt = currEntry.byteCnt + rpn_notif.tcpDatLen;
554  rpn_fsmState = RPN_POST;
555  }
556  break;
557  case RPN_POST:
558  if (!soRit_InterruptQry.full() and !soRsr_SessId.full()) {
559  InterruptEntry currEntry(rpn_newPendingByteCnt, rpn_notif.tcpDstPort);
560  InterruptQuery postQuery(rpn_notif.sessionID, currEntry);
561  soRit_InterruptQry.write(postQuery);
562  soRsr_SessId.write(rpn_notif.sessionID);
563  rpn_fsmState = RPN_IDLE;
564  }
565  break;
566  }
567 }
568 
569 
587 void pRxInterruptTable(
588  stream<InterruptQuery> &siRpn_InterruptQry,
589  stream<InterruptEntry> &soRpn_InterruptRep,
590  stream<InterruptQuery> &siRsr_InterruptQry,
591  stream<InterruptEntry> &soRsr_InterruptRep)
592 {
593  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
594  #pragma HLS INLINE off
595  #pragma HLS PIPELINE II=1 enable_flush
596 
597  const char *myName = concat3(THIS_NAME, "/", "RRh/Rit");
598 
599  //-- STATIC ARRAYS ---------------------------------------------------------
600  static InterruptEntry INTERRUPT_TABLE[cMaxSessions];
601  #pragma HLS RESOURCE variable=INTERRUPT_TABLE core=RAM_2P
602  #pragma HLS DEPENDENCE variable=INTERRUPT_TABLE inter false
603 
604  //-- STATIC VARIABLES W/ RESET ---------------------------------------------
605  static bool rit_isInit=false;
606  #pragma HLS reset variable=rit_isInit
607  static ap_uint<log2Ceil<cMaxSessions>::val> rit_initEntry=0;
608  #pragma HLS reset variable=rit_initEntry
609 
610  static enum FsmStates { RIT_IDLE, RIT_NOTIF_REQ, RIT_NOTIF_REP, RIT_NOTIF_UPDATE, \
611  RIT_SCHED_REQ, RIT_SCHED_REP, RIT_SCHED_UPDATE } rit_fsmState=RIT_IDLE;
612 
613  //-- STATIC DATAFLOW VARIABLES ---------------------------------------------
614  static InterruptEntry rit_notifEntry;
615  static InterruptEntry rit_schedEntry;
616  static InterruptQuery rit_notifQuery;
617  static InterruptQuery rit_schedQuery;
618 
619  //-- PROCESS FUNCTION ------------------------------------------------------
620  if (!rit_isInit) {
621  //-- This the table must be cleared upon reset
622  INTERRUPT_TABLE[rit_initEntry] = InterruptEntry(0, 0);
623  if (rit_initEntry == (cMaxSessions-1)) {
624  rit_isInit = true;
625  if (DEBUG_LEVEL & TRACE_RRH) {
626  printInfo(myName, "Done with initialization of INTERRUPT_TABLE.\n");
627  }
628  } else {
629  rit_initEntry += 1;
630  }
631  }
632  else {
633  switch (rit_fsmState) {
634  case RIT_IDLE:
635  if (!siRpn_InterruptQry.empty()) {
636  rit_notifQuery = siRpn_InterruptQry.read();
637  if (rit_notifQuery.action != GET) {
638  printFatal(myName, "Expecting a query 'GET' request!\n");
639  }
640  rit_fsmState = RIT_NOTIF_REQ;
641  }
642  else if (!siRsr_InterruptQry.empty()) {
643  rit_schedQuery = siRsr_InterruptQry.read();
644  if (rit_schedQuery.action != GET) {
645  printFatal(myName, "Expecting a query 'GET' request!\n");
646  }
647  rit_fsmState = RIT_SCHED_REQ;
648  }
649  break;
650  case RIT_NOTIF_REQ:
651  rit_notifEntry = INTERRUPT_TABLE[rit_notifQuery.sessId];
652  rit_fsmState = RIT_NOTIF_REP;
653  break;
654  case RIT_NOTIF_REP:
655  if (!soRpn_InterruptRep.full()) {
656  soRpn_InterruptRep.write(rit_notifEntry);
657  rit_fsmState = RIT_NOTIF_UPDATE;
658  }
659  break;
660  case RIT_SCHED_REQ:
661  rit_schedEntry = INTERRUPT_TABLE[rit_schedQuery.sessId];
662  rit_fsmState = RIT_SCHED_REP;
663  break;
664  case RIT_SCHED_REP:
665  if (!soRsr_InterruptRep.full()) {
666  soRsr_InterruptRep.write(rit_schedEntry);
667  rit_fsmState = RIT_SCHED_UPDATE;
668  }
669  break;
670  case RIT_NOTIF_UPDATE:
671  if (!siRpn_InterruptQry.empty()) {
672  InterruptQuery notifQry = siRpn_InterruptQry.read();
673  if (notifQry.action == POST) {
674  INTERRUPT_TABLE[notifQry.sessId] = InterruptEntry(notifQry.entry);
675  }
676  else if (notifQry.action == PUT) {
677  INTERRUPT_TABLE[notifQry.sessId].byteCnt = notifQry.entry.byteCnt;
678  }
679  else {
680  printFatal(myName, "Expecting a query 'PUT' or 'PUSH' request!\n");
681  }
682  rit_fsmState = RIT_IDLE;
683  }
684  break;
685  case RIT_SCHED_UPDATE:
686  if (!siRsr_InterruptQry.empty()) {
687  InterruptQuery schedQry = siRsr_InterruptQry.read();
688  if (schedQry.action == POST) {
689  INTERRUPT_TABLE[schedQry.sessId] = InterruptEntry(schedQry.entry);
690  }
691  else if (schedQry.action == PUT) {
692  INTERRUPT_TABLE[schedQry.sessId].byteCnt = schedQry.entry.byteCnt;
693  }
694  else {
695  printFatal(myName, "Expecting a query 'PUT' or 'PUSH' request!\n");
696  }
697  rit_fsmState = RIT_IDLE;
698  }
699  break;
700  }
701  }
702 }
703 
704 
709 void pRxHandler(
710  stream<SessionId> &siRpn_SessId,
711  stream<ReqBit> &siRxs_SessIdReq,
712  stream<SessionId> &soRxs_SessIdRep,
713  stream<SessionId> &siRxs_ClearInt)
714 {
715  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
716  #pragma HLS INLINE off
717  #pragma HLS PIPELINE II=1 enable_flush
718 
719  const char *myName = concat3(THIS_NAME, "/", "RRh/Rxh");
720 
721  //-- STATIC VARIABLES W/ RESET ---------------------------------------------
722  static ap_uint<cMaxSessions> rsr_pendingInterrupts=0;
723  #pragma HLS reset variable=rsr_pendingInterrupts
724  static SessionId rsr_currSess=0;
725  #pragma HLS reset variable=rsr_currSess
726 
727  //-- DYNAMIC VARIABLES -----------------------------------------------------
728  ap_uint<log2Ceil<cMaxSessions>::val> nextSess=0;
729  ap_uint<cMaxSessions> setVec=0;
730  ap_uint<cMaxSessions> clrVec=0;
731 
732  //-- Set interrupt ----------------
733  if (!siRpn_SessId.empty()) {
734  SessionId sessId = siRpn_SessId.read();
735  setVec[sessId] = 1;
736  if (DEBUG_LEVEL & TRACE_RRH) {
737  printInfo(myName, "Set interrupt for session #%d.\n", sessId.to_uint());
738  }
739  }
740  //-- Clear interrupt --------------
741  if (!siRxs_ClearInt.empty()) {
742  SessionId sessId = siRxs_ClearInt.read();
743  clrVec[sessId] = 1;
744  if (DEBUG_LEVEL & TRACE_RRH) {
745  printInfo(myName, "Clear interrupt for session #%d.\n", sessId.to_uint());
746  }
747  }
748  //-- Update interrupt vector ------
749  rsr_pendingInterrupts = (rsr_pendingInterrupts xor clrVec) | setVec;
750 
751  //-- Forward interrupt
752  bool currSessValid = false;
753  if (!siRxs_SessIdReq.empty() and !soRxs_SessIdRep.full()) {
754  //-- Round-robin scheduler
755  for (uint8_t i=0; i<cMaxSessions; ++i) {
756  #pragma HLS UNROLL
757  nextSess = rsr_currSess + i + 1;
758  if (rsr_pendingInterrupts[nextSess] == 1) {
759  rsr_currSess = nextSess;
760  currSessValid = true;
761  }
762  }
763  if (currSessValid == true) {
764  siRxs_SessIdReq.read();
765  soRxs_SessIdRep.write(nextSess);
766  if (DEBUG_LEVEL & TRACE_RRH) {
767  printInfo(myName, "RR-Arbiter has scheduled session #%d.\n", nextSess.to_uint());
768  }
769  }
770  }
771 }
772 
773 
795 void pRxScheduler(
796  stream<ReqBit> &soRxh_SessIdReq,
797  stream<SessionId> &siRxh_SessIdRep,
798  stream<ap_uint<log2Ceil<cIBuffBytes>::val + 1> > &siRxb_FreeSpace,
799  stream<InterruptQuery> &soRit_InterruptQry,
800  stream<InterruptEntry> &siRit_InterruptRep,
801  stream<SessionId> &soRxh_ClearReq,
802  stream<TcpAppRdReq> &soSHL_DReq,
803  stream<ForwardCmd> &soRDp_FwdCmd)
804 {
805  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
806  #pragma HLS INLINE off
807  #pragma HLS PIPELINE II=1 enable_flush
808 
809  const char *myName = concat3(THIS_NAME, "/", "RRh/Rxs");
810 
811  //-- STATIC VARIABLES W/ RESET ---------------------------------------------
812  static enum FsmStates { RSR_SREQ, RSR_SREP, RSR_DEC, RSR_PUT, RSR_FWD } \
813  rsr_fsmState=RSR_SREQ;
814  #pragma HLS reset variable=rsr_fsmState
815  static TcpDatLen rsr_freeSpace;
816  #pragma HLS reset variable=rsr_freeSpace
817 
818  //-- STATIC VARIABLES ------------------------------------------------------
819  static SessionId rsr_currSess;
820  static InterruptEntry rsr_intEntry;
821  static TcpDatLen rsr_datLenReq;
822  static ap_uint<cMaxSessions> rsr_pendingInterrupts;
823 
824  TcpDatLen newByteCnt;
825 
826  if (!siRxb_FreeSpace.empty()) {
827  rsr_freeSpace = siRxb_FreeSpace.read();
828  }
829 
830  switch(rsr_fsmState) {
831  case RSR_SREQ:
832  if (!soRxh_SessIdReq.full()) {
833  soRxh_SessIdReq.write(1);
834  rsr_fsmState = RSR_SREP;
835  }
836  break;
837  case RSR_SREP:
838  if (!siRxh_SessIdRep.empty() and !soRit_InterruptQry.full()) {
839  rsr_currSess = siRxh_SessIdRep.read();
840  soRit_InterruptQry.write(rsr_currSess);
841  if (DEBUG_LEVEL & TRACE_RRH) {
842  printInfo(myName, "Querying [Rit] for session #%d.\n", rsr_currSess.to_uint());
843  }
844  rsr_fsmState = RSR_DEC;
845  }
846  break;
847  case RSR_DEC:
848  if (!siRit_InterruptRep.empty()) {
849  // Decrement counter and put it back in the table
850  rsr_intEntry = siRit_InterruptRep.read();
851  // Request to TOE = max(rit_schedEntry.byteCnt, rit_freeSSpace)
852  rsr_datLenReq = (rsr_freeSpace < rsr_intEntry.byteCnt) ? (rsr_freeSpace) : (rsr_intEntry.byteCnt);
853  if (DEBUG_LEVEL & TRACE_RRH) {
854  printInfo(myName, "NotifBytes=%d - FreeSpace=%d \n",
855  rsr_intEntry.byteCnt.to_uint(), rsr_freeSpace.to_uint());
856  }
857  rsr_fsmState = RSR_PUT;
858  }
859  break;
860  case RSR_PUT:
861  if (!soRit_InterruptQry.full() and !soRxh_ClearReq.full()) {
862  newByteCnt = rsr_intEntry.byteCnt - rsr_datLenReq;
863  soRit_InterruptQry.write(InterruptQuery(rsr_currSess, newByteCnt));
864  if (newByteCnt == 0) {
865  soRxh_ClearReq.write(rsr_currSess);
866  if (DEBUG_LEVEL & TRACE_RRH) {
867  printInfo(myName, "Request to clear interrupt #%d.\n", rsr_currSess.to_uint());
868  }
869  }
870  rsr_fsmState = RSR_FWD;
871  }
872  break;
873  case RSR_FWD:
874  if (!soSHL_DReq.full() and !soRDp_FwdCmd.full()) {
875  soSHL_DReq.write(TcpAppRdReq(rsr_currSess, rsr_datLenReq));
876  switch (rsr_intEntry.dstPort) {
877  case RECV_MODE_LSN_PORT: // 8800
878  soRDp_FwdCmd.write(ForwardCmd(rsr_currSess, rsr_datLenReq, CMD_DROP, NOP));
879  break;
880  case XMIT_MODE_LSN_PORT: // 8801
881  soRDp_FwdCmd.write(ForwardCmd(rsr_currSess, rsr_datLenReq, CMD_DROP, GEN));
882  break;
883  default:
884  soRDp_FwdCmd.write(ForwardCmd(rsr_currSess, rsr_datLenReq, CMD_KEEP, NOP));
885  break;
886  }
887  if (DEBUG_LEVEL & TRACE_RRH) {
888  printInfo(myName, "Sending DReq(SessId=%2d, DatLen=%4d) to RDp (expected TcpDstPort=%4d).\n",
889  rsr_currSess.to_uint(), rsr_datLenReq.to_uint(), rsr_intEntry.dstPort.to_uint());
890  }
891  }
892  rsr_fsmState = RSR_SREQ;
893  break;
894  }
895 }
896 
897 
941  stream<TcpAppNotif> &siSHL_Notif,
942  stream<SigBit> &siIRb_EnquSig,
943  stream<SigBit> &siRDp_DequSig,
944  stream<TcpAppRdReq> &soSHL_DReq,
945  stream<ForwardCmd> &soRDp_FwdCmd)
946 {
947  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
948  #pragma HLS DATAFLOW
949  #pragma HLS INTERFACE ap_ctrl_none port=return
950  #pragma HLS INLINE off
951 
952  const char *myName = concat3(THIS_NAME, "/", "RRh");
953 
954  //-- LOCAL STREAM ----------------------------------------------------------
955  static stream<InterruptQuery> ssRpnToRit_InterruptQry ("ssRpnToRit_InterruptQry");
956  #pragma HLS stream variable=ssRpnToRit_InterruptQry depth=2
957  static stream<SessionId> ssRpnToRxh_SessId ("ssRpnToRxh_SessId");
958  #pragma HLS stream variable=ssRpnToRxh_SessId depth=4
959 
960  static stream<InterruptEntry> ssRitToRsr_InterruptRep ("ssRitToRsr_InterruptRep");
961  #pragma HLS stream variable=ssRitToRsr_InterruptRep depth=2
962  static stream<InterruptEntry> ssRitToRpn_InterruptRep ("ssRitToRpn_InterruptRep");
963  #pragma HLS stream variable=ssRitToRpn_InterruptRep depth=2
964 
965  static stream<InterruptQuery> ssRxsToRit_InterruptQry ("ssRxsToRit_InterruptQry");
966  #pragma HLS stream variable=ssRxsToRit_InterruptQry depth=2
967 
968  static stream<ReqBit> ssRxsToRxh_SessIdReq ("ssRxsToRxh_SessIdReq");
969  #pragma HLS stream variable=ssRxsToRxh_SessIdReq depth=2
970  static stream<SessionId> ssRxsToRxh_ClearInt ("ssRxsToRxh_ClearInt");
971  #pragma HLS stream variable=ssRxsToRxh_ClearInt depth=2
972 
973  static stream<SessionId> ssRxhToRxs_SessIdRep ("ssRxhToRxs_SessIdRep");
974  #pragma HLS stream variable=ssRxhToRxs_SessIdRep depth=2
975 
976  static stream<ap_uint<log2Ceil<cIBuffBytes>::val+1> > ssRxbToRxs_FreeSpace ("ssRxbToRxs_FreeSpace");
977  #pragma HLS stream variable=ssRxbToRxs_FreeSpace depth=4
978 
979  //-- PROCESS FUNCTIONS -----------------------------------------------------
980  pRxBufferOccupancy(
981  siIRb_EnquSig,
982  siRDp_DequSig,
983  ssRxbToRxs_FreeSpace);
984 
985  pRxPostNotification(
986  siSHL_Notif,
987  ssRpnToRit_InterruptQry,
988  ssRitToRpn_InterruptRep,
989  ssRpnToRxh_SessId);
990 
991  pRxHandler(
992  ssRpnToRxh_SessId,
993  ssRxsToRxh_SessIdReq,
994  ssRxhToRxs_SessIdRep,
995  ssRxsToRxh_ClearInt);
996 
997  pRxScheduler(
998  ssRxsToRxh_SessIdReq,
999  ssRxhToRxs_SessIdRep,
1000  ssRxbToRxs_FreeSpace,
1001  ssRxsToRit_InterruptQry,
1002  ssRitToRsr_InterruptRep,
1003  ssRxsToRxh_ClearInt,
1004  soSHL_DReq,
1005  soRDp_FwdCmd);
1006 
1007  pRxInterruptTable(
1008  ssRpnToRit_InterruptQry,
1009  ssRitToRpn_InterruptRep,
1010  ssRxsToRit_InterruptQry,
1011  ssRitToRsr_InterruptRep);
1012 }
1013 
1014 #else
1015 
1016 
1034  CmdBit *piSHL_Enable,
1035  stream<TcpAppData> &siSHL_Data,
1036  stream<TcpAppMeta> &siSHL_Meta,
1037  stream<TcpAppData> &soRDp_Data,
1038  stream<TcpAppMeta> &soRDp_Meta)
1039 {
1040  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1041  #pragma HLS INLINE off
1042  #pragma HLS PIPELINE II=1 enable_flush
1043 
1044  const char *myName = concat3(THIS_NAME, "/", "IRb");
1045 
1046  if (*piSHL_Enable != 1) {
1047  return;
1048  }
1049 
1050  if (!siSHL_Meta.empty() and !soRDp_Meta.full()) {
1051  soRDp_Meta.write(siSHL_Meta.read());
1052  }
1053  if (!siSHL_Data.empty() and !soRDp_Data.full()) {
1054  soRDp_Data.write(siSHL_Data.read());
1055  }
1056 
1057 }
1058 
1059 
1075  CmdBit *piSHL_Enable,
1076  stream<TcpAppNotif> &siSHL_Notif,
1077  stream<TcpAppNotif> &soRRh_Notif)
1078 {
1079  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1080  #pragma HLS INLINE off
1081  #pragma HLS PIPELINE II=1 enable_flush
1082 
1083  const char *myName = concat3(THIS_NAME, "/", "RNh");
1084 
1085  if (*piSHL_Enable != 1) {
1086  return;
1087  }
1088 
1089  if (!siSHL_Notif.empty()) {
1090  TcpAppNotif notif;
1091  siSHL_Notif.read(notif);
1092  if (notif.tcpDatLen == 0) {
1093  printFatal(myName, "Received a notification for a TCP segment of length 'zero'. Don't know what to do with it!\n");
1094  }
1095  if (!soRRh_Notif.full()) {
1096  soRRh_Notif.write(notif);
1097  }
1098  else {
1099  printFatal(myName, "The Rx Notif FiFo is full. Consider increasing the depth of this FiFo.\n");
1100  }
1101  }
1102 }
1103 
1104 
1141  CmdBit *piSHL_Enable,
1142  stream<TcpAppNotif> &siRNh_Notif,
1143  stream<SigBit> &siRDp_DequSig,
1144  stream<TcpAppRdReq> &soRRm_DReq,
1145  stream<ForwardCmd> &soRDp_FwdCmd,
1146  stream<ap_uint<16> > &soDBG_freeSpace)
1147 {
1148  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1149  #pragma HLS INLINE off
1150 
1151  const char *myName = concat3(THIS_NAME, "/", "RRh");
1152 
1153  //-- LOCAL STATIC VARIABLES W/ RESET ---------------------------------------
1154  static enum FsmStates { RRH_IDLE, RRH_GEN_DLEN, RRH_SEND_DREQ} \
1155  rrh_fsmState=RRH_IDLE;
1156  #pragma HLS reset variable=rrh_fsmState
1157  static ap_uint<log2Ceil<cIBuffBytes>::val+1> rrh_freeSpace=cIBuffBytes;
1158  #pragma HLS reset variable=rrh_freeSpace
1159 
1160  //-- STATIC VARIABLES ------------------------------------------------------
1161  static TcpAppNotif rrh_notif;
1162  static TcpDatLen rrh_datLenReq;
1163 
1164  if (*piSHL_Enable != 1) {
1165  return;
1166  }
1167 
1168  //-- MAIN PROCESS ----------------------------------------------------------
1169  switch(rrh_fsmState) {
1170  case RRH_IDLE:
1171  //-- Always handle dequeue signal
1172  if (!siRDp_DequSig.empty()) {
1173  siRDp_DequSig.read();
1174  rrh_freeSpace += (ARW/8);
1175  if (DEBUG_LEVEL & TRACE_RRH) {
1176  printInfo(myName, "FreeSpace=%4d bytes\n", rrh_freeSpace.to_uint());
1177  }
1178  }
1179  if (!siRNh_Notif.empty()) {
1180  siRNh_Notif.read(rrh_notif);
1181  rrh_fsmState = RRH_GEN_DLEN;
1182  if (DEBUG_LEVEL & TRACE_RRH) {
1183  printInfo(myName, "Received a new notification (SessId=%2d | DatLen=%4d | TcpDstPort=%4d).\n",
1184  rrh_notif.sessionID.to_uint(), rrh_notif.tcpDatLen.to_uint(), rrh_notif.tcpDstPort.to_uint());
1185  }
1186  }
1187  break;
1188  case RRH_GEN_DLEN:
1189  if (rrh_freeSpace >= cMinDataReqLen) {
1190  //-- Issue a new SEND request = max(rdr_notif.byteCnt, rrh_freeSpace)
1191  if (rrh_freeSpace < rrh_notif.tcpDatLen) {
1192  //-- Requested bytes = rrh_freeSpace
1193  rrh_datLenReq = rrh_freeSpace;
1194  rrh_notif.tcpDatLen -= rrh_freeSpace;
1195  //-- Handle dequeue signal
1196  if (!siRDp_DequSig.empty()) {
1197  siRDp_DequSig.read();
1198  rrh_freeSpace += (ARW/8);
1199  }
1200  else {
1201  rrh_freeSpace = 0;
1202  }
1203  }
1204  else {
1205  //-- Requested bytes = rdr_notif.byteCnt
1206  rrh_datLenReq = rrh_notif.tcpDatLen;
1207  rrh_freeSpace -= (rrh_notif.tcpDatLen) & ~((TcpDatLen)(ARW/8-1));
1208  if (rrh_notif.tcpDatLen & (TcpDatLen)((ARW/8)-1)) {
1209  // The requested length is not aligned w/ the input buffer
1210  // width and this will consume another input buffer chunk.
1211  rrh_freeSpace -= (ARW/8);
1212  //-- Handle dequeue signal
1213  if (!siRDp_DequSig.empty()) {
1214  siRDp_DequSig.read();
1215  rrh_freeSpace += (ARW/8);
1216  }
1217  }
1218  rrh_notif.tcpDatLen = 0;
1219  }
1220  rrh_fsmState = RRH_SEND_DREQ;
1221  }
1222  else {
1223  if (DEBUG_LEVEL & TRACE_RRH) {
1224  printInfo(myName, "FreeSpace=%4d is too low. Waiting for buffer to drain. \n",
1225  rrh_freeSpace.to_uint());
1226  }
1227  //-- Handle dequeue signal
1228  if (!siRDp_DequSig.empty()) {
1229  siRDp_DequSig.read();
1230  rrh_freeSpace += (ARW/8);
1231  }
1232  }
1233  // Debug Trace
1234  if (DEBUG_LEVEL & TRACE_RRH) {
1235  printInfo(myName, "DataLenReq=%4d | FreeSpace=%4d | NotifBytes=%4d \n",
1236  rrh_datLenReq.to_uint(), rrh_freeSpace.to_uint(), rrh_notif.tcpDatLen.to_uint());
1237  }
1238  break;
1239  case RRH_SEND_DREQ:
1240  //-- Always handle dequeue signal
1241  if (!siRDp_DequSig.empty()) {
1242  siRDp_DequSig.read();
1243  rrh_freeSpace += (ARW/8);
1244  if (DEBUG_LEVEL & TRACE_RRH) {
1245  printInfo(myName, "FreeSpace=%4d bytes\n", rrh_freeSpace.to_uint());
1246  }
1247  }
1248  if (!soRRm_DReq.full() and !soRDp_FwdCmd.full()) {
1249  soRRm_DReq.write(TcpAppRdReq(rrh_notif.sessionID, rrh_datLenReq));
1250  switch (rrh_notif.tcpDstPort) {
1251  case RECV_MODE_LSN_PORT: // 8800
1252  soRDp_FwdCmd.write(ForwardCmd(rrh_notif.sessionID, rrh_datLenReq, CMD_DROP, NOP));
1253  break;
1254  case XMIT_MODE_LSN_PORT: // 8801
1255  soRDp_FwdCmd.write(ForwardCmd(rrh_notif.sessionID, rrh_datLenReq, CMD_DROP, GEN));
1256  break;
1257  default:
1258  soRDp_FwdCmd.write(ForwardCmd(rrh_notif.sessionID, rrh_datLenReq, CMD_KEEP, NOP));
1259  break;
1260  }
1261  if (rrh_notif.tcpDatLen == 0) {
1262  rrh_fsmState = RRH_IDLE;
1263  if (DEBUG_LEVEL & TRACE_RRH) {
1264  printInfo(myName, "Done with notification (SessId=%2d | DatLen=%4d | TcpDstPort=%4d).\n",
1265  rrh_notif.sessionID.to_uint(), rrh_notif.tcpDatLen.to_uint(), rrh_notif.tcpDstPort.to_uint());
1266  }
1267  }
1268  else {
1269  rrh_fsmState = RRH_GEN_DLEN;
1270  }
1271  if (DEBUG_LEVEL & TRACE_RRH) {
1272  printInfo(myName, "Sending DReq(SessId=%2d, DatLen=%4d) to SHELL (requested TcpDstPort was %4d).\n",
1273  rrh_notif.sessionID.to_uint(), rrh_datLenReq.to_uint(), rrh_notif.tcpDstPort.to_uint());
1274  }
1275  }
1276  break;
1277  }
1278 
1279  //-- ALWAYS -------------------------------------------
1280  if (!soDBG_freeSpace.full()) {
1281  soDBG_freeSpace.write(rrh_freeSpace);
1282  }
1283  else {
1284  printFatal(myName, "Cannot write soDBG_freeSpace stream...");
1285  }
1286 
1287 }
1288 
1289 
1300  CmdBit *piSHL_Enable,
1301  stream<TcpAppRdReq> &siRRh_DReq,
1302  stream<TcpAppRdReq> &soSHL_DReq)
1303 {
1304  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1305  #pragma HLS INLINE off
1306  #pragma HLS PIPELINE II=1 enable_flush
1307 
1308  if (*piSHL_Enable != 1) {
1309  return;
1310  }
1311  if (!siRRh_DReq.empty()) {
1312  pStreamDataMover(siRRh_DReq, soSHL_DReq);
1313  }
1314 }
1315 
1316 #endif
1317 
1318 
1348  CmdBit *piSHL_Enable,
1349  stream<TcpAppData> &siSHL_Data,
1350  stream<TcpAppMeta> &siSHL_Meta,
1351  stream<ForwardCmd> &siRRh_FwdCmd,
1352  stream<SockAddr> &soCOn_OpnSockReq,
1353  stream<TcpDatLen> &soCOn_TxCountReq,
1354  stream<SigBit> &soRRh_DequSig,
1355  stream<TcpAppData> &soTAF_Data,
1356  stream<TcpSessId> &soTAF_SessId,
1357  stream<TcpDatLen> &soTAF_DatLen,
1358  stream<ap_uint<32> > &soDBG_SinkCount)
1359 {
1360  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1361  #pragma HLS INLINE off
1362  #pragma HLS PIPELINE II=1 enable_flush
1363 
1364  const char *myName = concat3(THIS_NAME, "/", "RDp");
1365 
1366  //-- STATIC CONTROL VARIABLES (with RESET) ---------------------------------
1367  static enum FsmStates { RDP_IDLE=0, RDP_8801,
1368  RDP_FWD_META, RDP_FWD_STREAM,
1369  RDP_SINK_META, RDP_SINK_STREAM } \
1370  rdp_fsmState=RDP_IDLE;
1371  #pragma HLS reset variable=rdp_fsmState
1372  static ap_uint<32> rdp_sinkCnt=0;
1373  #pragma HLS reset variable=rdp_sinkCnt
1374 
1375  //-- STATIC VARIABLES ------------------------------------------------------
1376  static ForwardCmd rdp_fwdCmd;
1377  static TcpSessId rdp_sessId;
1378 
1379  //-- DYNAMIC VARIABLES -----------------------------------------------------
1380  TcpAppData appData;
1381 
1382  if (*piSHL_Enable != 1) {
1383  return;
1384  }
1385 
1386  switch (rdp_fsmState ) {
1387  case RDP_IDLE:
1388  if (!siRRh_FwdCmd.empty() and !siSHL_Meta.empty()) {
1389  siRRh_FwdCmd.read(rdp_fwdCmd);
1390  siSHL_Meta.read(rdp_sessId);
1391  if ((rdp_fwdCmd.action == CMD_KEEP) and (rdp_fwdCmd.sessId == rdp_sessId)) {
1392  rdp_fsmState = RDP_FWD_META;
1393  }
1394  else {
1395  rdp_fsmState = RDP_SINK_META;
1396  }
1397  }
1398  break;
1399  case RDP_FWD_META:
1400  if (!soTAF_SessId.full() and !soTAF_DatLen.full()) {
1401  soTAF_SessId.write(rdp_sessId);
1402  soTAF_DatLen.write(rdp_fwdCmd.datLen);
1403  if (DEBUG_LEVEL & TRACE_RDP) {
1404  printInfo(myName, "soTAF_SessId = %d \n", rdp_sessId.to_uint());
1405  printInfo(myName, "soTAF_DatLen = %d \n", rdp_fwdCmd.datLen.to_uint());
1406  }
1407  rdp_fsmState = RDP_FWD_STREAM;
1408  }
1409  break;
1410  case RDP_FWD_STREAM:
1411  if (!siSHL_Data.empty() and !soTAF_Data.full()) {
1412  siSHL_Data.read(appData);
1413  soRRh_DequSig.write(1);
1414  soTAF_Data.write(appData);
1415  if (DEBUG_LEVEL & TRACE_RDP) { printAxisRaw(myName, "soTAF_Data =", appData); }
1416  if (appData.getTLast()) {
1417  rdp_fsmState = RDP_IDLE;
1418  }
1419  }
1420  break;
1421  case RDP_SINK_META:
1422  if (rdp_fwdCmd.dropCode == GEN) {
1423  rdp_fsmState = RDP_8801;
1424  }
1425  else {
1426  rdp_fsmState = RDP_SINK_STREAM;
1427  }
1428  break;
1429  case RDP_SINK_STREAM:
1430  if (!siSHL_Data.empty()) {
1431  siSHL_Data.read(appData);
1432  soRRh_DequSig.write(1);
1433  if (DEBUG_LEVEL & TRACE_RDP) { printAxisRaw(myName, "Sink Data =", appData); }
1434  rdp_sinkCnt += appData.getLen();
1435  soDBG_SinkCount.write(rdp_sinkCnt);
1436  if (appData.getTLast()) {
1437  rdp_fsmState = RDP_IDLE;
1438  }
1439  }
1440  break;
1441  case RDP_8801:
1442  if (!siSHL_Data.empty() and !soCOn_OpnSockReq.full() and !soCOn_TxCountReq.full()) {
1443  // Extract the remote socket address and the requested #bytes to transmit
1444  siSHL_Data.read(appData);
1445  soRRh_DequSig.write(1);
1446  SockAddr sockToOpen(byteSwap32(appData.getLE_TData(31, 0)), // IP4 address
1447  byteSwap16(appData.getLE_TData(47, 32))); // TCP port
1448  TcpDatLen bytesToSend = byteSwap16(appData.getLE_TData(63, 48));
1449  soCOn_OpnSockReq.write(sockToOpen);
1450  soCOn_TxCountReq.write(bytesToSend);
1451  if (DEBUG_LEVEL & TRACE_RDP) {
1452  printInfo(myName, "Received request for Tx test mode to generate a segment of length=%d and to send it to socket:\n",
1453  bytesToSend.to_int());
1454  printSockAddr(myName, sockToOpen);
1455  }
1456  if (appData.getTLast()) {
1457  rdp_fsmState = RDP_IDLE;
1458  }
1459  else {
1460  rdp_fsmState = RDP_SINK_STREAM;
1461  }
1462  }
1463  }
1464 }
1465 
1466 
1497  CmdBit *piSHL_Enable,
1498  stream<TcpAppData> &siTAF_Data,
1499  stream<TcpSessId> &siTAF_SessId,
1500  stream<TcpDatLen> &siTAF_DatLen,
1501  stream<TcpDatLen> &siCOn_TxBytesReq,
1502  stream<SessionId> &siCOn_TxSessId,
1503  stream<TcpAppData> &soSHL_Data,
1504  stream<TcpAppSndReq> &soSHL_SndReq,
1505  stream<TcpAppSndRep> &siSHL_SndRep)
1506 {
1507  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1508  #pragma HLS INLINE off
1509  #pragma HLS PIPELINE II=1 enable_flush
1510 
1511  const char *myName = concat3(THIS_NAME, "/", "WRp");
1512 
1513  //-- STATIC CONTROL VARIABLES (with RESET) ---------------------------------
1514  static enum FsmStates { WRP_IDLE=0, WRP_RTS, WRP_RTS_REP,
1515  WRP_STREAM, WRP_TXGEN, WRP_DRAIN } \
1516  wrp_fsmState=WRP_IDLE;
1517  #pragma HLS reset variable=wrp_fsmState
1518  static enum GenChunks { CHK0=0, CHK1 } \
1519  wrp_genChunk=CHK0;
1520  #pragma HLS reset variable=wrp_genChunk
1521 
1522  //-- STATIC DATAFLOW VARIABLES ---------------------------------------------
1523  static TcpAppSndReq wrp_sendReq;
1524  static FlagBool wrp_testMode;
1525  static uint16_t wrp_retryCnt;
1526 
1527  //-- DYNAMIC VARIABLES -----------------------------------------------------
1528  TcpAppData appData;
1529 
1530  if (*piSHL_Enable != 1) {
1531  return;
1532  }
1533 
1534  switch (wrp_fsmState) {
1535  case WRP_IDLE:
1536  //-- Always give priority to the Tx test generator (for testing reasons)
1537  if (!siCOn_TxSessId.empty() and !siCOn_TxBytesReq.empty()) {
1538  siCOn_TxSessId.read(wrp_sendReq.sessId);
1539  siCOn_TxBytesReq.read(wrp_sendReq.length);
1540  if (DEBUG_LEVEL & TRACE_WRP) {
1541  printInfo(myName, "Received a Tx test request from [TSIF/COn] for sessId=%d and nrBytes=%d.\n",
1542  wrp_sendReq.sessId.to_uint(), wrp_sendReq.length.to_uint());
1543  }
1544  if (wrp_sendReq.length != 0) {
1545  wrp_testMode = true;
1546  wrp_retryCnt = 0x200;
1547  wrp_fsmState = WRP_RTS;
1548  }
1549  else {
1550  wrp_fsmState = WRP_IDLE;
1551  }
1552  }
1553  else if (!siTAF_SessId.empty() and !siTAF_DatLen.empty()) {
1554  siTAF_SessId.read(wrp_sendReq.sessId);
1555  siTAF_DatLen.read(wrp_sendReq.length);
1556  if (DEBUG_LEVEL & TRACE_WRP) {
1557  printInfo(myName, "Received a data forward request from [ROLE/TAF] for sessId=%d and nrBytes=%d.\n",
1558  wrp_sendReq.sessId.to_uint(), wrp_sendReq.length.to_uint());
1559  }
1560  if (wrp_sendReq.length != 0) {
1561  wrp_testMode = false;
1562  wrp_retryCnt = 0x200;
1563  wrp_fsmState = WRP_RTS;
1564  }
1565  }
1566  break;
1567  case WRP_RTS:
1568  if (!soSHL_SndReq.full()) {
1569  soSHL_SndReq.write(wrp_sendReq);
1570  wrp_fsmState = WRP_RTS_REP;
1571  }
1572  break;
1573  case WRP_RTS_REP:
1574  if (!siSHL_SndRep.empty()) {
1575  //-- Read the request-to-send reply and continue accordingly
1576  TcpAppSndRep appSndRep = siSHL_SndRep.read();
1577  switch (appSndRep.error) {
1578  case NO_ERROR:
1579  if (wrp_testMode) {
1580  wrp_genChunk = CHK0;
1581  wrp_fsmState = WRP_TXGEN;
1582  }
1583  else {
1584  wrp_fsmState = WRP_STREAM;
1585  }
1586  break;
1587  case NO_SPACE:
1588  printWarn(myName, "Not enough space for writing %d bytes in the Tx buffer of session #%d. Available space is %d bytes.\n",
1589  appSndRep.length.to_uint(), appSndRep.sessId.to_uint(), appSndRep.spaceLeft.to_uint());
1590  if (wrp_retryCnt) {
1591  wrp_retryCnt -= 1;
1592  wrp_fsmState = WRP_RTS;
1593  }
1594  else {
1595  if (wrp_testMode) {
1596  wrp_fsmState = WRP_IDLE;
1597  }
1598  else {
1599  wrp_fsmState = WRP_DRAIN;
1600  }
1601  }
1602  break;
1603  case NO_CONNECTION:
1604  printWarn(myName, "Attempt to write data for a session that is not established.\n");
1605  if (wrp_testMode) {
1606  wrp_fsmState = WRP_IDLE;
1607  }
1608  else {
1609  wrp_fsmState = WRP_DRAIN;
1610  }
1611  break;
1612  default:
1613  printFatal(myName, "Received unknown TCP request to send reply from [TOE].\n");
1614  wrp_fsmState = WRP_IDLE;
1615  break;
1616  }
1617  }
1618  break;
1619  case WRP_STREAM:
1620  if (!siTAF_Data.empty() and !soSHL_Data.full()) {
1621  siTAF_Data.read(appData);
1622  soSHL_Data.write(appData);
1623  if (DEBUG_LEVEL & TRACE_WRP) { printAxisRaw(myName, "soSHL_Data = ", appData); }
1624  if(appData.getTLast()) {
1625  wrp_fsmState = WRP_IDLE;
1626  }
1627  }
1628  break;
1629  case WRP_TXGEN:
1630  if (!soSHL_Data.full()) {
1631  TcpAppData currChunk(0,0,0);
1632  if (wrp_sendReq.length > 8) {
1633  currChunk.setLE_TKeep(0xFF);
1634  wrp_sendReq.length -= 8;
1635  }
1636  else {
1637  currChunk.setLE_TKeep(lenToLE_tKeep(wrp_sendReq.length));
1638  currChunk.setLE_TLast(TLAST);
1639  wrp_fsmState = WRP_IDLE;
1640  }
1641  switch (wrp_genChunk) {
1642  case CHK0: // Send 'Hi from '
1643  currChunk.setTData(GEN_CHK0);
1644  wrp_genChunk = CHK1;
1645  break;
1646  case CHK1: // Send 'FMKU60!\n'
1647  currChunk.setTData(GEN_CHK1);
1648  wrp_genChunk = CHK0;
1649  break;
1650  }
1651  currChunk.clearUnusedBytes();
1652  soSHL_Data.write(currChunk);
1653  if (DEBUG_LEVEL & TRACE_WRP) { printAxisRaw(myName, "soSHL_Data =", currChunk); }
1654  }
1655  break;
1656  case WRP_DRAIN:
1657  if (!siTAF_Data.empty()) {
1658  siTAF_Data.read(appData);
1659  if (DEBUG_LEVEL & TRACE_WRP) { printAxisRaw(myName, "Draining siTAF_Data =", appData); }
1660  if(appData.getTLast()) {
1661  wrp_fsmState = WRP_IDLE;
1662  }
1663  }
1664  break;
1665  } // End-of: switch
1666 
1667 }
1668 
1669 
1692 
1693  //------------------------------------------------------
1694  //-- SHELL / Mmio Interface
1695  //------------------------------------------------------
1696  CmdBit *piSHL_Mmio_En,
1697 
1698  //------------------------------------------------------
1699  //-- TAF / TxP Data Interface
1700  //------------------------------------------------------
1701  stream<TcpAppData> &siTAF_Data,
1702  stream<TcpSessId> &siTAF_SessId,
1703  stream<TcpDatLen> &siTAF_DatLen,
1704 
1705  //------------------------------------------------------
1706  //-- TAF / RxP Data Interface
1707  //------------------------------------------------------
1708  stream<TcpAppData> &soTAF_Data,
1709  stream<TcpSessId> &soTAF_SessId,
1710  stream<TcpDatLen> &soTAF_DatLen,
1711 
1712  //------------------------------------------------------
1713  //-- SHELL / Rx Data Interfaces
1714  //------------------------------------------------------
1715  stream<TcpAppNotif> &siSHL_Notif,
1716  stream<TcpAppRdReq> &soSHL_DReq,
1717  stream<TcpAppData> &siSHL_Data,
1718  stream<TcpAppMeta> &siSHL_Meta,
1719 
1720  //------------------------------------------------------
1721  //-- SHELL / Listen Interfaces
1722  //------------------------------------------------------
1723  stream<TcpAppLsnReq> &soSHL_LsnReq,
1724  stream<TcpAppLsnRep> &siSHL_LsnRep,
1725 
1726  //------------------------------------------------------
1727  //-- SHELL / Tx Data Interfaces
1728  //------------------------------------------------------
1729  stream<TcpAppData> &soSHL_Data,
1730  stream<TcpAppSndReq> &soSHL_SndReq,
1731  stream<TcpAppSndRep> &siSHL_SndRep,
1732 
1733  //------------------------------------------------------
1734  //-- SHELL / Tx Open Interfaces
1735  //------------------------------------------------------
1736  stream<TcpAppOpnReq> &soSHL_OpnReq,
1737  stream<TcpAppOpnRep> &siSHL_OpnRep,
1738 
1739  //------------------------------------------------------
1740  //-- SHELL / Close Interfaces
1741  //------------------------------------------------------
1742  stream<TcpAppClsReq> &soSHL_ClsReq,
1743 
1744  //------------------------------------------------------
1745  //-- DEBUG Probes
1746  //------------------------------------------------------
1747  stream<ap_uint<32> > &soDBG_SinkCnt,
1748  stream<ap_uint<16> > &soDBG_InpBufSpace)
1749 {
1750  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
1751  #pragma HLS DATAFLOW
1752  #pragma HLS INLINE
1753  #pragma HLS INTERFACE ap_ctrl_none port=return
1754 
1755  //--------------------------------------------------------------------------
1756  //-- LOCAL STREAMS (Sorted by the name of the modules which generate them)
1757  //--------------------------------------------------------------------------
1758 
1759  //-- Input Read Buffer (IRb)
1760  static stream<TcpAppData> ssIRbToRDp_Data ("ssIRbToRDp_Data");
1761  #pragma HLS stream variable=ssIRbToRDp_Data depth=cDepth_IRbToRDp_Data
1762  static stream<TcpAppMeta> ssIRbToRDp_Meta ("ssIRbToRDp_Meta");
1763  #pragma HLS stream variable=ssIRbToRDp_Meta depth=cDepth_IRbToRDp_Meta
1764 
1765  //-- Read Notification Handler (RNh)
1766  static stream <TcpAppNotif> ssRNhToRRh_Notif ("ssRNhToRRh_Notif");
1767  #pragma HLS stream variable=ssRNhToRRh_Notif depth=cDepth_RNhToRRh_Notif
1768 
1769  //-- Read Request Handler (RRh)
1770  static stream<ForwardCmd> ssRRhToRDp_FwdCmd ("ssRRhToRDp_FwdCmd");
1771  #pragma HLS stream variable=ssRRhToRDp_FwdCmd depth=cDepth_RRhToRDp_FwdCmd
1772  #pragma HLS DATA_PACK variable=ssRRhToRDp_FwdCmd
1773  static stream<TcpAppRdReq> ssRRhToRRm_DReq ("ssRRhToRRm_DReq");
1774  #pragma HLS stream variable=ssRRhToRRm_DReq depth=cDepth_RRhToRRm_DReq
1775 
1776  //-- Read Path (RDp)
1777  static stream<SigBit> ssRDpToRRh_Dequeue ("ssRDpToRRh_Dequeue");
1778  #pragma HLS stream variable=ssRDpToRRh_Dequeue depth=cDepth_RDpToRRh_Dequeue
1779  static stream<SockAddr> ssRDpToCOn_OpnSockReq ("ssRDpToCOn_OpnSockReq");
1780  #pragma HLS stream variable=ssRDpToCOn_OpnSockReq depth=cDepth_RDpToCOn_OpnSockReq
1781  static stream<TcpDatLen> ssRDpToCOn_TxCountReq ("ssRDpToCOn_TxCountReq");
1782  #pragma HLS stream variable=ssRDpToCOn_TxCountReq depth=cDepth_RDpToCOn_TxCountReq
1783 
1784  //-- Connect (COn)
1785  static stream<TcpDatLen> ssCOnToWRp_TxBytesReq ("ssCOnToWRp_TxBytesReq");
1786  #pragma HLS stream variable=ssCOnToWRp_TxBytesReq depth=cDepth_COnToWRp_TxBytesReq
1787  static stream<SessionId> ssCOnToWRp_TxSessId ("ssCOnToWRp_TxSessId");
1788  #pragma HLS stream variable=ssCOnToWRp_TxSessId depth=cDepth_COnToWRp_TxSessId
1789 
1790  //-- PROCESS FUNCTIONS -----------------------------------------------------
1791  pConnect(
1792  piSHL_Mmio_En,
1793  ssRDpToCOn_OpnSockReq,
1794  ssRDpToCOn_TxCountReq,
1795  ssCOnToWRp_TxBytesReq,
1796  ssCOnToWRp_TxSessId,
1797  soSHL_OpnReq,
1798  siSHL_OpnRep,
1799  soSHL_ClsReq);
1800 
1801  pListen(
1802  piSHL_Mmio_En,
1803  soSHL_LsnReq,
1804  siSHL_LsnRep);
1805 
1807  piSHL_Mmio_En,
1808  siSHL_Data,
1809  siSHL_Meta,
1810  ssIRbToRDp_Data,
1811  ssIRbToRDp_Meta);
1812 
1813  pReadPath(
1814  piSHL_Mmio_En,
1815  ssIRbToRDp_Data,
1816  ssIRbToRDp_Meta,
1817  ssRRhToRDp_FwdCmd,
1818  ssRDpToCOn_OpnSockReq,
1819  ssRDpToCOn_TxCountReq,
1820  ssRDpToRRh_Dequeue,
1821  soTAF_Data,
1822  soTAF_SessId,
1823  soTAF_DatLen,
1824  soDBG_SinkCnt);
1825 
1827  piSHL_Mmio_En,
1828  siSHL_Notif,
1829  ssRNhToRRh_Notif);
1830 
1831  #if defined USE_INTERRUPTS
1833  siSHL_Notif,
1834  ssIRbToRRh_Enqueue,
1835  ssRDpToRRh_Dequeue,
1836  soSHL_DReq,
1837  ssRRhToRDp_FwdCmd);
1838 
1839  #else
1841  piSHL_Mmio_En,
1842  ssRNhToRRh_Notif,
1843  ssRDpToRRh_Dequeue,
1844  ssRRhToRRm_DReq,
1845  ssRRhToRDp_FwdCmd,
1846  soDBG_InpBufSpace);
1847 
1849  piSHL_Mmio_En,
1850  ssRRhToRRm_DReq,
1851  soSHL_DReq);
1852 
1853  pWritePath(
1854  piSHL_Mmio_En,
1855  siTAF_Data,
1856  siTAF_SessId,
1857  siTAF_DatLen,
1858  ssCOnToWRp_TxBytesReq,
1859  ssCOnToWRp_TxSessId,
1860  soSHL_Data,
1861  soSHL_SndReq,
1862  siSHL_SndRep);
1863 
1864  #endif
1865 }
1866 
tLast getTLast() const
Definition: AxisRaw.hpp:219
void clearUnusedBytes()
Definition: AxisRaw.hpp:391
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
Definition: AxisRaw.hpp:260
void setLE_TLast(LE_tLast last)
Definition: AxisRaw.hpp:280
int getLen() const
Definition: AxisRaw.hpp:411
void setTData(tData data)
Definition: AxisRaw.hpp:228
void setLE_TKeep(LE_tKeep keep, int leHi=64/8-1, int leLo=0)
Definition: AxisRaw.hpp:276
SessionId sessId
DropCode dropCode
TcpDatLen datLen
TcpDatLen byteCnt
InterruptEntry entry
SessionId sessId
SessionId sessionID
Definition: nts.hpp:89
TcpPort tcpDstPort
Definition: nts.hpp:93
TcpDatLen tcpDatLen
Definition: nts.hpp:90
SessionId sessId
Definition: nts.hpp:167
TcpState tcpState
Definition: nts.hpp:168
TcpDatLen spaceLeft
Definition: nts.hpp:144
SessionId sessId
Definition: nts.hpp:142
TcpAppSndErr error
Definition: nts.hpp:145
TcpDatLen length
Definition: nts.hpp:143
TcpDatLen length
Definition: nts.hpp:130
SessionId sessId
Definition: nts.hpp:129
@ LSN_IDLE
Definition: nal.hpp:146
@ LSN_SEND_REQ
Definition: nal.hpp:146
@ LSN_DONE
Definition: nal.hpp:146
ap_uint< 16 > SessionId
Definition: nts_types.hpp:136
#define printError(callerName, format,...)
A macro to print an error message.
Definition: nts_utils.hpp:195
LE_tKeep lenToLE_tKeep(ap_uint< 4 > noValidBytes)
A function to set a number of '1' in an 8-bit field. It is used here to set the number of valid bytes...
Definition: nts_utils.cpp:307
void printAxisRaw(const char *callerName, AxisRaw chunk)
Prints an Axis raw data chunk (used for debugging).
Definition: nts_utils.cpp:46
#define ARW
Definition: AxisRaw.hpp:114
ap_uint< 16 > Ly4Len
Definition: nts_types.hpp:202
RepBool TcpAppLsnRep
Definition: nts.hpp:196
void printSockAddr(const char *callerName, SockAddr sockAddr)
Print a socket address.
Definition: nts_utils.cpp:174
bool FlagBool
Definition: nts_types.hpp:124
#define CMD_DROP
Definition: nts_types.hpp:61
ap_uint< 16 > TcpPort
Definition: AxisTcp.hpp:105
ap_uint< 16 > TcpDatLen
Definition: AxisTcp.hpp:123
#define CMD_KEEP
Definition: nts_types.hpp:62
const char * getTcpStateName(TcpState tcpState)
Returns the name of an enum-based TCP-State as a user friendly string.
Definition: nts_utils.cpp:272
#define printInfo(callerName, format,...)
A macro to print an information message.
Definition: nts_utils.hpp:169
ap_uint< 1 > CmdBit
Definition: nts_types.hpp:108
#define printWarn(callerName, format,...)
A macro to print a warning message.
Definition: nts_utils.hpp:182
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
Definition: nts_utils.hpp:161
#define printFatal(callerName, format,...)
A macro to print a fatal error message and exit.
Definition: nts_utils.hpp:208
#define TLAST
Definition: AxisRaw.hpp:116
ap_uint< 16 > TcpSessId
Definition: nts_types.hpp:137
@ ESTABLISHED
Definition: nts_types.hpp:296
@ NO_ERROR
Definition: nts_types.hpp:304
@ NO_CONNECTION
Definition: nts_types.hpp:304
@ NO_SPACE
Definition: nts_types.hpp:304
void pStreamDataMover(stream< Type > &si, stream< Type > &so)
Stream Data Mover - Moves data chunks from incoming stream to outgoing stream with blocking read and ...
#define TRACE_CON
void pReadRequestMover(CmdBit *piSHL_Enable, stream< TcpAppRdReq > &siRRh_DReq, stream< TcpAppRdReq > &soSHL_DReq)
Read Request Mover (RRm)
#define GEN_CHK0
void pReadRequestHandler(CmdBit *piSHL_Enable, stream< TcpAppNotif > &siRNh_Notif, stream< SigBit > &siRDp_DequSig, stream< TcpAppRdReq > &soRRm_DReq, stream< ForwardCmd > &soRDp_FwdCmd, stream< ap_uint< 16 > > &soDBG_freeSpace)
Read Request Handler (RRh)
#define GEN_CHK1
void tcp_shell_if(CmdBit *piSHL_Mmio_En, stream< TcpAppData > &siTAF_Data, stream< TcpSessId > &siTAF_SessId, stream< TcpDatLen > &siTAF_DatLen, stream< TcpAppData > &soTAF_Data, stream< TcpSessId > &soTAF_SessId, stream< TcpDatLen > &soTAF_DatLen, stream< TcpAppNotif > &siSHL_Notif, stream< TcpAppRdReq > &soSHL_DReq, stream< TcpAppData > &siSHL_Data, stream< TcpAppMeta > &siSHL_Meta, stream< TcpAppLsnReq > &soSHL_LsnReq, stream< TcpAppLsnRep > &siSHL_LsnRep, stream< TcpAppData > &soSHL_Data, stream< TcpAppSndReq > &soSHL_SndReq, stream< TcpAppSndRep > &siSHL_SndRep, stream< TcpAppOpnReq > &soSHL_OpnReq, stream< TcpAppOpnRep > &siSHL_OpnRep, stream< TcpAppClsReq > &soSHL_ClsReq, stream< ap_uint< 32 > > &soDBG_SinkCnt, stream< ap_uint< 16 > > &soDBG_InpBufSpace)
TCP Shell Interface (TSIF)
void pConnect(CmdBit *piSHL_Enable, stream< SockAddr > &siRDp_OpnSockReq, stream< Ly4Len > &siRDp_TxCountReq, stream< Ly4Len > &soWRp_TxBytesReq, stream< SessionId > &soWRp_TxSessId, stream< TcpAppOpnReq > &soSHL_OpnReq, stream< TcpAppOpnRep > &siSHL_OpnRep, stream< TcpAppClsReq > &soSHL_ClsReq)
Connect (COn).
#define RECV_MODE_LSN_PORT
const int cMinDataReqLen
#define XMIT_MODE_LSN_PORT
void pReadPath(CmdBit *piSHL_Enable, stream< TcpAppData > &siSHL_Data, stream< TcpAppMeta > &siSHL_Meta, stream< ForwardCmd > &siRRh_FwdCmd, stream< SockAddr > &soCOn_OpnSockReq, stream< TcpDatLen > &soCOn_TxCountReq, stream< SigBit > &soRRh_DequSig, stream< TcpAppData > &soTAF_Data, stream< TcpSessId > &soTAF_SessId, stream< TcpDatLen > &soTAF_DatLen, stream< ap_uint< 32 > > &soDBG_SinkCount)
Read Path (RDp)
#define TRACE_RRH
void pWritePath(CmdBit *piSHL_Enable, stream< TcpAppData > &siTAF_Data, stream< TcpSessId > &siTAF_SessId, stream< TcpDatLen > &siTAF_DatLen, stream< TcpDatLen > &siCOn_TxBytesReq, stream< SessionId > &siCOn_TxSessId, stream< TcpAppData > &soSHL_Data, stream< TcpAppSndReq > &soSHL_SndReq, stream< TcpAppSndRep > &siSHL_SndRep)
Write Path (WRp)
bool gTraceEvent
Definition: tb_nal.cpp:151
#define ECHO_MOD2_LSN_PORT
#define THIS_NAME
#define IPERF_LSN_PORT
const int cIBuffBytes
#define IPREF3_LSN_PORT
#define TRACE_RDP
void pReadNotificationHandler(CmdBit *piSHL_Enable, stream< TcpAppNotif > &siSHL_Notif, stream< TcpAppNotif > &soRRh_Notif)
Read Notification Handler (RNh)
#define ECHO_MODE_LSN_PORT
#define DEBUG_LEVEL
#define TRACE_LSN
void pInputReadBuffer(CmdBit *piSHL_Enable, stream< TcpAppData > &siSHL_Data, stream< TcpAppMeta > &siSHL_Meta, stream< TcpAppData > &soRDp_Data, stream< TcpAppMeta > &soRDp_Meta)
Input Read Buffer (IRb)
void pListen(CmdBit *piSHL_Enable, stream< TcpAppLsnReq > &soSHL_LsnReq, stream< TcpAppLsnRep > &siSHL_LsnRep)
Listen(LSn)
#define TRACE_WRP
const int cMaxSessions
@ GEN
@ NOP
@ GET
@ POST
@ PUT
: TCP Shell Interface (TSIF)
ap_uint< 32 > byteSwap32(ap_uint< 32 > inputVector)
Definition: udp.cpp:78
ap_uint< 16 > byteSwap16(ap_uint< 16 > inputVector)
Definition: udp.cpp:82