summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py9
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py2
-rw-r--r--src/trex_port_attr.cpp2
3 files changed, 6 insertions, 7 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
index 9b955465..ef74a85e 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
@@ -129,10 +129,10 @@ class Port(object):
return RC_OK(data)
def get_speed_bps (self):
- return (self.__attr['speed'] * 1000 * 1000 * 1000)
+ return (self.get_speed_gbps() * 1000 * 1000 * 1000)
- def get_formatted_speed (self):
- return "%g Gb/s" % (self.__attr['speed'] / 1000)
+ def get_speed_gbps (self):
+ return self.__attr['speed']
def is_acquired(self):
return (self.handler != None)
@@ -826,7 +826,7 @@ class Port(object):
info['is_virtual'] = 'N/A'
# speed
- info['speed'] = self.get_formatted_speed()
+ info['speed'] = self.get_speed_gbps()
# RX filter mode
info['rx_filter_mode'] = 'hardware match' if attr['rx_filter_mode'] == 'hw' else 'fetch all'
@@ -865,7 +865,6 @@ class Port(object):
queue = rx_info['queue']
info['rx_queue'] = '[{0} / {1}]'.format(queue['count'], queue['size']) if queue['is_active'] else 'off'
-
return info
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
index 2efb5a84..6a59126f 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
@@ -1130,7 +1130,7 @@ class CPortStats(CTRexStats):
return {"owner": owner,
"state": "{0}".format(port_state),
'link': link_state,
- "speed": self._port_obj.get_formatted_speed() if self._port_obj else '',
+ "speed": "%g Gb/s" % self._port_obj.get_speed_gbps() if self._port_obj else '',
"CPU util.": "{0} {1}%".format(self.get_trend_gui("m_cpu_util", use_raw = True),
format_threshold(round_float(self.get("m_cpu_util")), [85, 100], [0, 85])) if self._port_obj else '' ,
"--": " ",
diff --git a/src/trex_port_attr.cpp b/src/trex_port_attr.cpp
index 53ae19d8..61e88585 100644
--- a/src/trex_port_attr.cpp
+++ b/src/trex_port_attr.cpp
@@ -119,7 +119,7 @@ TRexPortAttr::to_json(Json::Value &output) {
output["src_mac"] = utl_macaddr_to_str(get_src_mac());
output["promiscuous"]["enabled"] = get_promiscuous();
output["link"]["up"] = is_link_up();
- output["speed"] = get_link_speed();
+ output["speed"] = get_link_speed() / 1000; // make sure we have no cards of less than 1 Gbps
output["rx_filter_mode"] = get_rx_filter_mode();
if (get_src_ipv4() != 0) {