Skip to content
Snippets Groups Projects
Commit 0df3eb3a authored by David Sidler's avatar David Sidler
Browse files

introducing response buffer to support up to 1024 connections

parent 0c774c1a
No related branches found
No related tags found
No related merge requests found
/************************************************ /************************************************
Copyright (c) 2018, Systems Group, ETH Zurich. Copyright (c) 2019, Systems Group, ETH Zurich.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
...@@ -30,15 +30,29 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -30,15 +30,29 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "iperf_client.hpp" #include "iperf_client.hpp"
#include <iostream> #include <iostream>
//Buffers responses coming from the TCP stack
void status_handler(hls::stream<appTxRsp>& txStatus,
hls::stream<internalAppTxRsp>& txStatusBuffer)
{
#pragma HLS PIPELINE II=1
#pragma HLS INLINE off
if (!txStatus.empty())
{
appTxRsp resp = txStatus.read();
txStatusBuffer.write(internalAppTxRsp(resp.sessionID, resp.error));
}
}
template <int WIDTH> template <int WIDTH>
void client( stream<ipTuple>& openConnection, void client(hls::stream<ipTuple>& openConnection,
stream<openStatus>& openConStatus, hls::stream<openStatus>& openConStatus,
stream<ap_uint<16> >& closeConnection, hls::stream<ap_uint<16> >& closeConnection,
stream<appTxMeta>& txMetaData, hls::stream<appTxMeta>& txMetaData,
stream<net_axis<WIDTH> >& txData, hls::stream<net_axis<WIDTH> >& txData,
stream<appTxRsp>& txStatus, hls::stream<internalAppTxRsp>& txStatus,
stream<bool>& startSignal, hls::stream<bool>& startSignal,
stream<bool>& stopSignal, hls::stream<bool>& stopSignal,
ap_uint<1> runExperiment, ap_uint<1> runExperiment,
ap_uint<1> dualModeEn, ap_uint<1> dualModeEn,
ap_uint<14> useConn, ap_uint<14> useConn,
...@@ -178,7 +192,7 @@ void client( stream<ipTuple>& openConnection, ...@@ -178,7 +192,7 @@ void client( stream<ipTuple>& openConnection,
} }
else if (!txStatus.empty()) else if (!txStatus.empty())
{ {
appTxRsp resp = txStatus.read(); internalAppTxRsp resp = txStatus.read();
if (resp.error == 0) if (resp.error == 0)
{ {
currentSessionID = resp.sessionID; currentSessionID = resp.sessionID;
...@@ -226,7 +240,7 @@ void client( stream<ipTuple>& openConnection, ...@@ -226,7 +240,7 @@ void client( stream<ipTuple>& openConnection,
case CHECK_REQ: case CHECK_REQ:
if (!txStatus.empty()) if (!txStatus.empty())
{ {
appTxRsp resp = txStatus.read(); internalAppTxRsp resp = txStatus.read();
if (resp.error == 0) if (resp.error == 0)
{ {
currentSessionID = resp.sessionID; currentSessionID = resp.sessionID;
...@@ -428,18 +442,18 @@ void clock( hls::stream<bool>& startSignal, ...@@ -428,18 +442,18 @@ void clock( hls::stream<bool>& startSignal,
} }
void iperf_client( stream<ap_uint<16> >& listenPort, void iperf_client( hls::stream<ap_uint<16> >& listenPort,
stream<bool>& listenPortStatus, hls::stream<bool>& listenPortStatus,
stream<appNotification>& notifications, hls::stream<appNotification>& notifications,
stream<appReadRequest>& readRequest, hls::stream<appReadRequest>& readRequest,
stream<ap_uint<16> >& rxMetaData, hls::stream<ap_uint<16> >& rxMetaData,
stream<net_axis<DATA_WIDTH> >& rxData, hls::stream<net_axis<DATA_WIDTH> >& rxData,
stream<ipTuple>& openConnection, hls::stream<ipTuple>& openConnection,
stream<openStatus>& openConStatus, hls::stream<openStatus>& openConStatus,
stream<ap_uint<16> >& closeConnection, hls::stream<ap_uint<16> >& closeConnection,
stream<appTxMeta>& txMetaData, hls::stream<appTxMeta>& txMetaData,
stream<net_axis<DATA_WIDTH> >& txData, hls::stream<net_axis<DATA_WIDTH> >& txData,
stream<appTxRsp>& txStatus, hls::stream<appTxRsp>& txStatus,
ap_uint<1> runExperiment, ap_uint<1> runExperiment,
ap_uint<1> dualModeEn, ap_uint<1> dualModeEn,
ap_uint<14> useConn, ap_uint<14> useConn,
...@@ -509,15 +523,21 @@ void iperf_client( stream<ap_uint<16> >& listenPort, ...@@ -509,15 +523,21 @@ void iperf_client( stream<ap_uint<16> >& listenPort,
#pragma HLS STREAM variable=startSignalFifo depth=2 #pragma HLS STREAM variable=startSignalFifo depth=2
#pragma HLS STREAM variable=stopSignalFifo depth=2 #pragma HLS STREAM variable=stopSignalFifo depth=2
//This is required to buffer up to 1024 reponses => supporting up to 1024 connections
static hls::stream<internalAppTxRsp> txStatusBuffer("txStatusBuffer");
#pragma HLS STREAM variable=txStatusBuffer depth=1024
/* /*
* Client * Client
*/ */
status_handler(txStatus, txStatusBuffer);
client<DATA_WIDTH>( openConnection, client<DATA_WIDTH>( openConnection,
openConStatus, openConStatus,
closeConnection, closeConnection,
txMetaData, txMetaData,
txData, txData,
txStatus, txStatusBuffer,
startSignalFifo, startSignalFifo,
stopSignalFifo, stopSignalFifo,
runExperiment, runExperiment,
......
/************************************************ /************************************************
Copyright (c) 2018, Systems Group, ETH Zurich. Copyright (c) 2019, Systems Group, ETH Zurich.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
...@@ -82,6 +82,15 @@ public: ...@@ -82,6 +82,15 @@ public:
} }
}; };
struct internalAppTxRsp
{
ap_uint<16> sessionID;
ap_uint<2> error;
internalAppTxRsp() {}
internalAppTxRsp(ap_uint<16> id, ap_uint<2> err)
:sessionID(id), error(err) {}
};
void iperf_client( hls::stream<ap_uint<16> >& listenPort, void iperf_client( hls::stream<ap_uint<16> >& listenPort,
hls::stream<bool>& listenPortStatus, hls::stream<bool>& listenPortStatus,
hls::stream<appNotification>& notifications, hls::stream<appNotification>& notifications,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment