All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: cunming.liang@intel.com, john.mcnamara@intel.com,
	andrey.chilikin@intel.com, konstantin.ananyev@intel.com
Subject: [PATCH v3 15/16] app/testpmd: dump ptype using the new function
Date: Mon,  3 Oct 2016 10:38:56 +0200	[thread overview]
Message-ID: <1475483937-21696-16-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1475483937-21696-1-git-send-email-olivier.matz@6wind.com>

Use the function introduced in previous commit to dump the packet type
of the received packet.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/rxonly.c | 175 ++------------------------------------------------
 1 file changed, 4 insertions(+), 171 deletions(-)

diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index b1fc5bf..9a6e394 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -91,6 +91,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 	uint16_t nb_rx;
 	uint16_t i, packet_type;
 	uint16_t is_encapsulation;
+	char buf[256];
 
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t start_tsc;
@@ -161,177 +162,9 @@ pkt_burst_receive(struct fwd_stream *fs)
 			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
 					mb->vlan_tci, mb->vlan_tci_outer);
 		if (mb->packet_type) {
-			uint32_t ptype;
-
-			/* (outer) L2 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_L2_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_L2_ETHER:
-				printf(" - (outer) L2 type: ETHER");
-				break;
-			case RTE_PTYPE_L2_ETHER_TIMESYNC:
-				printf(" - (outer) L2 type: ETHER_Timesync");
-				break;
-			case RTE_PTYPE_L2_ETHER_ARP:
-				printf(" - (outer) L2 type: ETHER_ARP");
-				break;
-			case RTE_PTYPE_L2_ETHER_LLDP:
-				printf(" - (outer) L2 type: ETHER_LLDP");
-				break;
-			case RTE_PTYPE_L2_ETHER_NSH:
-				printf(" - (outer) L2 type: ETHER_NSH");
-				break;
-			default:
-				printf(" - (outer) L2 type: Unknown");
-				break;
-			}
-
-			/* (outer) L3 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_L3_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_L3_IPV4:
-				printf(" - (outer) L3 type: IPV4");
-				break;
-			case RTE_PTYPE_L3_IPV4_EXT:
-				printf(" - (outer) L3 type: IPV4_EXT");
-				break;
-			case RTE_PTYPE_L3_IPV6:
-				printf(" - (outer) L3 type: IPV6");
-				break;
-			case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN:
-				printf(" - (outer) L3 type: IPV4_EXT_UNKNOWN");
-				break;
-			case RTE_PTYPE_L3_IPV6_EXT:
-				printf(" - (outer) L3 type: IPV6_EXT");
-				break;
-			case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN:
-				printf(" - (outer) L3 type: IPV6_EXT_UNKNOWN");
-				break;
-			default:
-				printf(" - (outer) L3 type: Unknown");
-				break;
-			}
-
-			/* (outer) L4 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_L4_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_L4_TCP:
-				printf(" - (outer) L4 type: TCP");
-				break;
-			case RTE_PTYPE_L4_UDP:
-				printf(" - (outer) L4 type: UDP");
-				break;
-			case RTE_PTYPE_L4_FRAG:
-				printf(" - (outer) L4 type: L4_FRAG");
-				break;
-			case RTE_PTYPE_L4_SCTP:
-				printf(" - (outer) L4 type: SCTP");
-				break;
-			case RTE_PTYPE_L4_ICMP:
-				printf(" - (outer) L4 type: ICMP");
-				break;
-			case RTE_PTYPE_L4_NONFRAG:
-				printf(" - (outer) L4 type: L4_NONFRAG");
-				break;
-			default:
-				printf(" - (outer) L4 type: Unknown");
-				break;
-			}
-
-			/* packet tunnel type */
-			ptype = mb->packet_type & RTE_PTYPE_TUNNEL_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_TUNNEL_IP:
-				printf(" - Tunnel type: IP");
-				break;
-			case RTE_PTYPE_TUNNEL_GRE:
-				printf(" - Tunnel type: GRE");
-				break;
-			case RTE_PTYPE_TUNNEL_VXLAN:
-				printf(" - Tunnel type: VXLAN");
-				break;
-			case RTE_PTYPE_TUNNEL_NVGRE:
-				printf(" - Tunnel type: NVGRE");
-				break;
-			case RTE_PTYPE_TUNNEL_GENEVE:
-				printf(" - Tunnel type: GENEVE");
-				break;
-			case RTE_PTYPE_TUNNEL_GRENAT:
-				printf(" - Tunnel type: GRENAT");
-				break;
-			default:
-				printf(" - Tunnel type: Unknown");
-				break;
-			}
-
-			/* inner L2 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_INNER_L2_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_INNER_L2_ETHER:
-				printf(" - Inner L2 type: ETHER");
-				break;
-			case RTE_PTYPE_INNER_L2_ETHER_VLAN:
-				printf(" - Inner L2 type: ETHER_VLAN");
-				break;
-			default:
-				printf(" - Inner L2 type: Unknown");
-				break;
-			}
-
-			/* inner L3 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_INNER_L3_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_INNER_L3_IPV4:
-				printf(" - Inner L3 type: IPV4");
-				break;
-			case RTE_PTYPE_INNER_L3_IPV4_EXT:
-				printf(" - Inner L3 type: IPV4_EXT");
-				break;
-			case RTE_PTYPE_INNER_L3_IPV6:
-				printf(" - Inner L3 type: IPV6");
-				break;
-			case RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN:
-				printf(" - Inner L3 type: IPV4_EXT_UNKNOWN");
-				break;
-			case RTE_PTYPE_INNER_L3_IPV6_EXT:
-				printf(" - Inner L3 type: IPV6_EXT");
-				break;
-			case RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN:
-				printf(" - Inner L3 type: IPV6_EXT_UNKNOWN");
-				break;
-			default:
-				printf(" - Inner L3 type: Unknown");
-				break;
-			}
-
-			/* inner L4 packet type */
-			ptype = mb->packet_type & RTE_PTYPE_INNER_L4_MASK;
-			switch (ptype) {
-			case RTE_PTYPE_INNER_L4_TCP:
-				printf(" - Inner L4 type: TCP");
-				break;
-			case RTE_PTYPE_INNER_L4_UDP:
-				printf(" - Inner L4 type: UDP");
-				break;
-			case RTE_PTYPE_INNER_L4_FRAG:
-				printf(" - Inner L4 type: L4_FRAG");
-				break;
-			case RTE_PTYPE_INNER_L4_SCTP:
-				printf(" - Inner L4 type: SCTP");
-				break;
-			case RTE_PTYPE_INNER_L4_ICMP:
-				printf(" - Inner L4 type: ICMP");
-				break;
-			case RTE_PTYPE_INNER_L4_NONFRAG:
-				printf(" - Inner L4 type: L4_NONFRAG");
-				break;
-			default:
-				printf(" - Inner L4 type: Unknown");
-				break;
-			}
-			printf("\n");
-		} else
-			printf("Unknown packet type\n");
+			rte_get_ptype_name(mb->packet_type, buf, sizeof(buf));
+			printf(" - %s", buf);
+		}
 		if (is_encapsulation) {
 			struct ipv4_hdr *ipv4_hdr;
 			struct ipv6_hdr *ipv6_hdr;
-- 
2.8.1

  parent reply	other threads:[~2016-10-03  8:39 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 15:41 [PATCH 00/18] software parser for packet type Olivier Matz
2016-07-05 15:41 ` [PATCH 01/18] doc: add template for release notes 16.11 Olivier Matz
2016-07-06 11:48   ` Mcnamara, John
2016-07-06 12:00     ` Olivier MATZ
2016-07-05 15:41 ` [PATCH 02/18] mbuf: add function to read packet data Olivier Matz
2016-07-05 15:41 ` [PATCH 03/18] net: move Ethernet header definitions to the net library Olivier Matz
2016-07-05 15:41 ` [PATCH 04/18] mbuf: move packet type definitions in a new file Olivier Matz
2016-07-05 15:41 ` [PATCH 05/18] mbuf: add function to get packet type from data Olivier Matz
2016-07-06  6:44   ` Liang, Cunming
2016-07-06  7:42     ` Olivier MATZ
2016-07-06 11:59       ` Chilikin, Andrey
2016-07-06 12:08         ` Olivier MATZ
2016-07-06 12:21           ` Chilikin, Andrey
2016-07-07  8:19       ` Liang, Cunming
2016-07-07 15:48         ` Olivier Matz
2016-07-08 10:08           ` Liang, Cunming
2016-07-05 15:41 ` [PATCH 06/18] mbuf: support Vlan in software packet type parser Olivier Matz
2016-07-05 15:41 ` [PATCH 07/18] mbuf: support QinQ " Olivier Matz
2016-07-05 15:41 ` [PATCH 08/18] net: add Mpls header structure Olivier Matz
2016-07-05 15:41 ` [PATCH 09/18] mbuf: support Mpls in software packet type parser Olivier Matz
2016-07-06  7:08   ` Liang, Cunming
2016-07-06  8:00     ` Olivier MATZ
2016-07-07  8:48       ` Liang, Cunming
2016-07-07 16:01         ` Olivier Matz
2016-07-05 15:41 ` [PATCH 10/18] mbuf: support Ip tunnels " Olivier Matz
2016-07-05 15:41 ` [PATCH 11/18] net: add Gre header structure Olivier Matz
2016-07-05 15:41 ` [PATCH 12/18] mbuf: support Gre in software packet type parser Olivier Matz
2016-07-05 15:41 ` [PATCH 13/18] mbuf: support Nvgre " Olivier Matz
2016-07-05 15:41 ` [PATCH 14/18] mbuf: get ptype for the first layers only Olivier Matz
2016-07-05 15:41 ` [PATCH 15/18] mbuf: add functions to dump packet type Olivier Matz
2016-07-05 15:41 ` [PATCH 16/18] mbuf: clarify definition of fragment packet types Olivier Matz
2016-07-05 15:41 ` [PATCH 17/18] app/testpmd: dump ptype using the new function Olivier Matz
2016-07-05 15:41 ` [PATCH 18/18] app/testpmd: display sw packet type Olivier Matz
2016-08-29 14:35 ` [PATCH v2 00/16] software parser for " Olivier Matz
2016-08-29 14:35   ` [PATCH v2 01/16] mbuf: add function to read packet data Olivier Matz
2016-08-29 14:35   ` [PATCH v2 02/16] net: move Ethernet header definitions to the net library Olivier Matz
2016-08-29 14:35   ` [PATCH v2 03/16] mbuf: move packet type definitions in a new file Olivier Matz
2016-08-29 14:35   ` [PATCH v2 04/16] net: introduce net library Olivier Matz
2016-08-29 14:35   ` [PATCH v2 05/16] net: add function to get packet type from data Olivier Matz
2016-08-29 14:35   ` [PATCH v2 06/16] net: support Vlan in software packet type parser Olivier Matz
2016-08-29 14:35   ` [PATCH v2 07/16] net: support QinQ " Olivier Matz
2016-08-29 14:35   ` [PATCH v2 08/16] net: support Ip tunnels " Olivier Matz
2016-08-29 14:35   ` [PATCH v2 09/16] net: add Gre header structure Olivier Matz
2016-08-29 14:35   ` [PATCH v2 10/16] net: support Gre in software packet type parser Olivier Matz
2016-08-29 14:35   ` [PATCH v2 11/16] net: support Nvgre " Olivier Matz
2016-08-29 14:35   ` [PATCH v2 12/16] net: get ptype for the first layers only Olivier Matz
2016-08-29 14:35   ` [PATCH v2 13/16] mbuf: add functions to dump packet type Olivier Matz
2016-08-29 14:35   ` [PATCH v2 14/16] mbuf: clarify definition of fragment packet types Olivier Matz
2016-08-29 14:35   ` [PATCH v2 15/16] app/testpmd: dump ptype using the new function Olivier Matz
2016-08-29 14:35   ` [PATCH v2 16/16] app/testpmd: display software packet type Olivier Matz
2016-10-03  8:38   ` [PATCH v3 00/16] software parser for " Olivier Matz
2016-10-03  8:38     ` [PATCH v3 01/16] mbuf: add function to read packet data Olivier Matz
2016-10-03  8:38     ` [PATCH v3 02/16] net: move Ethernet header definitions to the net library Olivier Matz
2016-10-03  8:38     ` [PATCH v3 03/16] mbuf: move packet type definitions in a new file Olivier Matz
2016-10-10 14:52       ` Thomas Monjalon
2016-10-11  9:01         ` Olivier MATZ
2016-10-11 15:51           ` Thomas Monjalon
2016-10-03  8:38     ` [PATCH v3 04/16] net: introduce net library Olivier Matz
2016-10-03  8:38     ` [PATCH v3 05/16] net: add function to get packet type from data Olivier Matz
2016-10-03  8:38     ` [PATCH v3 06/16] net: support Vlan in software packet type parser Olivier Matz
2016-10-03  8:38     ` [PATCH v3 07/16] net: support QinQ " Olivier Matz
2016-10-03  8:38     ` [PATCH v3 08/16] net: support Ip tunnels " Olivier Matz
2016-10-03  8:38     ` [PATCH v3 09/16] net: add Gre header structure Olivier Matz
2016-10-03  8:38     ` [PATCH v3 10/16] net: support Gre in software packet type parser Olivier Matz
2016-10-03  8:38     ` [PATCH v3 11/16] net: support Nvgre " Olivier Matz
2016-10-03  8:38     ` [PATCH v3 12/16] net: get ptype for the first layers only Olivier Matz
2016-10-03  8:38     ` [PATCH v3 13/16] mbuf: add functions to dump packet type Olivier Matz
2016-10-03  8:38     ` [PATCH v3 14/16] mbuf: clarify definition of fragment packet types Olivier Matz
2016-10-03  8:38     ` Olivier Matz [this message]
2016-10-03  8:38     ` [PATCH v3 16/16] app/testpmd: display software packet type Olivier Matz
2016-10-11 16:24     ` [PATCH v3 00/16] software parser for " Thomas Monjalon

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=1475483937-21696-16-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=andrey.chilikin@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.