DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jijiang Liu <jijiang.liu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/10] examples/tep_termination:add bad Rx checksum statistics of inner IP and L4
Date: Fri, 15 May 2015 14:09:00 +0800	[thread overview]
Message-ID: <1431670141-7835-10-git-send-email-jijiang.liu@intel.com> (raw)
In-Reply-To: <1431670141-7835-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 144f8c8..04f517c 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1004,7 +1004,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' };
@@ -1029,12 +1029,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,
@@ -1042,6 +1048,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 af7eea9..141df25 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -79,6 +79,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];
@@ -423,6 +425,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-15  6:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15  6:08 [dpdk-dev] [PATCH 00/10] Add a VXLAN sample Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 01/10] examples/tep_termination:initialize the " Jijiang Liu
2015-05-15 23:53   ` Stephen Hemminger
2015-05-18  1:37     ` Liu, Jijiang
2015-05-15 23:55   ` Stephen Hemminger
2015-05-18  2:42     ` Liu, Jijiang
2015-05-15  6:08 ` [dpdk-dev] [PATCH 02/10] examples/tep_termination:define the basic VXLAN port information Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 03/10] examples/tep_termination:add the pluggable structures for VXLAN packet processing Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 04/10] examples/tep_termination:implement " Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 05/10] examples/tep_termination:add UDP port configuration for UDP tunneling packet Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 06/10] examples/tep_termination:add tunnel filter type configuration Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 07/10] examples/tep_termination:add Tx checksum offload configuration for inner header Jijiang Liu
2015-05-15  6:08 ` [dpdk-dev] [PATCH 08/10] examples/tep_termination:add TSO offload configuration Jijiang Liu
2015-05-15  6:09 ` Jijiang Liu [this message]
2015-05-15  6:09 ` [dpdk-dev] [PATCH 10/10] examples/tep_termination:add the configuration for encapsulation and the decapsulation Jijiang Liu
2015-05-15  8:18 ` [dpdk-dev] [PATCH 00/10] Add a VXLAN sample Mcnamara, John
2015-05-18  2:52   ` Liu, Jijiang

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=1431670141-7835-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).