summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authormarek zavodsky <mazavods@gmail.com>2016-07-07 03:16:10 +0200
committerDamjan Marion <damarion@cisco.com>2016-07-14 15:36:21 +0200
commitad2c9c0e7f6b52a0f8f329b097a17c5b35515bdb (patch)
treeb339fd55b3f99f98bcd6c4eeed60e6f9c59756aa /vnet
parente282121d144cda3eb429b55804c9ee2218b33ccb (diff)
Show 802.1q/802.1ah details in the trace output, fixes VPP-111
added one line to dpdk-input trace to display vlan tci when PKT_RX_VLAN_PKT flag set cleaned trace output of af_packet node. Added formatter for vlan_tci. Merged with John Lo's ethernet trace extension: Decode both dot1q and dot1ad VLAN tags in ethernet format function and show what type of vlan tag it is. dpdk-input & ethernet trace output example of ARP: 00:00:41:545481: dpdk-input TenGigabitEthernet8/0/1 rx queue 0 buffer 0x10f2e: current data 0, length 60, free-list 0, totlen-nifb 0, trace 0x1 PKT MBUF: port 4, nb_segs 1, pkt_len 60 buf_len 2176, data_len 60, ol_flags 0x1, data_off 128, phys_addr 0x70e38ac0 packet_type 0x0 Packet Offload Flags PKT_RX_VLAN_PKT (0x0001) RX packet is a 802.1q VLAN packet ID 100 ARP: 8c:60:4f:dd:ca:81 -> ff:ff:ff:ff:ff:ff vlan 802.1q id 100 request, type ethernet/IP4, address size 6/4 8c:60:4f:dd:ca:81/172.16.110.1 -> ff:ff:ff:ff:ff:ff/172.16.110.10 00:00:41:545492: ethernet-input ARP: 8c:60:4f:dd:ca:81 -> ff:ff:ff:ff:ff:ff vlan 802.1q id 100 00:00:41:545499: error-drop ethernet-input: unknown vlan Change-Id: Iae67a945fda4aa2f24032e305a24544dd182b065 Signed-off-by: marek zavodsky <mazavods@gmail.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/af_packet/node.c8
-rw-r--r--vnet/vnet/devices/dpdk/format.c36
-rw-r--r--vnet/vnet/ethernet/ethernet.h1
-rw-r--r--vnet/vnet/ethernet/format.c34
4 files changed, 63 insertions, 16 deletions
diff --git a/vnet/vnet/devices/af_packet/node.c b/vnet/vnet/devices/af_packet/node.c
index 6e2ec46e7ef..c5daf64c72e 100644
--- a/vnet/vnet/devices/af_packet/node.c
+++ b/vnet/vnet/devices/af_packet/node.c
@@ -65,7 +65,7 @@ static u8 * format_af_packet_input_trace (u8 * s, va_list * args)
t->hw_if_index, t->next_index);
s = format (s, "\n%Utpacket2_hdr:\n%Ustatus 0x%x len %u snaplen %u mac %u net %u"
- "\n%Usec 0x%x nsec 0x%x vlan_tci %u"
+ "\n%Usec 0x%x nsec 0x%x vlan %U"
#ifdef TP_STATUS_VLAN_TPID_VALID
" vlan_tpid %u"
#endif
@@ -80,11 +80,11 @@ static u8 * format_af_packet_input_trace (u8 * s, va_list * args)
format_white_space, indent + 4,
t->tph.tp_sec,
t->tph.tp_nsec,
- t->tph.tp_vlan_tci,
+ format_ethernet_vlan_tci, t->tph.tp_vlan_tci
#ifdef TP_STATUS_VLAN_TPID_VALID
- t->tph.tp_vlan_tpid,
+ , t->tph.tp_vlan_tpid
#endif
- t->tph.tp_net);
+ );
return s;
}
diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c
index c3ccc90a479..a8b0363317d 100644
--- a/vnet/vnet/devices/dpdk/format.c
+++ b/vnet/vnet/devices/dpdk/format.c
@@ -604,11 +604,11 @@ u8 * format_dpdk_rx_dma_trace (u8 * s, va_list * va)
#ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS
s = format (s, "\n%U%U",
format_white_space, indent,
- format_dpdk_rx_rte_mbuf, &t->mb);
+ format_dpdk_rx_rte_mbuf, &t->mb, &t->data);
#else
s = format (s, "\n%U%U",
format_white_space, indent,
- format_dpdk_rte_mbuf, &t->mb);
+ format_dpdk_rte_mbuf, &t->mb, &t->data);
#endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */
if (vm->trace_main.verbose)
{
@@ -676,9 +676,28 @@ static inline u8 * format_dpdk_pkt_offload_flags (u8 * s, va_list * va)
return s;
}
+u8 * format_dpdk_rte_mbuf_vlan (u8 * s, va_list * va)
+{
+ ethernet_vlan_header_tv_t * vlan_hdr = va_arg (*va, ethernet_vlan_header_tv_t *);
+
+ if (clib_net_to_host_u16(vlan_hdr->type) == ETHERNET_TYPE_DOT1AD) {
+ s = format (s, "%U vlan 802.1q ",
+ format_ethernet_vlan_tci,
+ clib_net_to_host_u16(vlan_hdr->priority_cfi_and_id));
+ vlan_hdr++;
+ }
+
+ s = format (s, "%U",
+ format_ethernet_vlan_tci,
+ clib_net_to_host_u16(vlan_hdr->priority_cfi_and_id));
+
+ return s;
+}
+
u8 * format_dpdk_rte_mbuf (u8 * s, va_list * va)
{
struct rte_mbuf * mb = va_arg (*va, struct rte_mbuf *);
+ ethernet_header_t *eth_hdr = va_arg (*va, ethernet_header_t *);
uword indent = format_get_indent (s) + 2;
s = format (s, "PKT MBUF: port %d, nb_segs %d, pkt_len %d"
@@ -694,9 +713,15 @@ u8 * format_dpdk_rte_mbuf (u8 * s, va_list * va)
s = format (s, "\n%U%U", format_white_space, indent,
format_dpdk_pkt_offload_flags, &mb->ol_flags);
+ if (mb->ol_flags & PKT_RX_VLAN_PKT) {
+ ethernet_vlan_header_tv_t * vlan_hdr = ((ethernet_vlan_header_tv_t *)&(eth_hdr->type));
+ s = format (s, " %U", format_dpdk_rte_mbuf_vlan, vlan_hdr);
+ }
+
if (mb->packet_type)
s = format (s, "\n%U%U", format_white_space, indent,
format_dpdk_pkt_types, &mb->packet_type);
+
return s;
}
@@ -729,6 +754,7 @@ static inline u8 * format_dpdk_pkt_rx_offload_flags (u8 * s, va_list * va)
u8 * format_dpdk_rx_rte_mbuf (u8 * s, va_list * va)
{
struct rte_mbuf * mb = va_arg (*va, struct rte_mbuf *);
+ ethernet_header_t *eth_hdr = va_arg (*args, ethernet_header_t *);
uword indent = format_get_indent (s) + 2;
/*
@@ -748,9 +774,15 @@ u8 * format_dpdk_rx_rte_mbuf (u8 * s, va_list * va)
s = format (s, "\n%U%U", format_white_space, indent,
format_dpdk_pkt_rx_offload_flags, &mb->ol_flags);
+ if (mb->ol_flags & PKT_RX_VLAN_PKT) {
+ ethernet_vlan_header_tv_t * vlan_hdr = ((ethernet_vlan_header_tv_t *)&(eth_hdr->type));
+ s = format (s, " %U", format_dpdk_rte_mbuf_vlan, vlan_hdr);
+ }
+
if (mb->packet_type)
s = format (s, "\n%U%U", format_white_space, indent,
format_dpdk_pkt_types, &mb->packet_type);
+
return s;
}
#endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */
diff --git a/vnet/vnet/ethernet/ethernet.h b/vnet/vnet/ethernet/ethernet.h
index 97c66e7593a..4735e20b851 100644
--- a/vnet/vnet/ethernet/ethernet.h
+++ b/vnet/vnet/ethernet/ethernet.h
@@ -264,6 +264,7 @@ ethernet_register_l3_redirect (vlib_main_t * vm,
/* Formats ethernet address X:X:X:X:X:X */
u8 * format_ethernet_address (u8 * s, va_list * args);
u8 * format_ethernet_type (u8 * s, va_list * args);
+u8 * format_ethernet_vlan_tci (u8 * s, va_list * va);
u8 * format_ethernet_header (u8 * s, va_list * args);
u8 * format_ethernet_header_with_length (u8 * s, va_list * args);
diff --git a/vnet/vnet/ethernet/format.c b/vnet/vnet/ethernet/format.c
index f6fc6e21456..0e581ff9fa4 100644
--- a/vnet/vnet/ethernet/format.c
+++ b/vnet/vnet/ethernet/format.c
@@ -67,6 +67,23 @@ u8 * format_ethernet_type (u8 * s, va_list * args)
return s;
}
+u8 * format_ethernet_vlan_tci (u8 * s, va_list * va)
+{
+ u32 vlan_tci = va_arg (*va, u32);
+
+ u32 vid = (vlan_tci & 0xfff);
+ u32 cfi = (vlan_tci >> 12) & 1;
+ u32 pri = (vlan_tci >> 13);
+
+ s = format (s, "id %d", vid);
+ if (pri != 0)
+ s = format (s, " priority %d", pri);
+ if (cfi != 0)
+ s = format (s, " cfi");
+
+ return s;
+}
+
u8 * format_ethernet_header_with_length (u8 * s, va_list * args)
{
ethernet_max_header_t * m = va_arg (*args, ethernet_max_header_t *);
@@ -75,12 +92,14 @@ u8 * format_ethernet_header_with_length (u8 * s, va_list * args)
ethernet_header_t * e = &m->ethernet;
ethernet_vlan_header_t * v;
ethernet_type_t type = clib_net_to_host_u16 (e->type);
+ ethernet_type_t vlan_type[ARRAY_LEN(m->vlan)];
u32 n_vlan = 0, i, header_bytes;
uword indent;
- while (type == ETHERNET_TYPE_VLAN
+ while ((type == ETHERNET_TYPE_VLAN || type == ETHERNET_TYPE_DOT1AD)
&& n_vlan < ARRAY_LEN (m->vlan))
{
+ vlan_type[n_vlan] = type;
v = m->vlan + n_vlan;
type = clib_net_to_host_u16 (v->type);
n_vlan++;
@@ -100,15 +119,10 @@ u8 * format_ethernet_header_with_length (u8 * s, va_list * args)
for (i = 0; i < n_vlan; i++)
{
u32 v = clib_net_to_host_u16 (m->vlan[i].priority_cfi_and_id);
- u32 vid = (v & 0xfff);
- u32 cfi = (v >> 12) & 1;
- u32 pri = (v >> 13);
-
- s = format (s, " vlan %d", vid);
- if (pri != 0)
- s = format (s, " priority %d", pri);
- if (cfi != 0)
- s = format (s, " cfi");
+ if (*vlan_type == ETHERNET_TYPE_VLAN)
+ s = format (s, " vlan 802.1q %U", format_ethernet_vlan_tci, v);
+ else
+ s = format (s, " vlan 802.1ad %U", format_ethernet_vlan_tci, v);
}
if (max_header_bytes != 0 && header_bytes < max_header_bytes)