From 58d475b78c603cda5df527880ac46d10e98ad5f4 Mon Sep 17 00:00:00 2001 From: Jerin Jacob Date: Tue, 9 Oct 2018 14:18:18 +0000 Subject: [PATCH] app/testpmd: collect bad outer L4 checksum for csum engine Collect and prints the statistics for PKT_RX_EL4_CKSUM_BAD errors. Signed-off-by: Jerin Jacob Reviewed-by: Andrew Rybchenko Acked-by: Bernard Iremonger --- app/test-pmd/csumonly.c | 5 +++++ app/test-pmd/testpmd.c | 18 +++++++++++++----- app/test-pmd/testpmd.h | 4 ++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ea5b112d6a..dce4b9be7f 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -701,6 +701,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; + uint32_t rx_bad_outer_l4_csum; struct testpmd_offload_info info; uint16_t nb_segments = 0; int ret; @@ -726,6 +727,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) fs->rx_packets += nb_rx; rx_bad_ip_csum = 0; rx_bad_l4_csum = 0; + rx_bad_outer_l4_csum = 0; gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; @@ -753,6 +755,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) rx_bad_ip_csum += 1; if ((rx_ol_flags & PKT_RX_L4_CKSUM_MASK) == PKT_RX_L4_CKSUM_BAD) rx_bad_l4_csum += 1; + if (rx_ol_flags & PKT_RX_OUTER_L4_CKSUM_BAD) + rx_bad_outer_l4_csum += 1; /* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan * and inner headers */ @@ -991,6 +995,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) fs->tx_packets += nb_tx; fs->rx_bad_ip_csum += rx_bad_ip_csum; fs->rx_bad_l4_csum += rx_bad_l4_csum; + fs->rx_bad_outer_l4_csum += rx_bad_outer_l4_csum; #ifdef RTE_TEST_PMD_RECORD_BURST_STATS fs->tx_burst_stats.pkt_burst_spread[nb_tx]++; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index d9e0a5ddb8..5e0b245f85 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1323,8 +1323,9 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) (uint64_t) (stats->ipackets + stats->imissed)); if (cur_fwd_eng == &csum_fwd_engine) - printf(" Bad-ipcsum: %-14"PRIu64" Bad-l4csum: %-14"PRIu64" \n", - port->rx_bad_ip_csum, port->rx_bad_l4_csum); + printf(" Bad-ipcsum: %-14"PRIu64" Bad-l4csum: %-14"PRIu64"Bad-outer-l4csum: %-14"PRIu64"\n", + port->rx_bad_ip_csum, port->rx_bad_l4_csum, + port->rx_bad_outer_l4_csum); if ((stats->ierrors + stats->rx_nombuf) > 0) { printf(" RX-error: %-"PRIu64"\n", stats->ierrors); printf(" RX-nombufs: %-14"PRIu64"\n", stats->rx_nombuf); @@ -1342,8 +1343,9 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) (uint64_t) (stats->ipackets + stats->imissed)); if (cur_fwd_eng == &csum_fwd_engine) - printf(" Bad-ipcsum:%14"PRIu64" Bad-l4csum:%14"PRIu64"\n", - port->rx_bad_ip_csum, port->rx_bad_l4_csum); + printf(" Bad-ipcsum:%14"PRIu64" Bad-l4csum:%14"PRIu64" Bad-outer-l4csum: %-14"PRIu64"\n", + port->rx_bad_ip_csum, port->rx_bad_l4_csum, + port->rx_bad_outer_l4_csum); if ((stats->ierrors + stats->rx_nombuf) > 0) { printf(" RX-error:%"PRIu64"\n", stats->ierrors); printf(" RX-nombufs: %14"PRIu64"\n", @@ -1407,7 +1409,9 @@ fwd_stream_stats_display(streamid_t stream_id) /* if checksum mode */ if (cur_fwd_eng == &csum_fwd_engine) { printf(" RX- bad IP checksum: %-14u Rx- bad L4 checksum: " - "%-14u\n", fs->rx_bad_ip_csum, fs->rx_bad_l4_csum); + "%-14u Rx- bad outer L4 checksum: %-14u\n", + fs->rx_bad_ip_csum, fs->rx_bad_l4_csum, + fs->rx_bad_outer_l4_csum); } #ifdef RTE_TEST_PMD_RECORD_BURST_STATS @@ -1661,6 +1665,7 @@ start_packet_forwarding(int with_tx_first) fwd_streams[sm_id]->fwd_dropped = 0; fwd_streams[sm_id]->rx_bad_ip_csum = 0; fwd_streams[sm_id]->rx_bad_l4_csum = 0; + fwd_streams[sm_id]->rx_bad_outer_l4_csum = 0; #ifdef RTE_TEST_PMD_RECORD_BURST_STATS memset(&fwd_streams[sm_id]->rx_burst_stats, 0, @@ -1766,6 +1771,9 @@ stop_packet_forwarding(void) ports[fwd_streams[sm_id]->rx_port].rx_bad_l4_csum = rx_bad_l4_csum; + ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum += + fwd_streams[sm_id]->rx_bad_outer_l4_csum; + #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES fwd_cycles = (uint64_t) (fwd_cycles + fwd_streams[sm_id]->core_cycles); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3cd4bbb3e8..9a13281043 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -122,6 +122,8 @@ struct fwd_stream { unsigned int fwd_dropped; /**< received packets not forwarded */ unsigned int rx_bad_ip_csum ; /**< received packets has bad ip checksum */ unsigned int rx_bad_l4_csum ; /**< received packets has bad l4 checksum */ + unsigned int rx_bad_outer_l4_csum; + /**< received packets has bad outer l4 checksum */ unsigned int gro_times; /**< GRO operation times */ #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t core_cycles; /**< used for RX and TX processing */ @@ -172,6 +174,8 @@ struct rte_port { void *fwd_ctx; /**< Forwarding mode context */ uint64_t rx_bad_ip_csum; /**< rx pkts with bad ip checksum */ uint64_t rx_bad_l4_csum; /**< rx pkts with bad l4 checksum */ + uint64_t rx_bad_outer_l4_csum; + /**< rx pkts with bad outer l4 checksum */ uint8_t tx_queue_stats_mapping_enabled; uint8_t rx_queue_stats_mapping_enabled; volatile uint16_t port_status; /**< port started or not */