DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jijiang Liu <jijiang.liu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 09/10] examples/tep_termination:add bad Rx checksum statistics of inner IP and L4
Date: Fri, 29 May 2015 15:39:48 +0800	[thread overview]
Message-ID: <1432885189-19669-10-git-send-email-jijiang.liu@intel.com> (raw)
In-Reply-To: <1432885189-19669-1-git-send-email-jijiang.liu@intel.com>

The number of packets with bad RX IP and L4 checksum in inner header is recorded.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 examples/tep_termination/main.c        |   10 +++++++++-
 examples/tep_termination/main.h        |    4 ++++
 examples/tep_termination/vxlan_setup.c |    8 ++++++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index 995fd2a..dd3dfea 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1003,7 +1003,7 @@ print_stats(void)
 {
 	struct virtio_net_data_ll *dev_ll;
 	uint64_t tx_dropped, rx_dropped;
-	uint64_t tx, tx_total, rx, rx_total;
+	uint64_t tx, tx_total, rx, rx_total, rx_ip_csum, rx_l4_csum;
 	uint32_t device_fh;
 	const char clr[] = { 27, '[', '2', 'J', '\0' };
 	const char top_left[] = { 27, '[', '1', ';', '1', 'H', '\0' };
@@ -1028,12 +1028,18 @@ print_stats(void)
 			rx = rte_atomic64_read(
 				&dev_statistics[device_fh].rx_atomic);
 			rx_dropped = rx_total - rx;
+			rx_ip_csum = rte_atomic64_read(
+				&dev_statistics[device_fh].rx_bad_ip_csum);
+			rx_l4_csum = rte_atomic64_read(
+				&dev_statistics[device_fh].rx_bad_l4_csum);
 
 			printf("\nStatistics for device %"PRIu32" ------------------------------"
 					"\nTX total: 		%"PRIu64""
 					"\nTX dropped: 		%"PRIu64""
 					"\nTX successful: 		%"PRIu64""
 					"\nRX total: 		%"PRIu64""
+					"\nRX bad IP csum:      %"PRIu64""
+					"\nRX bad L4 csum:      %"PRIu64""
 					"\nRX dropped: 		%"PRIu64""
 					"\nRX successful: 		%"PRIu64"",
 					device_fh,
@@ -1041,6 +1047,8 @@ print_stats(void)
 					tx_dropped,
 					tx,
 					rx_total,
+					rx_ip_csum,
+					rx_l4_csum,
 					rx_dropped,
 					rx);
 
diff --git a/examples/tep_termination/main.h b/examples/tep_termination/main.h
index 74c3d98..5cf1157 100644
--- a/examples/tep_termination/main.h
+++ b/examples/tep_termination/main.h
@@ -69,6 +69,10 @@ struct device_statistics {
 	uint64_t rx_total;
 	uint64_t tx;
 	rte_atomic64_t rx_atomic;
+	/**< Bad inner IP csum for tunneling pkt */
+	rte_atomic64_t rx_bad_ip_csum;
+	/**< Bad inner L4 csum for tunneling pkt */
+	rte_atomic64_t rx_bad_l4_csum;
 } __rte_cache_aligned;
 
 /**
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 528b74a..deb52ec 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -82,6 +82,8 @@ extern uint16_t udp_port;
 extern uint8_t ports[RTE_MAX_ETHPORTS];
 extern uint8_t filter_idx;
 extern uint16_t tso_segsz;
+extern uint32_t enable_stats;
+extern struct device_statistics dev_statistics[MAX_DEVICES];
 
 /* ethernet addresses of ports */
 extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
@@ -433,6 +435,12 @@ vxlan_rx_pkts (struct virtio_net *dev, struct rte_mbuf **pkts_burst, uint32_t rx
 	struct rte_mbuf *pkts_valid[rx_count];
 
 	for (i = 0; i < rx_count; i++) {
+		if (enable_stats) {
+			rte_atomic64_add(&dev_statistics[dev->device_fh].rx_bad_ip_csum,
+				(pkts_burst[i]->ol_flags & PKT_RX_IP_CKSUM_BAD) != 0);
+			rte_atomic64_add(&dev_statistics[dev->device_fh].rx_bad_ip_csum,
+				(pkts_burst[i]->ol_flags & PKT_RX_L4_CKSUM_BAD) != 0);
+		}
 		ret = vxlan_rx_process(pkts_burst[i]);
 		if (unlikely(ret < 0))
 			continue;
-- 
1.7.7.6

  parent reply	other threads:[~2015-05-29  7:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  7:39 [dpdk-dev] [PATCH v2 00/10] Add a VXLAN sample Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 01/10] examples/tep_termination:initialize the " Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 02/10] examples/tep_termination:define the basic VXLAN port information Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 03/10] examples/tep_termination:add the pluggable structures for VXLAN packet processing Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 04/10] examples/tep_termination:implement " Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 05/10] examples/tep_termination:add UDP port configuration for UDP tunneling packet Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 06/10] examples/tep_termination:add tunnel filter type configuration Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 07/10] examples/tep_termination:add Tx checksum offload configuration for inner header Jijiang Liu
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 08/10] examples/tep_termination:add TSO offload configuration Jijiang Liu
2015-05-29  7:39 ` Jijiang Liu [this message]
2015-05-29  7:39 ` [dpdk-dev] [PATCH v2 10/10] examples/tep_termination:add the configuration for encapsulation and the decapsulation Jijiang Liu
2015-06-03  8:26 ` [dpdk-dev] [PATCH v2 00/10] Add a VXLAN sample Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432885189-19669-10-git-send-email-jijiang.liu@intel.com \
    --to=jijiang.liu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).