summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stateless/cp')
-rw-r--r--src/stateless/cp/trex_stateless.h14
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp22
-rw-r--r--src/stateless/cp/trex_stateless_port.h9
3 files changed, 18 insertions, 27 deletions
diff --git a/src/stateless/cp/trex_stateless.h b/src/stateless/cp/trex_stateless.h
index 7ea669df..070cd6de 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;
- const TrexPlatformApi *m_platform_api;
+ TrexPlatformApi *m_platform_api;
bool m_rpc_server_verbose;
uint8_t m_port_count;
TrexPublisher *m_publisher;
@@ -137,6 +137,18 @@ public:
void shutdown();
/**
+ * fetch xstats names (keys of dict)
+ *
+ */
+ void encode_xstats_names(Json::Value &global);
+
+ /**
+ * fetch xstats values
+ *
+ */
+ void encode_xstats_values(Json::Value &global);
+
+ /**
* fetch all the stats
*
*/
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 58410fea..8c6a1573 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -153,7 +153,7 @@ private:
* trex stateless port
*
**************************/
-TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api) : m_dp_events(this) {
+TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api) : platform_api(api), m_dp_events(this) {
std::vector<std::pair<uint8_t, uint8_t>> core_pair_list;
m_port_id = port_id;
@@ -581,7 +581,7 @@ void
TrexStatelessPort::get_properties(std::string &driver, uint32_t &speed) {
driver = m_api_info.driver_name;
- speed = m_api_info.speed;
+ speed = platform_api->get_link_speed(m_port_id);
}
bool
@@ -609,10 +609,8 @@ TrexStatelessPort::change_state(port_state_e new_state) {
void
TrexStatelessPort::encode_stats(Json::Value &port) {
- const TrexPlatformApi *api = get_stateless_obj()->get_platform_api();
-
TrexPlatformInterfaceStats stats;
- api->get_interface_stats(m_port_id, stats);
+ 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;
@@ -664,7 +662,7 @@ TrexStatelessPort::send_message_to_rx(TrexStatelessCpToRxMsgBase *msg) {
uint64_t
TrexStatelessPort::get_port_speed_bps() const {
- return (uint64_t) m_api_info.speed * 1000 * 1000;
+ return (uint64_t) platform_api->get_link_speed(m_port_id) * 1000 * 1000;
}
static inline double
@@ -869,18 +867,6 @@ TrexStatelessPort::get_port_effective_rate(double &pps,
}
-
-void
-TrexStatelessPort::set_promiscuous(bool enabled) {
- get_stateless_obj()->get_platform_api()->set_promiscuous(m_port_id, enabled);
-}
-
-bool
-TrexStatelessPort::get_promiscuous() {
- return get_stateless_obj()->get_platform_api()->get_promiscuous(m_port_id);
-}
-
-
void
TrexStatelessPort::get_macaddr(std::string &hw_macaddr,
std::string &src_macaddr,
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 147efc70..00139973 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -363,14 +363,6 @@ public:
double &percentage);
- /**
- * set port promiscuous on/off
- *
- * @param enabled
- */
- void set_promiscuous(bool enabled);
- bool get_promiscuous();
-
void get_macaddr(std::string &hw_macaddr,
std::string &src_macaddr,
std::string &dst_macaddr);
@@ -443,6 +435,7 @@ private:
port_state_e m_port_state;
TrexPlatformApi::intf_info_st m_api_info;
+ const TrexPlatformApi *platform_api;
uint16_t m_rx_count_num;
uint16_t m_rx_caps;