[v2,4/4] app/testpmd: collect bad outer L4 checksum for csum engine
diff mbox series

Message ID 20181002192451.19119-4-jerin.jacob@caviumnetworks.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [v2,1/4] ethdev: add Rx offload outer UDP checksum definition
Related show

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Jerin Jacob Oct. 2, 2018, 7:24 p.m. UTC
Collect and prints the statistics for PKT_RX_EL4_CKSUM_BAD
errors.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---

v2:
- added PKT_RX_EL4_CKSUM_BAD statistics

---
 app/test-pmd/csumonly.c |  6 ++++++
 app/test-pmd/testpmd.c  | 22 +++++++++++++++++-----
 app/test-pmd/testpmd.h  |  4 ++++
 3 files changed, 27 insertions(+), 5 deletions(-)

Comments

Andrew Rybchenko Oct. 3, 2018, 8:29 a.m. UTC | #1
On 10/2/18 10:24 PM, Jerin Jacob wrote:
> Collect and prints the statistics for PKT_RX_EL4_CKSUM_BAD
> errors.
>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>

except two nits below

<...>

> @@ -753,6 +755,9 @@ 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_EL4_CKSUM_BAD)
> +			rx_bad_outer_l4_csum += 1;
> +

Unnecessary extra empty line.

<...>

> @@ -1482,6 +1488,12 @@ stop_packet_forwarding(void)
>   					 fwd_streams[sm_id]->rx_bad_l4_csum);
>   		ports[fwd_streams[sm_id]->rx_port].rx_bad_l4_csum =
>   							rx_bad_l4_csum;
> +		rx_bad_outer_l4_csum =
> +			ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum;
> +		rx_bad_outer_l4_csum = (uint64_t) (rx_bad_outer_l4_csum +
> +			fwd_streams[sm_id]->rx_bad_outer_l4_csum);
> +		ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum =
> +							rx_bad_outer_l4_csum;

I guess it is copied from about and modified, but I think that so long magic
is not required and the following simple version should do the job:

ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum +=
      fwd_streams[sm_id]->rx_bad_outer_l4_csum;


rx_bad_outer_l4_csum is uint64_t and usual arithmetic conversions
should guarantee the correct result.

Patch
diff mbox series

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index ea5b112d6..eeda3e9d8 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,9 @@  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_EL4_CKSUM_BAD)
+			rx_bad_outer_l4_csum += 1;
+
 
 		/* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan
 		 * and inner headers */
@@ -991,6 +996,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 001f0e552..7db839053 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1040,8 +1040,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);
@@ -1059,8 +1060,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",
@@ -1124,7 +1126,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
@@ -1378,6 +1382,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,
@@ -1427,6 +1432,7 @@  stop_packet_forwarding(void)
 	uint64_t tx_dropped;
 	uint64_t rx_bad_ip_csum;
 	uint64_t rx_bad_l4_csum;
+	uint64_t rx_bad_outer_l4_csum;
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t fwd_cycles;
 #endif
@@ -1482,6 +1488,12 @@  stop_packet_forwarding(void)
 					 fwd_streams[sm_id]->rx_bad_l4_csum);
 		ports[fwd_streams[sm_id]->rx_port].rx_bad_l4_csum =
 							rx_bad_l4_csum;
+		rx_bad_outer_l4_csum =
+			ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum;
+		rx_bad_outer_l4_csum = (uint64_t) (rx_bad_outer_l4_csum +
+			fwd_streams[sm_id]->rx_bad_outer_l4_csum);
+		ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum =
+							rx_bad_outer_l4_csum;
 
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 		fwd_cycles = (uint64_t) (fwd_cycles +
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index a1f661472..106aeefc2 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -112,6 +112,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 */
@@ -165,6 +167,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 */