diff options
Diffstat (limited to 'src/stateless/cp')
-rw-r--r-- | src/stateless/cp/trex_stateless.cpp | 4 | ||||
-rw-r--r-- | src/stateless/cp/trex_stateless.h | 2 | ||||
-rw-r--r-- | src/stateless/cp/trex_stateless_port.cpp | 11 | ||||
-rw-r--r-- | src/stateless/cp/trex_stateless_port.h | 2 |
4 files changed, 9 insertions, 10 deletions
diff --git a/src/stateless/cp/trex_stateless.cpp b/src/stateless/cp/trex_stateless.cpp index 22389d6a..6029cbd5 100644 --- a/src/stateless/cp/trex_stateless.cpp +++ b/src/stateless/cp/trex_stateless.cpp @@ -152,10 +152,8 @@ TrexStateless::get_dp_core_count() { void TrexStateless::encode_stats(Json::Value &global) { - const TrexPlatformApi *api = get_stateless_obj()->get_platform_api(); - TrexPlatformGlobalStats stats; - api->get_global_stats(stats); + m_platform_api->get_global_stats(stats); global["cpu_util"] = stats.m_stats.m_cpu_util; global["rx_cpu_util"] = stats.m_stats.m_rx_cpu_util; diff --git a/src/stateless/cp/trex_stateless.h b/src/stateless/cp/trex_stateless.h index 070cd6de..3a1a2c24 100644 --- a/src/stateless/cp/trex_stateless.h +++ b/src/stateless/cp/trex_stateless.h @@ -91,7 +91,7 @@ public: } const TrexRpcServerConfig *m_rpc_req_resp_cfg; - TrexPlatformApi *m_platform_api; + const TrexPlatformApi *m_platform_api; bool m_rpc_server_verbose; uint8_t m_port_count; TrexPublisher *m_publisher; diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp index 53a225f6..9bb20990 100644 --- a/src/stateless/cp/trex_stateless_port.cpp +++ b/src/stateless/cp/trex_stateless_port.cpp @@ -153,11 +153,12 @@ private: * trex stateless port * **************************/ -TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api) : platform_api(api), m_dp_events(this) { +TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api) : m_dp_events(this) { std::vector<std::pair<uint8_t, uint8_t>> core_pair_list; m_port_id = port_id; m_port_state = PORT_STATE_IDLE; + m_platform_api = api; /* get the platform specific data */ api->get_interface_info(port_id, m_api_info); @@ -253,7 +254,7 @@ TrexStatelessPort::start_traffic(const TrexPortMultiplier &mul, double duration, assert(mul.m_op == TrexPortMultiplier::OP_ABS); /* check link state */ - if ( !platform_api->getPortAttrObj()->is_link_up(m_port_id) && !force ) { + if ( !m_platform_api->getPortAttrObj(m_port_id)->is_link_up() && !force ) { throw TrexException("Link state is DOWN."); } @@ -586,7 +587,7 @@ void TrexStatelessPort::get_properties(std::string &driver, uint32_t &speed) { driver = m_api_info.driver_name; - speed = platform_api->getPortAttrObj()->get_link_speed(m_port_id); + speed = m_platform_api->getPortAttrObj(m_port_id)->get_link_speed(); } bool @@ -615,7 +616,7 @@ void TrexStatelessPort::encode_stats(Json::Value &port) { TrexPlatformInterfaceStats stats; - platform_api->get_interface_stats(m_port_id, stats); + m_platform_api->get_interface_stats(m_port_id, stats); port["tx_bps"] = stats.m_stats.m_tx_bps; port["rx_bps"] = stats.m_stats.m_rx_bps; @@ -667,7 +668,7 @@ TrexStatelessPort::send_message_to_rx(TrexStatelessCpToRxMsgBase *msg) { uint64_t TrexStatelessPort::get_port_speed_bps() const { - return (uint64_t) platform_api->getPortAttrObj()->get_link_speed(m_port_id) * 1000 * 1000; + return (uint64_t) m_platform_api->getPortAttrObj(m_port_id)->get_link_speed() * 1000 * 1000; } static inline double diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h index 00139973..e2a2aeba 100644 --- a/src/stateless/cp/trex_stateless_port.h +++ b/src/stateless/cp/trex_stateless_port.h @@ -435,7 +435,7 @@ private: port_state_e m_port_state; TrexPlatformApi::intf_info_st m_api_info; - const TrexPlatformApi *platform_api; + const TrexPlatformApi *m_platform_api; uint16_t m_rx_count_num; uint16_t m_rx_caps; |