cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
nal.hpp File Reference

: The cloudFPGA Network Abstraction Layer (NAL) between NTS and ROlE. The NAL core manages the NTS Stack and maps the network streams to the user's ROLE or the FMC while hiding some complexity of UOE and TOE. More...

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <hls_stream.h>
#include "ap_int.h"
#include <stdint.h>
#include "../../FMC/src/fmc.hpp"
#include "../../../../../hls/network.hpp"
#include "../../network_utils.hpp"
#include "../../simulation_utils.hpp"
#include "uss.hpp"
#include "tss.hpp"
#include "hss.hpp"
#include "cam8.hpp"
Include dependency graph for nal.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NalEventNotif
 
struct  NalNewTableEntry
 
struct  NalNewTcpConRep
 
struct  NalConfigUpdate
 
struct  NalMrtUpdate
 
struct  NalStatusUpdate
 
struct  NalPortUpdate
 
struct  NalWaitingData
 

Macros

#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_BASE   0x200
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH   0x3ff
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_WIDTH_CTRLLINK_V   32
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_DEPTH_CTRLLINK_V   96
 
#define NAL_CTRL_LINK_SIZE   (XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH/4)
 
#define NAL_CTRL_LINK_CONFIG_START_ADDR   (0x200/4)
 
#define NAL_CTRL_LINK_CONFIG_END_ADDR   (0x23F/4)
 
#define NAL_CTRL_LINK_STATUS_START_ADDR   (0x240/4)
 
#define NAL_CTRL_LINK_STATUS_END_ADDR   (0x27F/4)
 
#define NAL_CTRL_LINK_MRT_START_ADDR   (0x280/4)
 
#define NAL_CTRL_LINK_MRT_END_ADDR   (0x37F/4)
 
#define MAX_MRT_SIZE   64
 
#define THIS_NAME   "NAL"
 
#define TRACE_OFF   0x0000
 
#define TRACE_RDP   1 << 1
 
#define TRACE_WRP   1 << 2
 
#define TRACE_SAM   1 << 3
 
#define TRACE_LSN   1 << 4
 
#define TRACE_CON   1 << 5
 
#define TRACE_ALL   0xFFFF
 
#define DEBUG_LEVEL   (TRACE_ALL)
 
#define DEFAULT_TX_PORT   2718
 
#define DEFAULT_RX_PORT   2718
 
#define MAX_NAL_SESSIONS   (TOE_MAX_SESSIONS)
 
#define NAL_STREAMING_SPLIT_TCP   (ZYC2_MSS)
 
#define NAL_MAX_FIFO_DEPTHS_BYTES   2000
 
#define NUMBER_CONFIG_WORDS   16
 
#define NUMBER_STATUS_WORDS   16
 
#define NAL_NUMBER_CONFIG_WORDS   NUMBER_CONFIG_WORDS
 
#define NAL_NUMBER_STATUS_WORDS   NUMBER_STATUS_WORDS
 
#define NAL_CONNECTION_TIMEOUT   160000000
 
#define NAL_TCP_RX_DATA_DELAY_CYCLES   80
 
#define NAL_MMIO_STABILIZE_TIME   150
 
#define UNUSED_TABLE_ENTRY_VALUE   0x111000
 
#define UNUSED_SESSION_ENTRY_VALUE   0xFFFE
 
#define INVALID_MRT_VALUE   0xFFFFF
 
#define NAL_CONFIG_OWN_RANK   0
 
#define NAL_CONFIG_MRT_VERSION   1
 
#define NAL_CONFIG_SAVED_UDP_PORTS   2
 
#define NAL_CONFIG_SAVED_TCP_PORTS   3
 
#define NAL_CONFIG_SAVED_FMC_PORTS   4
 
#define NAL_STATUS_MRT_VERSION   0
 
#define NAL_STATUS_OPEN_UDP_PORTS   1
 
#define NAL_STATUS_OPEN_TCP_PORTS   2
 
#define NAL_STATUS_FMC_PORT_PROCESSED   3
 
#define NAL_STATUS_OWN_RANK   13
 
#define NAL_UNAUTHORIZED_ACCESS   4
 
#define NAL_AUTHORIZED_ACCESS   5
 
#define NAL_STATUS_SEND_STATE   6
 
#define NAL_STATUS_RECEIVE_STATE   7
 
