27 #define foreach_dpdk_counter \ 28 _ (tx_frames_ok, opackets) \ 29 _ (tx_bytes_ok, obytes) \ 30 _ (tx_errors, oerrors) \ 31 _ (rx_frames_ok, ipackets) \ 32 _ (rx_bytes_ok, ibytes) \ 33 _ (rx_errors, ierrors) \ 34 _ (rx_missed, imissed) \ 35 _ (rx_no_bufs, rx_nombuf) 37 #define foreach_dpdk_q_counter \ 38 _ (rx_frames_ok, q_ipackets) \ 39 _ (tx_frames_ok, q_opackets) \ 40 _ (rx_bytes_ok, q_ibytes) \ 41 _ (tx_bytes_ok, q_obytes) \ 42 _ (rx_errors, q_errors) 44 #define foreach_dpdk_rss_hf \ 45 _(ETH_RSS_FRAG_IPV4, "ipv4-frag") \ 46 _(ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \ 47 _(ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \ 48 _(ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \ 49 _(ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \ 50 _(ETH_RSS_IPV4, "ipv4") \ 51 _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ 52 _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") \ 53 _(ETH_RSS_FRAG_IPV6, "ipv6-frag") \ 54 _(ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \ 55 _(ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \ 56 _(ETH_RSS_NONFRAG_IPV6_SCTP, "ipv6-sctp") \ 57 _(ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \ 58 _(ETH_RSS_L2_PAYLOAD, "l2-payload") \ 59 _(ETH_RSS_IPV6_EX, "ipv6-ex") \ 60 _(ETH_RSS_IPV6, "ipv6") 63 #define foreach_dpdk_rx_offload_caps \ 64 _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \ 65 _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 66 _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 67 _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 68 _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \ 69 _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip") 71 #define foreach_dpdk_tx_offload_caps \ 72 _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \ 73 _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 74 _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 75 _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 76 _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \ 77 _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \ 78 _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \ 79 _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \ 80 _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert") 82 #define foreach_dpdk_pkt_rx_offload_flag \ 83 _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \ 84 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \ 85 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \ 86 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \ 87 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \ 88 _ (PKT_RX_EIP_CKSUM_BAD, "External IP header checksum error") \ 89 _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \ 90 _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \ 91 _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \ 92 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \ 93 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \ 94 _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped") \ 95 _ (PKT_RX_TIMESTAMP, "Timestamp field is valid") 97 #define foreach_dpdk_pkt_type \ 98 _ (L2, ETHER, "Ethernet packet") \ 99 _ (L2, ETHER_TIMESYNC, "Ethernet packet for time sync") \ 100 _ (L2, ETHER_ARP, "ARP packet") \ 101 _ (L2, ETHER_LLDP, "LLDP (Link Layer Discovery Protocol) packet") \ 102 _ (L2, ETHER_NSH, "NSH (Network Service Header) packet") \ 103 _ (L2, ETHER_VLAN, "VLAN packet") \ 104 _ (L2, ETHER_QINQ, "QinQ packet") \ 105 _ (L3, IPV4, "IPv4 packet without extension headers") \ 106 _ (L3, IPV4_EXT, "IPv4 packet with extension headers") \ 107 _ (L3, IPV4_EXT_UNKNOWN, "IPv4 packet with or without extension headers") \ 108 _ (L3, IPV6, "IPv6 packet without extension headers") \ 109 _ (L3, IPV6_EXT, "IPv6 packet with extension headers") \ 110 _ (L3, IPV6_EXT_UNKNOWN, "IPv6 packet with or without extension headers") \ 111 _ (L4, TCP, "TCP packet") \ 112 _ (L4, UDP, "UDP packet") \ 113 _ (L4, FRAG, "Fragmented IP packet") \ 114 _ (L4, SCTP, "SCTP (Stream Control Transmission Protocol) packet") \ 115 _ (L4, ICMP, "ICMP packet") \ 116 _ (L4, NONFRAG, "Non-fragmented IP packet") \ 117 _ (TUNNEL, GRE, "GRE tunneling packet") \ 118 _ (TUNNEL, VXLAN, "VXLAN tunneling packet") \ 119 _ (TUNNEL, NVGRE, "NVGRE Tunneling packet") \ 120 _ (TUNNEL, GENEVE, "GENEVE Tunneling packet") \ 121 _ (TUNNEL, GRENAT, "Teredo, VXLAN or GRE Tunneling packet") \ 122 _ (INNER_L2, ETHER, "Inner Ethernet packet") \ 123 _ (INNER_L2, ETHER_VLAN, "Inner Ethernet packet with VLAN") \ 124 _ (INNER_L3, IPV4, "Inner IPv4 packet without extension headers") \ 125 _ (INNER_L3, IPV4_EXT, "Inner IPv4 packet with extension headers") \ 126 _ (INNER_L3, IPV4_EXT_UNKNOWN, "Inner IPv4 packet with or without extension headers") \ 127 _ (INNER_L3, IPV6, "Inner IPv6 packet without extension headers") \ 128 _ (INNER_L3, IPV6_EXT, "Inner IPv6 packet with extension headers") \ 129 _ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \ 130 _ (INNER_L4, TCP, "Inner TCP packet") \ 131 _ (INNER_L4, UDP, "Inner UDP packet") \ 132 _ (INNER_L4, FRAG, "Inner fagmented IP packet") \ 133 _ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \ 134 _ (INNER_L4, ICMP, "Inner ICMP packet") \ 135 _ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet") 137 #define foreach_dpdk_pkt_tx_offload_flag \ 138 _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \ 139 _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \ 140 _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \ 141 _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \ 142 _ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp") 144 #define foreach_dpdk_pkt_offload_flag \ 145 foreach_dpdk_pkt_rx_offload_flag \ 146 foreach_dpdk_pkt_tx_offload_flag 148 #define foreach_dpdk_log_level \ 149 _ (EMERG, "emergency") \ 151 _ (CRIT, "critical") \ 153 _ (WARNING, "warning") \ 154 _ (NOTICE, "notice") \ 162 char *devname_format;
165 struct rte_eth_dev_info dev_info;
166 struct rte_pci_device *pci_dev;
170 devname_format =
"%s%d/%d/%d";
172 devname_format =
"%s%x/%x/%x";
177 device_name =
"GigabitEthernet";
181 device_name =
"Two_FiveGigabitEthernet";
185 device_name =
"FiveGigabitEthernet";
189 device_name =
"TenGigabitEthernet";
193 device_name =
"TwentyGigabitEthernet";
197 device_name =
"TwentyFiveGigabitEthernet";
201 device_name =
"FortyGigabitEthernet";
205 device_name =
"FiftyGigabitEthernet";
209 device_name =
"FiftySixGigabitEthernet";
213 device_name =
"HundredGigabitEthernet";
220 device_name =
"EthernetSwitch";
224 device_name =
"VirtualFunctionEthernet";
228 rte_eth_dev_info_get (i, &dev_info);
232 device_name =
"VirtioUser";
236 device_name =
"VhostEthernet";
240 device_name =
"FailsafeEthernet";
245 device_name =
"UnknownEthernet";
249 rte_eth_dev_info_get (i, &dev_info);
250 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 251 pci_dev = dev_info.pci_dev;
253 pci_dev = RTE_DEV_TO_PCI (dev_info.device);
257 ret =
format (s, devname_format, device_name, pci_dev->addr.bus,
258 pci_dev->addr.devid, pci_dev->addr.function);
273 #define _(a, b, c) if (xd->flags & (1 << a)) \ 274 t = format (t, "%s%s", t ? " ":"", c); 291 case VNET_DPDK_PMD_E1000EM:
292 dev_type =
"Intel 82540EM (e1000)";
295 case VNET_DPDK_PMD_IGB:
296 dev_type =
"Intel e1000";
299 case VNET_DPDK_PMD_I40E:
300 dev_type =
"Intel X710/XL710 Family";
303 case VNET_DPDK_PMD_I40EVF:
304 dev_type =
"Intel X710/XL710 Family VF";
307 case VNET_DPDK_PMD_FM10K:
308 dev_type =
"Intel FM10000 Family Ethernet Switch";
311 case VNET_DPDK_PMD_IGBVF:
312 dev_type =
"Intel e1000 VF";
315 case VNET_DPDK_PMD_VIRTIO:
316 dev_type =
"Red Hat Virtio";
319 case VNET_DPDK_PMD_IXGBEVF:
320 dev_type =
"Intel 82599 VF";
323 case VNET_DPDK_PMD_IXGBE:
324 dev_type =
"Intel 82599";
327 case VNET_DPDK_PMD_ENIC:
328 dev_type =
"Cisco VIC";
331 case VNET_DPDK_PMD_CXGBE:
332 dev_type =
"Chelsio T4/T5";
335 case VNET_DPDK_PMD_MLX4:
336 dev_type =
"Mellanox ConnectX-3 Family";
339 case VNET_DPDK_PMD_MLX5:
340 dev_type =
"Mellanox ConnectX-4 Family";
343 case VNET_DPDK_PMD_VMXNET3:
344 dev_type =
"VMware VMXNET3";
347 case VNET_DPDK_PMD_AF_PACKET:
348 dev_type =
"af_packet";
351 case VNET_DPDK_PMD_BOND:
352 dev_type =
"Ethernet Bonding";
355 case VNET_DPDK_PMD_DPAA2:
356 dev_type =
"NXP DPAA2 Mac";
359 case VNET_DPDK_PMD_VIRTIO_USER:
360 dev_type =
"Virtio User";
363 case VNET_DPDK_PMD_THUNDERX:
364 dev_type =
"Cavium ThunderX";
367 case VNET_DPDK_PMD_VHOST_ETHER:
368 dev_type =
"VhostEthernet";
371 case VNET_DPDK_PMD_ENA:
372 dev_type =
"AWS ENA VF";
375 case VNET_DPDK_PMD_FAILSAFE:
376 dev_type =
"FailsafeEthernet";
379 case VNET_DPDK_PMD_LIOVF_ETHER:
380 dev_type =
"Cavium Lio VF";
385 dev_type =
"### UNKNOWN ###";
389 return format (s, dev_type);
396 struct rte_eth_link *l = &xd->
link;
400 s =
format (s,
"%s ", l->link_status ?
"up" :
"down");
403 u32 promisc = rte_eth_promiscuous_get (xd->
port_id);
405 s =
format (s,
"%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
407 s =
format (s,
"speed %u mtu %d %s\n", l->link_speed,
419 if (format_get_indent (s) > next_split ) { \ 420 next_split += _line_len; \ 421 s = format(s,"\n%U", format_white_space, indent); \ 423 s = format(s, "%s ", str); \ 429 u64 bitmap = va_arg (*args,
u64);
430 int next_split = _line_len;
434 return format (s,
"none");
442 u32 bitmap = va_arg (*args,
u32);
443 int next_split = _line_len;
447 return format (s,
"none");
455 u32 bitmap = va_arg (*args,
u32);
456 int next_split = _line_len;
459 return format (s,
"none");
484 u32 dev_instance = va_arg (*args,
u32);
485 int verbose = va_arg (*args,
int);
490 struct rte_eth_dev_info di;
495 s =
format (s,
"%U\n%Ucarrier %U",
498 s =
format (s,
"%Uflags: %U\n",
501 rte_eth_dev_info_get (xd->
port_id, &di);
503 if (verbose > 1 && xd->
flags & DPDK_DEVICE_FLAG_PMD)
505 struct rte_pci_device *pci;
506 struct rte_eth_rss_conf rss_conf;
510 rss_conf.rss_key = 0;
511 retval = rte_eth_dev_rss_hash_conf_get (xd->
port_id, &rss_conf);
513 clib_warning (
"rte_eth_dev_rss_hash_conf_get returned %d", retval);
514 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 517 pci = RTE_DEV_TO_PCI (di.device);
523 "%Upci id: device %04x:%04x subsystem %04x:%04x\n" 524 "%Upci address: %04x:%02x:%02x.%02x\n",
526 pci->id.device_id, pci->id.subsystem_vendor_id,
528 pci->addr.domain, pci->addr.bus, pci->addr.devid,
532 indent + 2, di.max_rx_pktlen);
535 indent + 2, di.max_rx_queues, di.max_tx_queues);
537 format (s,
"%Upromiscuous: unicast %s all-multicast %s\n",
539 rte_eth_promiscuous_get (xd->
port_id) ?
541 rte_eth_allmulticast_get (xd->
port_id) ?
"on" :
"off");
542 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
543 s =
format (s,
"%Uvlan offload: strip %s filter %s qinq %s\n",
545 vlan_off & ETH_VLAN_STRIP_OFFLOAD ?
"on" :
"off",
546 vlan_off & ETH_VLAN_FILTER_OFFLOAD ?
"on" :
"off",
547 vlan_off & ETH_VLAN_EXTEND_OFFLOAD ?
"on" :
"off");
548 s =
format (s,
"%Urx offload caps: %U\n",
551 s =
format (s,
"%Utx offload caps: %U\n",
554 s =
format (s,
"%Urss active: %U\n" 555 "%Urss supported: %U\n",
562 s =
format (s,
"%Urx queues %d, rx desc %d, tx queues %d, tx desc %d\n",
567 s =
format (s,
"%Ucpu socket %d\n",
573 if ((xd->stats.V - xd->last_cleared_stats.V) != 0) { \ 574 s = format (s, "\n%U%-40U%16Ld", \ 575 format_white_space, indent + 2, \ 576 format_c_identifier, #N, \ 577 xd->stats.V - xd->last_cleared_stats.V); \ 586 struct rte_eth_xstat *xstat, *last_xstat;
587 struct rte_eth_xstat_name *xstat_names = 0;
588 int len = rte_eth_xstats_get_names (xd->
port_id,
NULL, 0);
590 rte_eth_xstats_get_names (xd->
port_id, xstat_names, len);
601 delta = xstat->value - last_xstat->value;
602 if (verbose == 2 || (verbose && delta))
605 u8 * name =
format(0,
"%s", xstat_names[i].name);
606 xs =
format(xs,
"\n%U%-38U%16Ld",
618 s =
format (s,
"\n%Uextended stats:%v",
644 s =
format (s,
"%U tx queue %d",
647 s =
format (s,
"\n%Ubuffer 0x%x: %U",
675 s =
format (s,
"%U rx queue %d",
678 s =
format (s,
"\n%Ubuffer 0x%x: %U",
689 t->
mb.data_len > sizeof (t->
data) ?
" (truncated)" :
"");
693 sizeof (t->
data) ? sizeof (t->
data) : t->
mb.data_len);
708 u32 *pkt_types = va_arg (*va,
u32 *);
714 s =
format (s,
"Packet Types");
717 if ((*pkt_types & RTE_PTYPE_##L##_MASK) == RTE_PTYPE_##L##_##F) \ 719 s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent, \ 720 "RTE_PTYPE_" #L "_" #F, RTE_PTYPE_##L##_##F, S); \ 731 u64 *ol_flags = va_arg (*va,
u64 *);
737 s =
format (s,
"Packet Offload Flags");
742 s = format (s, "\n%U%s (0x%04x) %s", \ 743 format_white_space, indent, #F, F, S); \ 757 if (clib_net_to_host_u16 (vlan_hdr->
type) == ETHERNET_TYPE_DOT1AD)
759 s =
format (s,
"%U 802.1q vlan ",
775 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%lx, data_off %d, phys_addr 0x%x" 781 "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u" 782 "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
783 mb->port, mb->nb_segs, mb->pkt_len,
785 mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off,
787 mb->l2_len, mb->l3_len, mb->outer_l2_len, mb->outer_l3_len,
795 if ((mb->ol_flags & PKT_RX_VLAN) &&
796 ((mb->ol_flags & (PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ_STRIPPED)) == 0))
819 else if (unformat (input, s)) \ 836 u32 *r = va_arg (*args,
u32 *);
839 #define _(v,s) else if (unformat (input, s)) *r = RTE_LOG_##v;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define vec_foreach_index(var, v)
Iterate over vector indices.
u8 interface_name_format_decimal
vnet_main_t * vnet_get_main(void)
static f64 vlib_time_now(vlib_main_t *vm)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
struct rte_eth_xstat * last_cleared_xstats
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
format_function_t format_vnet_sw_interface_name
format_function_t format_vnet_buffer
dpdk_port_type_t port_type
format_function_t * format_buffer
u16 af_packet_instance_num
static void dpdk_update_counters(dpdk_device_t *xd, f64 now)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
struct rte_eth_xstat * xstats
u8 * interface_name_suffix
vlib_trace_main_t trace_main
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_foreach(var, vec)
Vector iterator.
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
dpdk_config_main_t * conf