30 #define foreach_dpdk_counter \ 31 _ (tx_frames_ok, opackets) \ 32 _ (tx_bytes_ok, obytes) \ 33 _ (tx_errors, oerrors) \ 34 _ (rx_frames_ok, ipackets) \ 35 _ (rx_bytes_ok, ibytes) \ 36 _ (rx_errors, ierrors) \ 37 _ (rx_missed, imissed) \ 38 _ (rx_no_bufs, rx_nombuf) 40 #define foreach_dpdk_q_counter \ 41 _ (rx_frames_ok, q_ipackets) \ 42 _ (tx_frames_ok, q_opackets) \ 43 _ (rx_bytes_ok, q_ibytes) \ 44 _ (tx_bytes_ok, q_obytes) \ 45 _ (rx_errors, q_errors) 47 #define foreach_dpdk_rss_hf \ 48 _(ETH_RSS_FRAG_IPV4, "ipv4-frag") \ 49 _(ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \ 50 _(ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \ 51 _(ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \ 52 _(ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \ 53 _(ETH_RSS_IPV4, "ipv4") \ 54 _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ 55 _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") \ 56 _(ETH_RSS_FRAG_IPV6, "ipv6-frag") \ 57 _(ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \ 58 _(ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \ 59 _(ETH_RSS_NONFRAG_IPV6_SCTP, "ipv6-sctp") \ 60 _(ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \ 61 _(ETH_RSS_L2_PAYLOAD, "l2-payload") \ 62 _(ETH_RSS_IPV6_EX, "ipv6-ex") \ 63 _(ETH_RSS_IPV6, "ipv6") 66 #define foreach_dpdk_rx_offload_caps \ 67 _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \ 68 _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 69 _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 70 _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 71 _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \ 72 _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip") 74 #define foreach_dpdk_tx_offload_caps \ 75 _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \ 76 _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \ 77 _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \ 78 _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \ 79 _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \ 80 _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \ 81 _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \ 82 _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \ 83 _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert") 85 #define foreach_dpdk_pkt_rx_offload_flag \ 86 _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \ 87 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \ 88 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \ 89 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \ 90 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \ 91 _ (PKT_RX_EIP_CKSUM_BAD, "External IP header checksum error") \ 92 _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \ 93 _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \ 94 _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \ 95 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \ 96 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \ 97 _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped") \ 98 _ (PKT_RX_TIMESTAMP, "Timestamp field is valid") 100 #define foreach_dpdk_pkt_type \ 101 _ (L2, ETHER, "Ethernet packet") \ 102 _ (L2, ETHER_TIMESYNC, "Ethernet packet for time sync") \ 103 _ (L2, ETHER_ARP, "ARP packet") \ 104 _ (L2, ETHER_LLDP, "LLDP (Link Layer Discovery Protocol) packet") \ 105 _ (L2, ETHER_NSH, "NSH (Network Service Header) packet") \ 106 _ (L2, ETHER_VLAN, "VLAN packet") \ 107 _ (L2, ETHER_QINQ, "QinQ packet") \ 108 _ (L3, IPV4, "IPv4 packet without extension headers") \ 109 _ (L3, IPV4_EXT, "IPv4 packet with extension headers") \ 110 _ (L3, IPV4_EXT_UNKNOWN, "IPv4 packet with or without extension headers") \ 111 _ (L3, IPV6, "IPv6 packet without extension headers") \ 112 _ (L3, IPV6_EXT, "IPv6 packet with extension headers") \ 113 _ (L3, IPV6_EXT_UNKNOWN, "IPv6 packet with or without extension headers") \ 114 _ (L4, TCP, "TCP packet") \ 115 _ (L4, UDP, "UDP packet") \ 116 _ (L4, FRAG, "Fragmented IP packet") \ 117 _ (L4, SCTP, "SCTP (Stream Control Transmission Protocol) packet") \ 118 _ (L4, ICMP, "ICMP packet") \ 119 _ (L4, NONFRAG, "Non-fragmented IP packet") \ 120 _ (TUNNEL, GRE, "GRE tunneling packet") \ 121 _ (TUNNEL, VXLAN, "VXLAN tunneling packet") \ 122 _ (TUNNEL, NVGRE, "NVGRE Tunneling packet") \ 123 _ (TUNNEL, GENEVE, "GENEVE Tunneling packet") \ 124 _ (TUNNEL, GRENAT, "Teredo, VXLAN or GRE Tunneling packet") \ 125 _ (INNER_L2, ETHER, "Inner Ethernet packet") \ 126 _ (INNER_L2, ETHER_VLAN, "Inner Ethernet packet with VLAN") \ 127 _ (INNER_L3, IPV4, "Inner IPv4 packet without extension headers") \ 128 _ (INNER_L3, IPV4_EXT, "Inner IPv4 packet with extension headers") \ 129 _ (INNER_L3, IPV4_EXT_UNKNOWN, "Inner IPv4 packet with or without extension headers") \ 130 _ (INNER_L3, IPV6, "Inner IPv6 packet without extension headers") \ 131 _ (INNER_L3, IPV6_EXT, "Inner IPv6 packet with extension headers") \ 132 _ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \ 133 _ (INNER_L4, TCP, "Inner TCP packet") \ 134 _ (INNER_L4, UDP, "Inner UDP packet") \ 135 _ (INNER_L4, FRAG, "Inner fagmented IP packet") \ 136 _ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \ 137 _ (INNER_L4, ICMP, "Inner ICMP packet") \ 138 _ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet") 140 #define foreach_dpdk_pkt_tx_offload_flag \ 141 _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \ 142 _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \ 143 _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \ 144 _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \ 145 _ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp") 147 #define foreach_dpdk_pkt_offload_flag \ 148 foreach_dpdk_pkt_rx_offload_flag \ 149 foreach_dpdk_pkt_tx_offload_flag 151 #define foreach_dpdk_log_level \ 152 _ (EMERG, "emergency") \ 154 _ (CRIT, "critical") \ 156 _ (WARNING, "warning") \ 157 _ (NOTICE, "notice") \ 165 char *devname_format;
168 struct rte_eth_dev_info dev_info;
169 struct rte_pci_device *pci_dev;
173 devname_format =
"%s%d/%d/%d";
175 devname_format =
"%s%x/%x/%x";
180 device_name =
"GigabitEthernet";
184 device_name =
"Two_FiveGigabitEthernet";
188 device_name =
"FiveGigabitEthernet";
192 device_name =
"TenGigabitEthernet";
196 device_name =
"TwentyGigabitEthernet";
200 device_name =
"TwentyFiveGigabitEthernet";
204 device_name =
"FortyGigabitEthernet";
208 device_name =
"FiftyGigabitEthernet";
212 device_name =
"FiftySixGigabitEthernet";
216 device_name =
"HundredGigabitEthernet";
223 device_name =
"EthernetSwitch";
227 device_name =
"VirtualFunctionEthernet";
231 rte_eth_dev_info_get (i, &dev_info);
235 device_name =
"VirtioUser";
239 device_name =
"VhostEthernet";
243 device_name =
"FailsafeEthernet";
248 device_name =
"UnknownEthernet";
252 rte_eth_dev_info_get (i, &dev_info);
253 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 254 pci_dev = dev_info.pci_dev;
256 pci_dev = RTE_DEV_TO_PCI (dev_info.device);
260 ret =
format (s, devname_format, device_name, pci_dev->addr.bus,
261 pci_dev->addr.devid, pci_dev->addr.function);
276 #define _(a, b, c) if (xd->flags & (1 << a)) \ 277 t = format (t, "%s%s", t ? " ":"", c); 294 case VNET_DPDK_PMD_E1000EM:
295 dev_type =
"Intel 82540EM (e1000)";
298 case VNET_DPDK_PMD_IGB:
299 dev_type =
"Intel e1000";
302 case VNET_DPDK_PMD_I40E:
303 dev_type =
"Intel X710/XL710 Family";
306 case VNET_DPDK_PMD_I40EVF:
307 dev_type =
"Intel X710/XL710 Family VF";
310 case VNET_DPDK_PMD_FM10K:
311 dev_type =
"Intel FM10000 Family Ethernet Switch";
314 case VNET_DPDK_PMD_IGBVF:
315 dev_type =
"Intel e1000 VF";
318 case VNET_DPDK_PMD_VIRTIO:
319 dev_type =
"Red Hat Virtio";
322 case VNET_DPDK_PMD_IXGBEVF:
323 dev_type =
"Intel 82599 VF";
326 case VNET_DPDK_PMD_IXGBE:
327 dev_type =
"Intel 82599";
330 case VNET_DPDK_PMD_ENIC:
331 dev_type =
"Cisco VIC";
334 case VNET_DPDK_PMD_CXGBE:
335 dev_type =
"Chelsio T4/T5";
338 case VNET_DPDK_PMD_MLX4:
339 dev_type =
"Mellanox ConnectX-3 Family";
342 case VNET_DPDK_PMD_MLX5:
343 dev_type =
"Mellanox ConnectX-4 Family";
346 case VNET_DPDK_PMD_VMXNET3:
347 dev_type =
"VMware VMXNET3";
350 case VNET_DPDK_PMD_AF_PACKET:
351 dev_type =
"af_packet";
354 case VNET_DPDK_PMD_BOND:
355 dev_type =
"Ethernet Bonding";
358 case VNET_DPDK_PMD_DPAA2:
359 dev_type =
"NXP DPAA2 Mac";
362 case VNET_DPDK_PMD_VIRTIO_USER:
363 dev_type =
"Virtio User";
366 case VNET_DPDK_PMD_THUNDERX:
367 dev_type =
"Cavium ThunderX";
370 case VNET_DPDK_PMD_VHOST_ETHER:
371 dev_type =
"VhostEthernet";
374 case VNET_DPDK_PMD_ENA:
375 dev_type =
"AWS ENA VF";
378 case VNET_DPDK_PMD_FAILSAFE:
379 dev_type =
"FailsafeEthernet";
382 case VNET_DPDK_PMD_LIOVF_ETHER:
383 dev_type =
"Cavium Lio VF";
386 case VNET_DPDK_PMD_QEDE:
387 dev_type =
"Cavium QLogic FastLinQ QL4xxxx";
392 dev_type =
"### UNKNOWN ###";
396 return format (s, dev_type);
403 struct rte_eth_link *l = &xd->
link;
407 s =
format (s,
"%s ", l->link_status ?
"up" :
"down");
410 u32 promisc = rte_eth_promiscuous_get (xd->
port_id);
412 s =
format (s,
"%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
414 s =
format (s,
"speed %u mtu %d %s\n", l->link_speed,
426 if (format_get_indent (s) > next_split ) { \ 427 next_split += _line_len; \ 428 s = format(s,"\n%U", format_white_space, indent); \ 430 s = format(s, "%s ", str); \ 436 u64 bitmap = va_arg (*args,
u64);
437 int next_split = _line_len;
441 return format (s,
"none");
449 u32 bitmap = va_arg (*args,
u32);
450 int next_split = _line_len;
454 return format (s,
"none");
462 u32 bitmap = va_arg (*args,
u32);
463 int next_split = _line_len;
466 return format (s,
"none");
491 Dl_info info = { 0 };
493 if (dladdr (p, &info) == 0)
496 return info.dli_sname;
502 u32 dev_instance = va_arg (*args,
u32);
503 int verbose = va_arg (*args,
int);
508 struct rte_eth_dev_info di;
513 s =
format (s,
"%U\n%Ucarrier %U",
516 s =
format (s,
"%Uflags: %U\n",
519 rte_eth_dev_info_get (xd->
port_id, &di);
521 if (verbose > 1 && xd->
flags & DPDK_DEVICE_FLAG_PMD)
523 struct rte_pci_device *pci;
524 struct rte_eth_rss_conf rss_conf;
528 rss_conf.rss_key = 0;
529 retval = rte_eth_dev_rss_hash_conf_get (xd->
port_id, &rss_conf);
531 clib_warning (
"rte_eth_dev_rss_hash_conf_get returned %d", retval);
532 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 535 pci = RTE_DEV_TO_PCI (di.device);
541 "%Upci id: device %04x:%04x subsystem %04x:%04x\n" 542 "%Upci address: %04x:%02x:%02x.%02x\n",
544 pci->id.device_id, pci->id.subsystem_vendor_id,
546 pci->addr.domain, pci->addr.bus, pci->addr.devid,
550 indent + 2, di.max_rx_pktlen);
553 indent + 2, di.max_rx_queues, di.max_tx_queues);
555 format (s,
"%Upromiscuous: unicast %s all-multicast %s\n",
557 rte_eth_promiscuous_get (xd->
port_id) ?
559 rte_eth_allmulticast_get (xd->
port_id) ?
"on" :
"off");
560 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
561 s =
format (s,
"%Uvlan offload: strip %s filter %s qinq %s\n",
563 vlan_off & ETH_VLAN_STRIP_OFFLOAD ?
"on" :
"off",
564 vlan_off & ETH_VLAN_FILTER_OFFLOAD ?
"on" :
"off",
565 vlan_off & ETH_VLAN_EXTEND_OFFLOAD ?
"on" :
"off");
566 s =
format (s,
"%Urx offload caps: %U\n",
569 s =
format (s,
"%Utx offload caps: %U\n",
572 s =
format (s,
"%Urss active: %U\n" 573 "%Urss supported: %U\n",
578 s =
format (s,
"%Utx burst function: %s\n",
581 s =
format (s,
"%Urx burst function: %s\n",
586 s =
format (s,
"%Urx queues %d, rx desc %d, tx queues %d, tx desc %d\n",
591 s =
format (s,
"%Ucpu socket %d\n",
597 if ((xd->stats.V - xd->last_cleared_stats.V) != 0) { \ 598 s = format (s, "\n%U%-40U%16Ld", \ 599 format_white_space, indent + 2, \ 600 format_c_identifier, #N, \ 601 xd->stats.V - xd->last_cleared_stats.V); \ 610 struct rte_eth_xstat *xstat, *last_xstat;
611 struct rte_eth_xstat_name *xstat_names = 0;
612 int len = rte_eth_xstats_get_names (xd->
port_id,
NULL, 0);
614 rte_eth_xstats_get_names (xd->
port_id, xstat_names, len);
625 delta = xstat->value - last_xstat->value;
626 if (verbose == 2 || (verbose && delta))
629 u8 * name =
format(0,
"%s", xstat_names[i].name);
630 xs =
format(xs,
"\n%U%-38U%16Ld",
642 s =
format (s,
"\n%Uextended stats:%v",
668 s =
format (s,
"%U tx queue %d",
671 s =
format (s,
"\n%Ubuffer 0x%x: %U",
699 s =
format (s,
"%U rx queue %d",
702 s =
format (s,
"\n%Ubuffer 0x%x: %U",
713 t->
mb.data_len > sizeof (t->
data) ?
" (truncated)" :
"");
717 sizeof (t->
data) ? sizeof (t->
data) : t->
mb.data_len);
732 u32 *pkt_types = va_arg (*va,
u32 *);
738 s =
format (s,
"Packet Types");
741 if ((*pkt_types & RTE_PTYPE_##L##_MASK) == RTE_PTYPE_##L##_##F) \ 743 s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent, \ 744 "RTE_PTYPE_" #L "_" #F, RTE_PTYPE_##L##_##F, S); \ 755 u64 *ol_flags = va_arg (*va,
u64 *);
761 s =
format (s,
"Packet Offload Flags");
766 s = format (s, "\n%U%s (0x%04x) %s", \ 767 format_white_space, indent, #F, F, S); \ 781 if (clib_net_to_host_u16 (vlan_hdr->
type) == ETHERNET_TYPE_DOT1AD)
783 s =
format (s,
"%U 802.1q vlan ",
799 struct rte_mbuf *mb = va_arg (*va,
struct rte_mbuf *);
803 s =
format (s,
"PKT MBUF: port %d, nb_segs %d, pkt_len %d" 804 "\n%Ubuf_len %d, data_len %d, ol_flags 0x%lx, data_off %d, phys_addr 0x%x" 805 "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u" 806 "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
807 mb->port, mb->nb_segs, mb->pkt_len,
809 mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off,
811 mb->l2_len, mb->l3_len, mb->outer_l2_len, mb->outer_l3_len,
819 if ((mb->ol_flags & PKT_RX_VLAN) &&
820 ((mb->ol_flags & (PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ_STRIPPED)) == 0))
843 else if (unformat (input, s)) \ 860 u32 *r = va_arg (*args,
u32 *);
863 #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