#define NAL_STATUS_GLOBAL_STATE   8
 
#define NAL_STATUS_LAST_RX_NODE_ID   9
 
#define NAL_STATUS_RX_NODEID_ERROR   10
 
#define NAL_STATUS_LAST_TX_NODE_ID   11
 
#define NAL_STATUS_TX_NODEID_ERROR   12
 
#define NAL_STATUS_PACKET_CNT_RX   14
 
#define NAL_STATUS_PACKET_CNT_TX   15
 

Typedefs

typedef bool StsBool
 
typedef ap_uint< 16 > UdpSrcPort
 
typedef ap_uint< 16 > UdpDstPort
 
typedef ap_uint< 16 > UdpPort
 
typedef ap_uint< 16 > UdpLen
 
typedef UdpLen UdpAppDLen
 
typedef UdpAppDLen UdpPLen
 
typedef ap_uint< 16 > PacketLen
 
typedef ap_uint< 64 > NalTriple
 

Enumerations

enum  DropCmd { KEEP_CMD =false , DROP_CMD , KEEP_CMD =false , DROP_CMD }
 
enum  FsmStateUdp {
  FSM_RESET = 0 , FSM_W8FORMETA , FSM_W8FORREQS , FSM_FIRST_ACC ,
  FSM_ACC , FSM_WRITE_META , FSM_DROP_PACKET
}
 
enum  OpnFsmStates { OPN_IDLE = 0 , OPN_REQ , OPN_REP , OPN_DONE }
 
enum  LsnFsmStates { LSN_IDLE = 0 , LSN_SEND_REQ , LSN_WAIT_ACK , LSN_DONE }
 
enum  RrhFsmStates {
  RRH_RESET = 0 , RRH_WAIT_NOTIF , RRH_PROCESS_NOTIF , RRH_START_REQUEST ,
  RRH_PROCESS_REQUEST , RRH_WAIT_FMC , RRH_WAIT_ROLE , RRH_DRAIN
}
 
enum  RrhEnqFsmStates { RRH_ENQ_RESET = 0 , RRH_ENQ_STREAM }
 
enum  RdpFsmStates {
  RDP_RESET = 0 , RDP_WAIT_META , RDP_W8FORREQS_1 , RDP_W8FORREQS_2 ,
  RDP_FILTER_META , RDP_STREAM_ROLE , RDP_STREAM_FMC , RDP_WRITE_META_ROLE ,
  RDP_WRITE_META_FMC , RDP_DROP_PACKET
}
 
enum  WrpFsmStates {
  WRP_RESET = 0 , WRP_WAIT_META , WRP_STREAM_FMC , WRP_W8FORREQS_1 ,
  WRP_W8FORREQS_11 , WRP_W8FORREQS_2 , WRP_W8FORREQS_22 , WRP_WAIT_CONNECTION ,
  WRP_STREAM_ROLE , WRP_DROP_PACKET
}
 
enum  WbuFsmStates {
  WBU_WAIT_META = 0 , WBU_SND_REQ , WBU_WAIT_REP , WBU_STREAM ,
  WBU_DROP , WBU_DRAIN
}
 
enum  CacheInvalFsmStates {
  CACHE_WAIT_FOR_VALID = 0 , CACHE_VALID , CACHE_INV_SEND_0 , CACHE_INV_SEND_1 ,
  CACHE_INV_SEND_2 , CACHE_INV_SEND_3
}
 
enum  ClsFsmStates { CLS_IDLE = 0 , CLS_NEXT , CLS_WAIT4RESP }
 
enum  DeqFsmStates { DEQ_WAIT_META = 0 , DEQ_STREAM_DATA , DEQ_SEND_NOTIF }
 
enum  TableFsmStates { TAB_FSM_READ = 0 , TAB_FSM_WRITE }
 
enum  AxiLiteFsmStates {
  A4L_RESET = 0 , A4L_STATUS_UPDATE , A4L_COPY_CONFIG , A4L_COPY_CONFIG_2 ,
  A4L_COPY_MRT , A4L_COPY_STATUS , A4L_COPY_FINISH , A4L_WAIT_FOR_SUB_FSMS
}
 
enum  ConfigBcastStates {
  CB_WAIT = 0 , CB_START , CB_1 , CB_2 ,
  CB_3_0 , CB_3_1 , CB_3_2
}
 
