diff --git a/onvm/onvm_mgr/main.c b/onvm/onvm_mgr/main.c index 4c1bbd53d..d61666c2f 100644 --- a/onvm/onvm_mgr/main.c +++ b/onvm/onvm_mgr/main.c @@ -102,6 +102,14 @@ master_thread_main(void) { onvm_stats_init(verbosity_level); /* Loop forever: sleep always returns 0 or <= param */ while (main_keep_running && sleep(sleeptime) <= sleeptime) { + for (i = 0; i < ports->num_ports; i++) { + struct rte_eth_stats stat; + if (rte_eth_stats_get(ports->id[i], &stat)) + RTE_LOG(ERR, APP, "Cannot get stats of port %d\n", ports->id[i]); + ports->nic_drop[ports->id[i]] = stat.imissed + stat.ierrors; + ports->nic_receive[ports->id[i]] = stat.ipackets; + } + onvm_nf_check_status(); if (stats_destination != ONVM_STATS_NONE) onvm_stats_display_all(sleeptime, verbosity_level); diff --git a/onvm/onvm_mgr/onvm_stats.c b/onvm/onvm_mgr/onvm_stats.c index 6f0e370f8..40ae19610 100644 --- a/onvm/onvm_mgr/onvm_stats.c +++ b/onvm/onvm_mgr/onvm_stats.c @@ -316,6 +316,8 @@ onvm_stats_display_ports(unsigned difftime, uint8_t verbosity_level) { uint64_t nic_tx_pkts = 0; uint64_t nic_rx_pps = 0; uint64_t nic_tx_pps = 0; + uint64_t nic_received_pkts = 0; + uint64_t nic_dropped_pkts = 0; char *port_label = NULL; /* Arrays to store last TX/RX count to calculate rate */ static uint64_t tx_last[RTE_MAX_ETHPORTS]; @@ -339,13 +341,18 @@ onvm_stats_display_ports(unsigned difftime, uint8_t verbosity_level) { nic_rx_pps = (nic_rx_pkts - rx_last[i]) / difftime; nic_tx_pps = (nic_tx_pkts - tx_last[i]) / difftime; + nic_dropped_pkts = ports->nic_drop[ports->id[i]]; + nic_received_pkts = ports->nic_receive[ports->id[i]]; + if (verbosity_level == ONVM_RAW_STATS_DUMP) { fprintf(stats_out, ONVM_STATS_RAW_DUMP_PORTS_CONTENT, buffer, (unsigned)ports->id[i], nic_rx_pkts, nic_rx_pps, nic_tx_pkts, nic_tx_pps); } else { fprintf(stats_out, ONVM_STATS_REG_PORTS, - (unsigned)ports->id[i], nic_rx_pkts, nic_rx_pps, nic_tx_pkts, nic_tx_pps); + (unsigned)ports->id[i], + nic_received_pkts, nic_dropped_pkts, + nic_rx_pkts, nic_rx_pps, nic_tx_pkts, nic_tx_pps); } /* Only print this information out if we haven't already printed it to the console above */ diff --git a/onvm/onvm_mgr/onvm_stats.h b/onvm/onvm_mgr/onvm_stats.h index b6e337282..c302a374d 100644 --- a/onvm/onvm_mgr/onvm_stats.h +++ b/onvm/onvm_mgr/onvm_stats.h @@ -83,7 +83,8 @@ extern const char *NF_MSG[3]; "SID %-2u %2u%s - %9" PRIu64 " / %-9" PRIu64 " %11" PRIu64\ " / %-11" PRIu64 " %11" PRIu64 " / %-11" PRIu64 " / %-11" PRIu64 "\n" #define ONVM_STATS_REG_PORTS \ - "Port %u - rx: %9" PRIu64 " (%9" PRIu64 " pps)\t"\ + "Port %u - nic: %9" PRIu64 " (drop %9" PRIu64 ")\t"\ + "rx: %9" PRIu64 " (%9" PRIu64 " pps)\t"\ "tx: %9" PRIu64 " (%9" PRIu64 " pps)\n" #define ONVM_STATS_ADV_CONTENT \ "%-14s %2u / %-2u / %2u %9" PRIu64 " / %-9" PRIu64 " %11" PRIu64 " / %-11" PRIu64\ diff --git a/onvm/onvm_nflib/onvm_common.h b/onvm/onvm_nflib/onvm_common.h index e2b8adcc1..9c72b9507 100755 --- a/onvm/onvm_nflib/onvm_common.h +++ b/onvm/onvm_nflib/onvm_common.h @@ -204,6 +204,8 @@ struct port_info { struct rte_ether_addr mac[RTE_MAX_ETHPORTS]; volatile struct rx_stats rx_stats; volatile struct tx_stats tx_stats; + uint64_t nic_drop[RTE_MAX_ETHPORTS]; + uint64_t nic_receive[RTE_MAX_ETHPORTS]; }; struct onvm_configuration {