From 111bd3664b91279883d9f8e2483e436cbdcf3d38 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Fri, 28 Oct 2016 14:32:05 +0200 Subject: move port_attr from driver class to physical port class + small fixes according to code review Signed-off-by: Yaroslav Brustinov --- src/internal_api/trex_platform_api.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/internal_api/trex_platform_api.h') diff --git a/src/internal_api/trex_platform_api.h b/src/internal_api/trex_platform_api.h index 0141186e..631f9a3e 100644 --- a/src/internal_api/trex_platform_api.h +++ b/src/internal_api/trex_platform_api.h @@ -155,7 +155,7 @@ public: virtual int get_cpu_util_full(cpu_util_full_t &result) const = 0; virtual int get_mbuf_util(Json::Value &result) const = 0; virtual CFlowStatParser *get_flow_stat_parser() const = 0; - virtual TRexPortAttr *getPortAttrObj() const = 0; + virtual TRexPortAttr *getPortAttrObj(uint8_t port_id) const = 0; virtual void mark_for_shutdown() const = 0; virtual int get_xstats_values(uint8_t port_id, xstats_values_t &xstats_values) const = 0; virtual int get_xstats_names(uint8_t port_id, xstats_names_t &xstats_names) const = 0; @@ -197,7 +197,7 @@ public: int get_mbuf_util(Json::Value &result) const; void mark_for_shutdown() const; CFlowStatParser *get_flow_stat_parser() const; - TRexPortAttr *getPortAttrObj() const; + TRexPortAttr *getPortAttrObj(uint8_t port_id) const; int get_xstats_values(uint8_t port_id, xstats_values_t &xstats_values) const; int get_xstats_names(uint8_t port_id, xstats_names_t &xstats_names) const; @@ -214,6 +214,11 @@ public: SimPlatformApi(int dp_core_count) { m_dp_core_count = dp_core_count; + m_port_attr = new SimTRexPortAttr(); + } + + ~SimPlatformApi() { + delete m_port_attr; } virtual uint8_t get_dp_core_count() const { @@ -266,7 +271,7 @@ public: int get_cpu_util_full(cpu_util_full_t &result) const {return 0;} int get_mbuf_util(Json::Value &result) const {return 0;} CFlowStatParser *get_flow_stat_parser() const {return new CFlowStatParser();} - TRexPortAttr *getPortAttrObj() const {printf("Port attributes should not be used in simulation\n"); return NULL;} // dummy + TRexPortAttr *getPortAttrObj(uint8_t port_id) const {return m_port_attr;} void mark_for_shutdown() const {} int get_xstats_values(uint8_t port_id, xstats_values_t &xstats_values) const {return 0;}; @@ -274,6 +279,7 @@ public: private: int m_dp_core_count; + SimTRexPortAttr * m_port_attr; }; #endif /* __TREX_PLATFORM_API_H__ */ -- cgit 1.2.3-korg