enum  PortFsmStates {
  PORT_RESET = 0 , PORT_IDLE , PORT_L4_RESET , PORT_NEW_UDP_REQ ,
  PORT_NEW_UDP_REP , PORT_NEW_FMC_REQ , PORT_NEW_FMC_REP , PORT_NEW_TCP_REQ ,
  PORT_NEW_TCP_REP , PORT_L7_RESET , PORT_WAIT_PR , PORT_START_TCP_CLS_0 ,
  PORT_START_TCP_CLS_1 , PORT_START_TCP_CLS_2 , PORT_START_UDP_CLS , PORT_SEND_UPDATE
}
 
enum  PortType { FMC = 0 , UDP , TCP }
 
enum  NalCntIncType {
  NID_MISS_RX = 0 , NID_MISS_TX , PCOR_TX , TCP_CON_FAIL ,
  LAST_RX_PORT , LAST_RX_NID , LAST_TX_PORT , LAST_TX_NID ,
  PACKET_RX , PACKET_TX , UNAUTH_ACCESS , AUTH_ACCESS ,
  FMC_TCP_BYTES
}
 

Functions

ap_uint< 32 > getRightmostBitPos (ap_uint< 32 > num)
 
NalTriple newTriple (Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
 
Ip4Addr getRemoteIpAddrFromTriple (NalTriple triple)
 
TcpPort getRemotePortFromTriple (NalTriple triple)
 
TcpPort getLocalPortFromTriple (NalTriple triple)
 
uint8_t extractByteCnt (AxisRaw currWord)
 
uint8_t extractByteCnt (NetworkWord currWord)
 
void nal_main (ap_uint< 32 > ctrlLink[64+16+16], ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, ap_uint< 1 > *piNTS_ready, ap_uint< 16 > *piMMIO_FmcLsnPort, ap_uint< 32 > *piMMIO_CfrmIp4Addr, ap_uint< 32 > *myIpAddress, ap_uint< 32 > *pi_udp_rx_ports, stream< NetworkWord > &siUdp_data, stream< NetworkWord > &soUdp_data, stream< NetworkMetaStream > &siUdp_meta, stream< NetworkMetaStream > &soUdp_meta, ap_uint< 32 > *pi_tcp_rx_ports, stream< NetworkWord > &siTcp_data, stream< NetworkMetaStream > &siTcp_meta, stream< NetworkWord > &soTcp_data, stream< NetworkMetaStream > &soTcp_meta, stream< NetworkWord > &siFMC_data, stream< TcpSessId > &siFMC_SessId, stream< NetworkWord > &soFMC_data, stream< TcpSessId > &soFMC_SessId, stream< UdpPort > &soUOE_LsnReq, stream< StsBool > &siUOE_LsnRep, stream< UdpPort > &soUOE_ClsReq, stream< StsBool > &siUOE_ClsRep, stream< UdpAppData > &siUOE_Data, stream< UdpAppMeta > &siUOE_Meta, stream< UdpAppDLen > &siUOE_DLen, stream< UdpAppData > &soUOE_Data, stream< UdpAppMeta > &soUOE_Meta, stream< UdpAppDLen > &soUOE_DLen, stream< TcpAppNotif > &siTOE_Notif, stream< TcpAppRdReq > &soTOE_DReq, stream< TcpAppData > &siTOE_Data, stream< TcpAppMeta > &siTOE_SessId, stream< TcpAppLsnReq > &soTOE_LsnReq, stream< TcpAppLsnRep > &siTOE_LsnRep, stream< TcpAppData > &soTOE_Data, stream< TcpAppSndReq > &soTOE_SndReq, stream< TcpAppSndRep > &siTOE_SndRep, stream< TcpAppOpnReq > &soTOE_OpnReq, stream< TcpAppOpnRep > &siTOE_OpnRep, stream< TcpAppClsReq > &soTOE_ClsReq)
 Main process of the Network Abstraction Layer (NAL) More...
 

Variables

bool gTraceEvent
 

Detailed Description

: The cloudFPGA Network Abstraction Layer (NAL) between NTS and ROlE. The NAL core manages the NTS Stack and maps the network streams to the user's ROLE or the FMC while hiding some complexity of UOE and TOE.

Copyright 2016 – 2021 IBM Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

System: : cloudFPGA Component : Shell, Network Abstraction Layer (NAL) Language : Vivado HLS

Definition in file nal.hpp.