From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id C73B02BEA for ; Mon, 29 Aug 2016 16:35:53 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 94F9824E3C; Mon, 29 Aug 2016 16:35:53 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: cunming.liang@intel.com, john.mcnamara@intel.com, andrey.chilikin@intel.com, konstantin.ananyev@intel.com Date: Mon, 29 Aug 2016 16:35:35 +0200 Message-Id: <1472481335-21226-17-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1472481335-21226-1-git-send-email-olivier.matz@6wind.com> References: <1467733310-20875-1-git-send-email-olivier.matz@6wind.com> <1472481335-21226-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 16/16] app/testpmd: display software packet type 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: Mon, 29 Aug 2016 14:35:55 -0000 In addition to the packet type returned by the PMD, also display the packet type calculated by parsing the packet in software. This is particularly useful to compare the 2 values. Note: it does not mean that both hw and sw always have to provide the same value, since it depends on what hardware supports. Signed-off-by: Olivier Matz --- app/test-pmd/rxonly.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index aba07ee..b83d0c7 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -67,6 +67,7 @@ #include #include #include +#include #include "testpmd.h" @@ -93,6 +94,8 @@ pkt_burst_receive(struct fwd_stream *fs) uint16_t i, packet_type; uint16_t is_encapsulation; char buf[256]; + struct rte_net_hdr_lens hdr_lens; + uint32_t sw_packet_type; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; @@ -164,8 +167,26 @@ pkt_burst_receive(struct fwd_stream *fs) mb->vlan_tci, mb->vlan_tci_outer); if (mb->packet_type) { rte_get_ptype_name(mb->packet_type, buf, sizeof(buf)); - printf(" - %s", buf); + printf(" - hw ptype: %s", buf); } + sw_packet_type = rte_net_get_ptype(mb, &hdr_lens, + RTE_PTYPE_ALL_MASK); + rte_get_ptype_name(sw_packet_type, buf, sizeof(buf)); + printf(" - sw ptype: %s", buf); + if (sw_packet_type & RTE_PTYPE_L2_MASK) + printf(" - l2_len=%d", hdr_lens.l2_len); + if (sw_packet_type & RTE_PTYPE_L3_MASK) + printf(" - l3_len=%d", hdr_lens.l3_len); + if (sw_packet_type & RTE_PTYPE_L4_MASK) + printf(" - l4_len=%d", hdr_lens.l4_len); + if (sw_packet_type & RTE_PTYPE_TUNNEL_MASK) + printf(" - tunnel_len=%d", hdr_lens.tunnel_len); + if (sw_packet_type & RTE_PTYPE_INNER_L2_MASK) + printf(" - inner_l2_len=%d", hdr_lens.inner_l2_len); + if (sw_packet_type & RTE_PTYPE_INNER_L3_MASK) + printf(" - inner_l3_len=%d", hdr_lens.inner_l3_len); + if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) + printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; -- 2.8.1