From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3E2785A40 for ; Fri, 15 May 2015 08:09:43 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 14 May 2015 23:09:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,432,1427785200"; d="scan'208";a="571724462" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 14 May 2015 23:09:28 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t4F69OIl010087; Fri, 15 May 2015 14:09:24 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t4F69MRa007936; Fri, 15 May 2015 14:09:24 +0800 Received: (from jijiangl@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t4F69Mnj007932; Fri, 15 May 2015 14:09:22 +0800 From: Jijiang Liu To: dev@dpdk.org Date: Fri, 15 May 2015 14:09:00 +0800 Message-Id: <1431670141-7835-10-git-send-email-jijiang.liu@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1431670141-7835-1-git-send-email-jijiang.liu@intel.com> References: <1431670141-7835-1-git-send-email-jijiang.liu@intel.com> Subject: [dpdk-dev] [PATCH 09/10] examples/tep_termination:add bad Rx checksum statistics of inner IP and L4 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2015 06:09:43 -0000 The number of packets with bad RX IP and L4 checksum in inner header is recorded. Signed-off-by: Jijiang Liu --- 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