app/testpmd: dump packet type with new function
[dpdk.git] / app / test-pmd / rxonly.c
index b8e35ab..9a6e394 100644 (file)
@@ -56,7 +56,6 @@
 #include <rte_lcore.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
-#include <rte_ring.h>
 #include <rte_memory.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
@@ -91,7 +90,8 @@ pkt_burst_receive(struct fwd_stream *fs)
        uint64_t ol_flags;
        uint16_t nb_rx;
        uint16_t i, packet_type;
-       uint64_t is_encapsulation;
+       uint16_t is_encapsulation;
+       char buf[256];
 
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
        uint64_t start_tsc;
@@ -134,9 +134,7 @@ pkt_burst_receive(struct fwd_stream *fs)
                eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);
                ol_flags = mb->ol_flags;
                packet_type = mb->packet_type;
-
-               is_encapsulation = ol_flags & (PKT_RX_TUNNEL_IPV4_HDR |
-                               PKT_RX_TUNNEL_IPV6_HDR);
+               is_encapsulation = RTE_ETH_IS_TUNNEL_PKT(packet_type);
 
                print_ether_addr("  src=", &eth_hdr->s_addr);
                print_ether_addr(" - dst=", &eth_hdr->d_addr);
@@ -158,8 +156,15 @@ pkt_burst_receive(struct fwd_stream *fs)
                                printf("hash=0x%x ID=0x%x ",
                                       mb->hash.fdir.hash, mb->hash.fdir.id);
                }
-               if (ol_flags & PKT_RX_VLAN_PKT)
+               if (ol_flags & PKT_RX_VLAN_STRIPPED)
                        printf(" - VLAN tci=0x%x", mb->vlan_tci);
+               if (ol_flags & PKT_RX_QINQ_STRIPPED)
+                       printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
+                                       mb->vlan_tci, mb->vlan_tci_outer);
+               if (mb->packet_type) {
+                       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;
@@ -173,7 +178,7 @@ pkt_burst_receive(struct fwd_stream *fs)
                        l2_len  = sizeof(struct ether_hdr);
 
                         /* Do not support ipv4 option field */
-                       if (ol_flags & PKT_RX_TUNNEL_IPV4_HDR) {
+                       if (RTE_ETH_IS_IPV4_HDR(packet_type)) {
                                l3_len = sizeof(struct ipv4_hdr);
                                ipv4_hdr = rte_pktmbuf_mtod_offset(mb,
                                                                   struct ipv4_hdr *,