summaryrefslogtreecommitdiffstats
path: root/src/trex_port_attr.h
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-10-22 10:38:27 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-10-28 14:38:32 +0200
commit2dab6b6d09f9f1474d2ade6b465ebfa5ce3b3f5e (patch)
treebab2898d6b631d5495c62a8ad4b86ccea4eae786 /src/trex_port_attr.h
parent00bfc58e6f76f7a67a6b62f297f72792534fef52 (diff)
dpdk_setup_ports.py: fix add of help in case of "t-rex-64 --help"
dpdk_setup_ports.py: fix warning of TRex is already running if different NICs are being used singleton_daemon.py: fix error socket in use immediately after check if in use trex-console: fix crash in case of "tui --help" trex-console: try-catch commands instead of crashing add async notification on port status/atttibutes change add port xstats support add description of interfaces main_dpdk.cpp: fix --client_cfg not working with Python API Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'src/trex_port_attr.h')
-rwxr-xr-xsrc/trex_port_attr.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/trex_port_attr.h b/src/trex_port_attr.h
index 037a3de3..cc267104 100755
--- a/src/trex_port_attr.h
+++ b/src/trex_port_attr.h
@@ -19,23 +19,33 @@ limitations under the License.
#include <string>
#include <vector>
-#include <rte_ethdev.h>
+#include "rte_ethdev_includes.h"
#include "trex_defs.h"
class TRexPortAttr {
public:
- TRexPortAttr(uint8_t total_ports, bool is_virtual = false) : total_ports(total_ports) {
+ TRexPortAttr(uint8_t total_ports, bool is_virtual, bool fc_change_allowed) : total_ports(total_ports) {
flag_is_virtual = is_virtual;
m_link.resize(total_ports);
intf_info_st.resize(total_ports);
+ dev_info.resize(total_ports);
+ int tmp;
+ flag_is_fc_change_supported = fc_change_allowed && (get_flow_ctrl(0, tmp) != -ENOTSUP);
+ flag_is_led_change_supported = (set_led(0, true) != -ENOTSUP);
+ flag_is_link_change_supported = (set_link_up(0, true) != -ENOTSUP);
+ update_descriptions();
+ for (int i=0; i<total_ports; i++) {
+ update_device_info(i);
+ }
}
/* UPDATES */
virtual void update_link_status(uint8_t port_id);
- virtual void update_link_status_nowait(uint8_t port_id);
+ virtual bool update_link_status_nowait(uint8_t port_id); // returns true if the status was changed
+ virtual void update_device_info(uint8_t port_id);
virtual void reset_xstats(uint8_t port_id);
- virtual void update_info();
+ virtual void update_descriptions();
/* GETTERS */
virtual bool get_promiscuous(uint8_t port_id);
@@ -46,29 +56,36 @@ public:
virtual bool is_link_up(uint8_t port_id) { return (m_link[port_id].link_status ? true : false); }
virtual int get_xstats_values(uint8_t port_id, xstats_values_t &xstats_values);
virtual int get_xstats_names(uint8_t port_id, xstats_names_t &xstats_names);
- virtual int get_flow_ctrl(uint8_t port_id, enum rte_eth_fc_mode *mode);
+ virtual int get_flow_ctrl(uint8_t port_id, int &mode);
+ virtual bool is_virtual() { return flag_is_virtual; }
+ virtual bool is_fc_change_supported() { return flag_is_fc_change_supported; }
+ virtual bool is_led_change_supported() { return flag_is_led_change_supported; }
+ virtual bool is_link_change_supported() { return flag_is_link_change_supported; }
+ virtual void get_description(uint8_t port_id, std::string &description) { description = intf_info_st[port_id].description; }
+ virtual void get_supported_speeds(uint8_t port_id, supp_speeds_t &supp_speeds);
/* SETTERS */
virtual int set_promiscuous(uint8_t port_id, bool enabled);
virtual int add_mac(uint8_t port_id, char * mac);
virtual int set_link_up(uint8_t port_id, bool up);
- virtual int set_flow_ctrl(uint8_t port_id, const enum rte_eth_fc_mode mode);
+ virtual int set_flow_ctrl(uint8_t port_id, int mode);
virtual int set_led(uint8_t port_id, bool on);
/* DUMPS */
virtual void dump_link(uint8_t port_id, FILE *fd);
- virtual bool is_virtual() {
- return flag_is_virtual;
- }
private:
- bool flag_is_virtual;
const uint8_t total_ports;
rte_eth_fc_conf fc_conf_tmp;
- std::vector <rte_eth_link> m_link;
+ std::vector<rte_eth_link> m_link;
+ std::vector<struct rte_eth_dev_info> dev_info;
std::vector<struct rte_eth_xstat> xstats_values_tmp;
std::vector<struct rte_eth_xstat_name> xstats_names_tmp;
+ bool flag_is_virtual;
+ bool flag_is_fc_change_supported;
+ bool flag_is_led_change_supported;
+ bool flag_is_link_change_supported;
struct mac_cfg_st {
uint8_t hw_macaddr[6];