27 #if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0) 28 #define foreach_dpdk_counter \ 29 _ (tx_frames_ok, opackets) \ 30 _ (tx_bytes_ok, obytes) \ 31 _ (tx_errors, oerrors) \ 32 _ (tx_loopback_frames_ok, olbpackets) \ 33 _ (tx_loopback_bytes_ok, olbbytes) \ 34 _ (rx_frames_ok, ipackets) \ 35 _ (rx_bytes_ok, ibytes) \ 36 _ (rx_errors, ierrors) \ 37 _ (rx_missed, imissed) \ 38 _ (rx_multicast_frames_ok, imcasts) \ 39 _ (rx_no_bufs, rx_nombuf) \ 40 _ (rx_loopback_frames_ok, ilbpackets) \ 41 _ (rx_loopback_bytes_ok, ilbbytes) 43 #define foreach_dpdk_counter \ 44 _ (tx_frames_ok, opackets) \ 45 _ (tx_bytes_ok, obytes) \ 46 _ (tx_errors, oerrors) \ 47 _ (tx_loopback_frames_ok, olbpackets) \ 48 _ (tx_loopback_bytes_ok, olbbytes) \ 49 _ (rx_frames_ok, ipackets) \ 50 _ (rx_bytes_ok, ibytes) \ 51 _ (rx_errors, ierrors) \ 52 _ (rx_missed, imissed) \ 53 _ (rx_bad_crc, ibadcrc) \ 54 _ (rx_bad_length, ibadlen) \ 55 _ (rx_multicast_frames_ok, imcasts) \ 56 _ (rx_no_bufs, rx_nombuf) \ 57 _ (rx_filter_match, fdirmatch) \ 58 _ (rx_filter_miss, fdirmiss) \ 59 _ (tx_pause_xon, tx_pause_xon) \ 60 _ (rx_pause_xon, rx_pause_xon) \ 61 _ (tx_pause_xoff, tx_pause_xoff) \ 62 _ (rx_pause_xoff, rx_pause_xoff) \ 63 _ (rx_loopback_frames_ok, ilbpackets) \ 64 _ (rx_loopback_bytes_ok, ilbbytes) 67 #define foreach_dpdk_q_counter \ 68 _ (rx_frames_ok, q_ipackets) \ 69 _ (tx_frames_ok, q_opackets) \ 70 _ (rx_bytes_ok, q_ibytes) \ 71 _ (tx_bytes_ok, q_obytes) \ 72 _ (rx_errors, q_errors) 74 #define foreach_dpdk_rss_hf \ 75 _(ETH_RSS_IPV4, "ipv4") \ 76 _(ETH_RSS_FRAG_IPV4, "ipv4-frag") \ 77 _(ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \ 78 _(ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \ 79 _(ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \ 80 _(ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \ 81 _(ETH_RSS_IPV6, "ipv6") \ 82 _(ETH_RSS_FRAG_IPV6, "ipv6-frag") \ 83 _(ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \ 84 _(ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \ 85 _(ETH_RSS_NONFRAG_IPV6_SCTP, "ipv6-sctp") \ 86 _(ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \ 87 _(ETH_RSS_L2_PAYLOAD, "l2-payload") \ 88 _(ETH_RSS_IPV6_EX, "ipv6-ex") \ 89 _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ 90 _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") 92 #define foreach_dpdk_rx_offload_caps \ 93 _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \ 94 _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 95 _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 96 _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 97 _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \ 98 _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip") 100 #define foreach_dpdk_tx_offload_caps \ 101 _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \ 102 _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 103 _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 104 _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 105 _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \ 106 _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \ 107 _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \ 108 _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \ 109 _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert") 111 #if RTE_VERSION >= RTE_VERSION_NUM(2, 1, 0, 0) 113 #define foreach_dpdk_pkt_rx_offload_flag \ 114 _ (PKT_RX_VLAN_PKT, "RX packet is a 802.1q VLAN packet") \ 115 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \ 116 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \ 117 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \ 118 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \ 119 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \ 120 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") 122 #define foreach_dpdk_pkt_type \ 123 _ (L2, ETHER, "Ethernet packet") \ 124 _ (L2, ETHER_TIMESYNC, "Ethernet packet for time sync") \ 125 _ (L2, ETHER_ARP, "ARP packet") \ 126 _ (L2, ETHER_LLDP, "LLDP (Link Layer Discovery Protocol) packet") \ 127 _ (L3, IPV4, "IPv4 packet without extension headers") \ 128 _ (L3, IPV4_EXT, "IPv4 packet with extension headers") \ 129 _ (L3, IPV4_EXT_UNKNOWN, "IPv4 packet with or without extension headers") \ 130 _ (L3, IPV6, "IPv6 packet without extension headers") \ 131 _ (L3, IPV6_EXT, "IPv6 packet with extension headers") \ 132 _ (L3, IPV6_EXT_UNKNOWN, "IPv6 packet with or without extension headers") \ 133 _ (L4, TCP, "TCP packet") \ 134 _ (L4, UDP, "UDP packet") \ 135 _ (L4, FRAG, "Fragmented IP packet") \ 136 _ (L4, SCTP, "SCTP (Stream Control Transmission Protocol) packet") \ 137 _ (L4, ICMP, "ICMP packet") \ 138 _ (L4, NONFRAG, "Non-fragmented IP packet") \ 139 _ (TUNNEL, GRE, "GRE tunneling packet") \ 140 _ (TUNNEL, VXLAN, "VXLAN tunneling packet") \ 141 _ (TUNNEL, NVGRE, "NVGRE Tunneling packet") \ 142 _ (TUNNEL, GENEVE, "GENEVE Tunneling packet") \ 143 _ (TUNNEL, GRENAT, "Teredo, VXLAN or GRE Tunneling packet") \ 144 _ (INNER_L2, ETHER, "Inner Ethernet packet") \ 145 _ (INNER_L2, ETHER_VLAN, "Inner Ethernet packet with VLAN") \ 146 _ (INNER_L3, IPV4, "Inner IPv4 packet without extension headers") \ 147 _ (INNER_L3, IPV4_EXT, "Inner IPv4 packet with extension headers") \ 148 _ (INNER_L3, IPV4_EXT_UNKNOWN, "Inner IPv4 packet with or without extension headers") \ 149 _ (INNER_L3, IPV6, "Inner IPv6 packet without extension headers") \ 150 _ (INNER_L3, IPV6_EXT, "Inner IPv6 packet with extension headers") \ 151 _ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \ 152 _ (INNER_L4, TCP, "Inner TCP packet") \ 153 _ (INNER_L4, UDP, "Inner UDP packet") \ 154 _ (INNER_L4, FRAG, "Inner fagmented IP packet") \ 155 _ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \ 156 _ (INNER_L4, ICMP, "Inner ICMP packet") \ 157 _ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet") 160 #define foreach_dpdk_pkt_rx_offload_flag \ 161 _ (PKT_RX_VLAN_PKT, "RX packet is a 802.1q VLAN packet") \ 162 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \ 163 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \ 164 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \ 165 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \ 166 _ (PKT_RX_IPV4_HDR, "RX packet with IPv4 header") \ 167 _ (PKT_RX_IPV4_HDR_EXT, "RX packet with extended IPv4 header") \ 168 _ (PKT_RX_IPV6_HDR, "RX packet with IPv6 header") \ 169 _ (PKT_RX_IPV6_HDR_EXT, "RX packet with extended IPv6 header") \ 170 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \ 171 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") 173 #define foreach_dpdk_pkt_type 176 #define foreach_dpdk_pkt_tx_offload_flag \ 177 _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \ 178 _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \ 179 _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \ 180 _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \ 181 _ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp") 183 #define foreach_dpdk_pkt_offload_flag \ 184 foreach_dpdk_pkt_rx_offload_flag \ 185 foreach_dpdk_pkt_tx_offload_flag 187 #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS 188 #define foreach_dpdk_pkt_ext_rx_offload_flag \ 189 _ (PKT_EXT_RX_PKT_ERROR, "RX Packet Error") \ 190 _ (PKT_EXT_RX_BAD_FCS, "RX Bad FCS checksum") \ 191 _ (PKT_EXT_RX_UDP, "RX packet with UDP L4 header") \ 192 _ (PKT_EXT_RX_TCP, "RX packet with TCP L4 header") \ 193 _ (PKT_EXT_RX_IPV4_FRAGMENT, "RX packet IPv4 Fragment") 195 #define foreach_dpdk_pkt_ext_offload_flag \ 196 foreach_dpdk_pkt_rx_offload_flag \ 197 foreach_dpdk_pkt_ext_rx_offload_flag 204 char *devname_format;
207 struct rte_eth_dev_info dev_info;
211 devname_format =
"%s%d/%d/%d";
213 devname_format =
"%s%x/%x/%x";
215 #ifdef RTE_LIBRTE_KNI 226 device_name =
"GigabitEthernet";
230 device_name =
"TenGigabitEthernet";
234 device_name =
"FortyGigabitEthernet";
241 device_name =
"EthernetSwitch";
245 case VNET_DPDK_PORT_TYPE_NETMAP:
246 rte_eth_dev_info_get(i, &dev_info);
247 return format(s,
"netmap:%s", dev_info.driver_name);
251 rte_eth_dev_info_get(i, &dev_info);
256 device_name =
"UnknownEthernet";
260 rte_eth_dev_info_get(i, &dev_info);
261 ret =
format (s, devname_format, device_name, dev_info.pci_dev->addr.bus,
262 dev_info.pci_dev->addr.devid,
263 dev_info.pci_dev->addr.function);
266 if (dm->
devices[i].
pmd == VNET_DPDK_PMD_CXGBE) {
267 struct rte_eth_dev_info di;
270 rte_eth_dev_info_get(i+1, &di);
271 if (di.pci_dev && memcmp(&dev_info.pci_dev->addr, &di.pci_dev->addr,
272 sizeof(
struct rte_pci_addr)) == 0)
276 rte_eth_dev_info_get(i-1, &di);
277 if (di.pci_dev && memcmp(&dev_info.pci_dev->addr, &di.pci_dev->addr,
278 sizeof(
struct rte_pci_addr)) == 0)
291 return format(s,
"Kernel NIC Interface");
293 return format(s,
"vhost-user interface");
298 case VNET_DPDK_PMD_E1000EM:
299 dev_type =
"Intel 82540EM (e1000)";
302 case VNET_DPDK_PMD_IGB:
303 dev_type =
"Intel e1000";
306 case VNET_DPDK_PMD_I40E:
307 dev_type =
"Intel X710/XL710 Family";
310 case VNET_DPDK_PMD_I40EVF:
311 dev_type =
"Intel X710/XL710 Family VF";
314 case VNET_DPDK_PMD_FM10K:
315 dev_type =
"Intel FM10000 Family Ethernet Switch";
318 case VNET_DPDK_PMD_IGBVF:
319 dev_type =
"Intel e1000 VF";
322 case VNET_DPDK_PMD_VIRTIO:
323 dev_type =
"Red Hat Virtio";
326 case VNET_DPDK_PMD_IXGBEVF:
327 dev_type =
"Intel 82599 VF";
330 case VNET_DPDK_PMD_IXGBE:
331 dev_type =
"Intel 82599";
334 case VNET_DPDK_PMD_VICE:
335 case VNET_DPDK_PMD_ENIC:
336 dev_type =
"Cisco VIC";
339 case VNET_DPDK_PMD_CXGBE:
340 dev_type =
"Chelsio T4/T5";
343 case VNET_DPDK_PMD_VMXNET3:
344 dev_type =
"VMware VMXNET3";
348 case VNET_DPDK_PMD_NETMAP:
349 dev_type =
"Netmap/Vale";
353 case VNET_DPDK_PMD_AF_PACKET:
354 dev_type =
"af_packet";
357 case VNET_DPDK_PMD_BOND:
358 dev_type =
"Ethernet Bonding";
363 dev_type =
"### UNKNOWN ###";
367 return format (s, dev_type);
373 struct rte_eth_link * l = &xd->
link;
377 s =
format (s,
"%s ", l->link_status ?
"up" :
"down");
382 s =
format (s,
"%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
384 s =
format (s,
"speed %u mtu %d %s\n", l->link_speed,
396 if (format_get_indent (s) > next_split ) { \ 397 next_split += _line_len; \ 398 s = format(s,"\n%U", format_white_space, indent); \ 400 s = format(s, "%s ", str); \ 405 u64 bitmap = va_arg (*args,
u64);
406 int next_split = _line_len;
419 u32 bitmap = va_arg (*args,
u32);
420 int next_split = _line_len;
433 u32 bitmap = va_arg (*args,
u32);
434 int next_split = _line_len;
449 u32 dev_instance = va_arg (*args,
u32);
450 int verbose = va_arg (*args,
int);
459 s =
format (s,
"%U\n%Ucarrier %U",
466 struct rte_eth_dev_info di;
467 struct rte_pci_device * pci;
468 struct rte_eth_rss_conf rss_conf;
471 rss_conf.rss_key = 0;
473 rte_eth_dev_rss_hash_conf_get(xd->
device_index, &rss_conf);
477 s =
format(s,
"%Upci id: device %04x:%04x subsystem %04x:%04x\n" 478 "%Upci address: %04x:%02x:%02x.%02x\n",
480 pci->id.vendor_id, pci->id.device_id,
481 pci->id.subsystem_vendor_id,
482 pci->id.subsystem_device_id,
484 pci->addr.domain, pci->addr.bus,
485 pci->addr.devid, pci->addr.function);
486 s =
format(s,
"%Umax rx packet len: %d\n",
488 s =
format(s,
"%Upromiscuous: unicast %s all-multicast %s\n",
490 rte_eth_promiscuous_get(xd->
device_index) ?
"on" :
"off",
491 rte_eth_promiscuous_get(xd->
device_index) ?
"on" :
"off");
492 vlan_off = rte_eth_dev_get_vlan_offload(xd->
device_index);
493 s =
format(s,
"%Uvlan offload: strip %s filter %s qinq %s\n",
495 vlan_off & ETH_VLAN_STRIP_OFFLOAD ?
"on" :
"off",
496 vlan_off & ETH_VLAN_FILTER_OFFLOAD ?
"on" :
"off",
497 vlan_off & ETH_VLAN_EXTEND_OFFLOAD ?
"on" :
"off");
498 s =
format(s,
"%Uqueue size (max): rx %d (%d) tx %d (%d)\n",
502 s =
format(s,
"%Urx offload caps: %U\n",
505 s =
format(s,
"%Utx offload caps: %U\n",
508 s =
format(s,
"%Urss active: %U\n" 509 "%Urss supported: %U\n",
517 s =
format(s,
"%Uqueue size (max): rx %d (%d) tx %d (%d)\n",
524 s =
format (s,
"%Ucpu socket %d",
532 if ((xd->stats.V - xd->last_cleared_stats.V) != 0) { \ 533 s = format (s, "\n%U%-40U%16Ld", \ 534 format_white_space, indent + 2, \ 535 format_c_identifier, #N, \ 536 xd->stats.V - xd->last_cleared_stats.V); \ 552 struct rte_eth_xstats* last_xstat =
555 delta = xstat->value - last_xstat->value;
556 if (verbose == 2 || (verbose && delta))
559 u8 * name =
format(0,
"%s", xstat->name);
560 xs =
format(xs,
"\n%U%-38U%16Ld",
569 for (i = 0; i < xd->
rx_q_used * VIRTIO_QNUM; i++) {
573 name =
format(
NULL,
"tx q%d packets", i >> 1);
575 name =
format(
NULL,
"rx q%d packets", i >> 1);
577 xs =
format(xs,
"\n%U%-38U%16Ld",
587 xs =
format(xs,
"\n%U%-38U%16Ld",
597 s =
format(s,
"\n%Uextended stats:%v",
616 s =
format (s,
"%U tx queue %d",
620 s =
format (s,
"\n%Ubuffer 0x%x: %U",
644 s =
format (s,
"%U rx queue %d",
648 s =
format (s,
"\n%Ubuffer 0x%x: %U",
653 #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS 674 u32 *pkt_types = va_arg (*va,
u32 *);
680 s =
format (s,
"Packet Types");
683 if ((*pkt_types & RTE_PTYPE_##L##_MASK) == RTE_PTYPE_##L##_##F) \ 685 s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent, \ 686 "RTE_PTYPE_" #L "_" #F, RTE_PTYPE_##L##_##F, S); \ 698 u16 *ol_flags = va_arg (*va,
u16 *);
704 s =
format (s,
"Packet Offload Flags");
709 s = format (s, "\n%U%s (0x%04x) %s", \ 710 format_white_space, indent, #F, F, S); \ 722 struct rte_mbuf * mb = va_arg (*va,
struct rte_mbuf *);
725 s =
format (s,
"PKT MBUF: port %d, nb_segs %d, pkt_len %d" 726 "\n%Ubuf_len %d, data_len %d, ol_flags 0x%x," 727 "\n%Upacket_type 0x%x",
728 mb->port, mb->nb_segs, mb->pkt_len,
730 mb->buf_len, mb->data_len, mb->ol_flags,
744 #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS 746 static inline u8 * format_dpdk_pkt_rx_offload_flags (
u8 * s, va_list * va)
748 u16 *ol_flags = va_arg (*va,
u16 *);
754 s =
format (s,
"Packet RX Offload Flags");
759 s = format (s, "\n%U%s (0x%04x) %s", \ 760 format_white_space, indent, #F, F, S); \ 763 foreach_dpdk_pkt_ext_offload_flag
772 struct rte_mbuf * mb = va_arg (*va,
struct rte_mbuf *);
779 s =
format (s,
"PKT MBUF: port %d, nb_segs %d, pkt_len %d" 780 "\n%Ubuf_len %d, data_len %d, ol_flags 0x%x" 781 "\n%Upacket_type 0x%x",
782 mb->port, mb->nb_segs, mb->pkt_len,
784 mb->buf_len, mb->data_len, mb->ol_flags,
790 format_dpdk_pkt_rx_offload_flags, &mb->ol_flags);
810 else if (
unformat (input,
"%u,", &mem))
812 else if (
unformat (input,
"%u", &mem))
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
format_function_t format_vlib_buffer
vnet_main_t * vnet_get_main(void)
dpdk_vu_vring vrings[VHOST_MAX_QUEUE_PAIRS *2]
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
format_function_t format_dpdk_rx_rte_mbuf
struct rte_eth_xstats * last_cleared_xstats
format_function_t format_vnet_sw_interface_name
dpdk_port_type_t port_type
format_function_t * format_buffer
static void dpdk_update_counters(dpdk_device_t *xd, f64 now)
#define vec_free(V)
Free vector's memory (no header).
always_inline vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
u8 interface_name_format_decimal
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
dpdk_device_type_t dev_type
always_inline vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
struct rte_eth_xstats * xstats
always_inline f64 vlib_time_now(vlib_main_t *vm)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".