diff options
author | 2016-02-28 14:32:57 +0200 | |
---|---|---|
committer | 2016-02-28 14:33:26 +0200 | |
commit | 21fe2befe8806ac2a70cfb1d1c45737bee7e2702 (patch) | |
tree | 4a774d3a156f3418ea22a2ad88602056eb77fab6 /src/main_dpdk.cpp | |
parent | b83eb43c25f0452c152d31966da4b1af5c304a6b (diff) |
more info for ports (API and TUI)
Diffstat (limited to 'src/main_dpdk.cpp')
-rw-r--r-- | src/main_dpdk.cpp | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 79f3d628..1b5b82f9 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -1517,6 +1517,7 @@ void CPhyEthIF::macaddr_get(struct ether_addr *mac_addr){ rte_eth_macaddr_get(m_port_id , mac_addr); } + void CPhyEthIF::get_stats_1g(CPhyEthIFStats *stats){ stats->ipackets += pci_reg_read(E1000_GPRC) ; @@ -5121,14 +5122,39 @@ TrexDpdkPlatformApi::port_id_to_cores(uint8_t port_id, std::vector<std::pair<uin } void -TrexDpdkPlatformApi::get_interface_info(uint8_t port_id, - std::string &driver_name, - driver_speed_e &speed, - bool &has_crc) const { +TrexDpdkPlatformApi::get_interface_info(uint8_t interface_id, intf_info_st &info) const { + struct ether_addr rte_mac_addr; + + info.driver_name = CTRexExtendedDriverDb::Ins()->get_driver_name(); + info.speed = CTRexExtendedDriverDb::Ins()->get_drv()->get_driver_speed(interface_id); + info.has_crc = CTRexExtendedDriverDb::Ins()->get_drv()->has_crc_added(); + + /* mac INFO */ + + /* hardware */ + g_trex.m_ports[interface_id].macaddr_get(&rte_mac_addr); + assert(ETHER_ADDR_LEN == 6); + for (int i = 0; i < 6; i++) { + info.mac_info.hw_macaddr[i] = rte_mac_addr.addr_bytes[i]; + } + + /* software */ + uint8_t sw_macaddr[12]; + memcpy(sw_macaddr, CGlobalInfo::m_options.get_dst_src_mac_addr(interface_id), 12); + + for (int i = 0; i < 6; i++) { + info.mac_info.dst_macaddr[i] = sw_macaddr[i]; + info.mac_info.src_macaddr[i] = sw_macaddr[6 + i]; + + } + + info.numa_node = g_trex.m_ports[interface_id].m_dev_info.pci_dev->numa_node; + struct rte_pci_addr *loc = &g_trex.m_ports[interface_id].m_dev_info.pci_dev->addr; + + char pci_addr[50]; + snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, loc->domain, loc->bus, loc->devid, loc->function); + info.pci_addr = pci_addr; - driver_name = CTRexExtendedDriverDb::Ins()->get_driver_name(); - speed = CTRexExtendedDriverDb::Ins()->get_drv()->get_driver_speed(port_id); - has_crc = CTRexExtendedDriverDb::Ins()->get_drv()->has_crc_added(); } void @@ -5165,14 +5191,4 @@ bool TrexDpdkPlatformApi::get_promiscuous(uint8_t port_id) const { return g_trex.m_ports[port_id].get_promiscuous(); } -void TrexDpdkPlatformApi::get_macaddr(uint8_t port_id, uint8_t *macaddr) const { - struct ether_addr rte_mac_addr; - - g_trex.m_ports[port_id].macaddr_get(&rte_mac_addr); - assert(ETHER_ADDR_LEN == 6); - for (int i = 0; i < 6; i++) { - macaddr[i] = rte_mac_addr.addr_bytes[i]; - } - -} |