pcap: fix storage of name and type in queues
[dpdk.git] / app / test-pmd / rxonly.c
index a5a80a7..ac56090 100644 (file)
@@ -51,7 +51,6 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 
 #include "testpmd.h"
 
-#define MAX_PKT_RX_FLAGS 13
-static const char *pkt_rx_flag_names[MAX_PKT_RX_FLAGS] = {
-       "VLAN_PKT",
-       "RSS_HASH",
-       "PKT_RX_FDIR",
-       "IP_CKSUM",
-       "IP_CKSUM_BAD",
-
-       "IPV4_HDR",
-       "IPV4_HDR_EXT",
-       "IPV6_HDR",
-       "IPV6_HDR_EXT",
-
-       "IEEE1588_PTP",
-       "IEEE1588_TMST",
-
-       "TUNNEL_IPV4_HDR",
-       "TUNNEL_IPV6_HDR",
-};
-
 static inline void
 print_ether_addr(const char *what, struct ether_addr *eth_addr)
 {
-       printf("%s%02X:%02X:%02X:%02X:%02X:%02X",
-              what,
-              eth_addr->addr_bytes[0],
-              eth_addr->addr_bytes[1],
-              eth_addr->addr_bytes[2],
-              eth_addr->addr_bytes[3],
-              eth_addr->addr_bytes[4],
-              eth_addr->addr_bytes[5]);
+       char buf[ETHER_ADDR_FMT_SIZE];
+       ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+       printf("%s%s", what, buf);
 }
 
 /*
@@ -172,10 +146,18 @@ pkt_burst_receive(struct fwd_stream *fs)
                if (ol_flags & PKT_RX_RSS_HASH) {
                        printf(" - RSS hash=0x%x", (unsigned) mb->hash.rss);
                        printf(" - RSS queue=0x%x",(unsigned) fs->rx_queue);
+               } else if (ol_flags & PKT_RX_FDIR) {
+                       printf(" - FDIR matched ");
+                       if (ol_flags & PKT_RX_FDIR_ID)
+                               printf("ID=0x%x",
+                                      mb->hash.fdir.hi);
+                       else if (ol_flags & PKT_RX_FDIR_FLX)
+                               printf("flex bytes=0x%08x %08x",
+                                      mb->hash.fdir.hi, mb->hash.fdir.lo);
+                       else
+                               printf("hash=0x%x ID=0x%x ",
+                                      mb->hash.fdir.hash, mb->hash.fdir.id);
                }
-               else if (ol_flags & PKT_RX_FDIR)
-                       printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
-                              mb->hash.fdir.hash, mb->hash.fdir.id);
                if (ol_flags & PKT_RX_VLAN_PKT)
                        printf(" - VLAN tci=0x%x", mb->vlan_tci);
                if (is_encapsulation) {
@@ -210,7 +192,7 @@ pkt_burst_receive(struct fwd_stream *fs)
                                                unsigned char *) + l2_len + l3_len
                                                 + l4_len);
 
-                               printf(" - VxLAN packet: packet type =%d, "
+                               printf(" - VXLAN packet: packet type =%d, "
                                        "Destination UDP port =%d, VNI = %d",
                                        packet_type, RTE_BE_TO_CPU_16(udp_hdr->dst_port),
                                        rte_be_to_cpu_32(vxlan_hdr->vx_vni) >> 8);
@@ -219,12 +201,16 @@ pkt_burst_receive(struct fwd_stream *fs)
                printf(" - Receive queue=0x%x", (unsigned) fs->rx_queue);
                printf("\n");
                if (ol_flags != 0) {
-                       int rxf;
-
-                       for (rxf = 0; rxf < MAX_PKT_RX_FLAGS; rxf++) {
-                               if (ol_flags & (1 << rxf))
-                                       printf("  PKT_RX_%s\n",
-                                              pkt_rx_flag_names[rxf]);
+                       unsigned rxf;
+                       const char *name;
+
+                       for (rxf = 0; rxf < sizeof(mb->ol_flags) * 8; rxf++) {
+                               if ((ol_flags & (1ULL << rxf)) == 0)
+                                       continue;
+                               name = rte_get_rx_ol_flag_name(1ULL << rxf);
+                               if (name == NULL)
+                                       continue;
+                               printf("  %s\n", name);
                        }
                }
                rte_pktmbuf_free(mb);