diff options
author | imarom <imarom@cisco.com> | 2015-08-31 17:26:08 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-08-31 17:26:08 +0300 |
commit | 40461a9752437ee541d797f76d2fba77cad9d0e2 (patch) | |
tree | 4ff731920ccd25a0fa5080a4553f0300d49db7a8 /src/stateless | |
parent | 499b4d6221c023d656663fe441bbf5d194886efb (diff) |
...draft...
Diffstat (limited to 'src/stateless')
-rw-r--r-- | src/stateless/trex_stream.cpp | 26 | ||||
-rw-r--r-- | src/stateless/trex_stream_api.h | 67 |
2 files changed, 62 insertions, 31 deletions
diff --git a/src/stateless/trex_stream.cpp b/src/stateless/trex_stream.cpp index 09d2b662..1a78ab34 100644 --- a/src/stateless/trex_stream.cpp +++ b/src/stateless/trex_stream.cpp @@ -24,13 +24,25 @@ limitations under the License. /************************************** * stream *************************************/ -TrexStream::TrexStream() { - pkt = NULL; +TrexStream::TrexStream(uint8_t port_id, uint32_t stream_id) : m_port_id(port_id), m_stream_id(stream_id) { + + /* default values */ + m_isg_usec = 0; + m_next_stream_id = -1; + m_loop_count = 0; + m_enable = false; + m_start = false; + + m_pkt = NULL; + m_pkt_len = 0; + + m_rx_check.m_enable = false; + } TrexStream::~TrexStream() { - if (pkt) { - delete [] pkt; + if (m_pkt) { + delete [] m_pkt; } } @@ -48,17 +60,17 @@ TrexStreamTable::~TrexStreamTable() { } void TrexStreamTable::add_stream(TrexStream *stream) { - TrexStream *old_stream = get_stream_by_id(stream->stream_id); + TrexStream *old_stream = get_stream_by_id(stream->m_stream_id); if (old_stream) { remove_stream(old_stream); delete old_stream; } - m_stream_table[stream->stream_id] = stream; + m_stream_table[stream->m_stream_id] = stream; } void TrexStreamTable::remove_stream(TrexStream *stream) { - m_stream_table.erase(stream->stream_id); + m_stream_table.erase(stream->m_stream_id); } TrexStream * TrexStreamTable::get_stream_by_id(uint32_t stream_id) { diff --git a/src/stateless/trex_stream_api.h b/src/stateless/trex_stream_api.h index ab7a8f26..7ae25c6e 100644 --- a/src/stateless/trex_stream_api.h +++ b/src/stateless/trex_stream_api.h @@ -36,38 +36,41 @@ class TrexStream { friend class TrexStreamTable; public: - TrexStream(); + TrexStream(uint8_t port_id, uint32_t stream_id); virtual ~TrexStream() = 0; - static const uint32_t MIN_PKT_SIZE_BYTES = 64; + static const uint32_t MIN_PKT_SIZE_BYTES = 1; static const uint32_t MAX_PKT_SIZE_BYTES = 9000; private: - /* config */ - uint32_t stream_id; - uint8_t port_id; - double isg_usec; - uint32_t next_stream_id; - uint32_t loop_count; + /* basic */ + uint8_t m_port_id; + uint32_t m_stream_id; + + + /* config fields */ + double m_isg_usec; + uint32_t m_next_stream_id; + uint32_t m_loop_count; /* indicators */ - bool enable; - bool start; + bool m_enable; + bool m_start; /* pkt */ - uint8_t *pkt; - uint16_t pkt_len; + uint8_t *m_pkt; + uint16_t m_pkt_len; /* VM */ /* RX check */ struct { - bool enable; - bool seq_enable; - bool latency; - uint32_t stream_id; + bool m_enable; + bool m_seq_enable; + bool m_latency; + uint32_t m_stream_id; - } rx_check; + } m_rx_check; }; @@ -76,8 +79,11 @@ private: * */ class TrexStreamContinuous : public TrexStream { +public: + TrexStreamContinuous(uint8_t port_id, uint32_t stream_id, uint32_t pps) : TrexStream(port_id, stream_id), m_pps(pps) { + } protected: - uint32_t pps; + uint32_t m_pps; }; /** @@ -85,9 +91,13 @@ protected: * */ class TrexStreamSingleBurst : public TrexStream { +public: + TrexStreamSingleBurst(uint8_t port_id, uint32_t stream_id, uint32_t packets, uint32_t pps) : TrexStream(port_id, stream_id), m_pps(pps), m_packets(packets) { + } protected: - uint32_t packets; - uint32_t pps; + uint32_t m_pps; + uint32_t m_packets; + }; /** @@ -95,11 +105,20 @@ protected: * */ class TrexStreamMultiBurst : public TrexStream { +public: + TrexStreamMultiBurst(uint8_t port_id, + uint32_t stream_id, + uint32_t pps, + double ibg_usec, + uint32_t pkts_per_burst, + uint32_t num_bursts) : TrexStream(port_id, stream_id), m_pps(pps), m_ibg_usec(ibg_usec), m_num_bursts(num_bursts), m_pkts_per_burst(pkts_per_burst) { + + } protected: - uint32_t pps; - double ibg_usec; - uint32_t number_of_bursts; - uint32_t pkts_per_burst; + uint32_t m_pps; + double m_ibg_usec; + uint32_t m_num_bursts; + uint32_t m_pkts_per_burst; }; /** |