Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display packet drop stats #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions onvm/onvm_mgr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding on to this, I think it'd be helpful to include the received and transmitted bytes (ibytes and obytes)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennisafa I think it is easy to add more stats, as you suggested, but I don't know where those stats could be displayed :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can be displayed with the other NIC stats.

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);
Expand Down
9 changes: 8 additions & 1 deletion onvm/onvm_mgr/onvm_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion onvm/onvm_mgr/onvm_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down
2 changes: 2 additions & 0 deletions onvm/onvm_nflib/onvm_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down