|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
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 #if RTE_VERSION < RTE_VERSION_NUM(21, 5, 0, 0)
48 #define PKT_RX_OUTER_IP_CKSUM_BAD PKT_RX_EIP_CKSUM_BAD
51 #define foreach_dpdk_pkt_rx_offload_flag \
52 _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \
53 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \
54 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \
55 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \
56 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \
57 _ (PKT_RX_OUTER_IP_CKSUM_BAD, "External IP header checksum error") \
58 _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \
59 _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \
60 _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \
61 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \
62 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \
63 _ (PKT_RX_LRO, "LRO packet") \
64 _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped")
66 #define foreach_dpdk_pkt_type \
67 _ (L2, ETHER, "Ethernet packet") \
68 _ (L2, ETHER_TIMESYNC, "Ethernet packet for time sync") \
69 _ (L2, ETHER_ARP, "ARP packet") \
70 _ (L2, ETHER_LLDP, "LLDP (Link Layer Discovery Protocol) packet") \
71 _ (L2, ETHER_NSH, "NSH (Network Service Header) packet") \
72 _ (L2, ETHER_VLAN, "VLAN packet") \
73 _ (L2, ETHER_QINQ, "QinQ packet") \
74 _ (L3, IPV4, "IPv4 packet without extension headers") \
75 _ (L3, IPV4_EXT, "IPv4 packet with extension headers") \
76 _ (L3, IPV4_EXT_UNKNOWN, "IPv4 packet with or without extension headers") \
77 _ (L3, IPV6, "IPv6 packet without extension headers") \
78 _ (L3, IPV6_EXT, "IPv6 packet with extension headers") \
79 _ (L3, IPV6_EXT_UNKNOWN, "IPv6 packet with or without extension headers") \
80 _ (L4, TCP, "TCP packet") \
81 _ (L4, UDP, "UDP packet") \
82 _ (L4, FRAG, "Fragmented IP packet") \
83 _ (L4, SCTP, "SCTP (Stream Control Transmission Protocol) packet") \
84 _ (L4, ICMP, "ICMP packet") \
85 _ (L4, NONFRAG, "Non-fragmented IP packet") \
86 _ (TUNNEL, GRE, "GRE tunneling packet") \
87 _ (TUNNEL, VXLAN, "VXLAN tunneling packet") \
88 _ (TUNNEL, NVGRE, "NVGRE Tunneling packet") \
89 _ (TUNNEL, GENEVE, "GENEVE Tunneling packet") \
90 _ (TUNNEL, GRENAT, "Teredo, VXLAN or GRE Tunneling packet") \
91 _ (INNER_L2, ETHER, "Inner Ethernet packet") \
92 _ (INNER_L2, ETHER_VLAN, "Inner Ethernet packet with VLAN") \
93 _ (INNER_L3, IPV4, "Inner IPv4 packet without extension headers") \
94 _ (INNER_L3, IPV4_EXT, "Inner IPv4 packet with extension headers") \
95 _ (INNER_L3, IPV4_EXT_UNKNOWN, "Inner IPv4 packet with or without extension headers") \
96 _ (INNER_L3, IPV6, "Inner IPv6 packet without extension headers") \
97 _ (INNER_L3, IPV6_EXT, "Inner IPv6 packet with extension headers") \
98 _ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \
99 _ (INNER_L4, TCP, "Inner TCP packet") \
100 _ (INNER_L4, UDP, "Inner UDP packet") \
101 _ (INNER_L4, FRAG, "Inner fragmented IP packet") \
102 _ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \
103 _ (INNER_L4, ICMP, "Inner ICMP packet") \
104 _ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet")
106 #define foreach_dpdk_pkt_tx_offload_flag \
107 _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \
108 _ (PKT_TX_TUNNEL_VXLAN, "TX packet is a VXLAN packet") \
109 _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \
110 _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \
111 _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \
112 _ (PKT_TX_OUTER_IP_CKSUM, "Outer IP cksum of Tx pkt. computed by NIC") \
113 _ (PKT_TX_TCP_SEG, "TSO of TX pkt. done by NIC") \
114 _ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp")
116 #define foreach_dpdk_pkt_offload_flag \
117 foreach_dpdk_pkt_rx_offload_flag \
118 foreach_dpdk_pkt_tx_offload_flag
120 #define foreach_dpdk_pkt_dyn_rx_offload_flag \
121 _ (RX_TIMESTAMP, 0, "Timestamp field is valid")
127 char *devname_format;
131 struct rte_eth_dev_info dev_info;
132 struct rte_pci_device *pci_dev;
139 devname_format =
"%s%d/%d/%d";
141 devname_format =
"%s%x/%x/%x";
146 device_name =
"GigabitEthernet";
150 device_name =
"Two_FiveGigabitEthernet";
154 device_name =
"FiveGigabitEthernet";
158 device_name =
"TenGigabitEthernet";
162 device_name =
"TwentyGigabitEthernet";
166 device_name =
"TwentyFiveGigabitEthernet";
170 device_name =
"FortyGigabitEthernet";
174 device_name =
"FiftyGigabitEthernet";
178 device_name =
"FiftySixGigabitEthernet";
182 device_name =
"HundredGigabitEthernet";
186 device_name =
"EthernetSwitch";
190 device_name =
"VirtualFunctionEthernet";
197 device_name =
"VirtioUser";
201 device_name =
"VhostEthernet";
205 device_name =
"FailsafeEthernet";
210 device_name =
"UnknownEthernet";
214 rte_eth_dev_info_get (xd->
port_id, &dev_info);
218 ret =
format (s, devname_format, device_name, pci_dev->addr.bus,
219 pci_dev->addr.devid, pci_dev->addr.function);
234 #define _(a, b, c) if (xd->flags & (1 << a)) \
235 t = format (t, "%s%s", t ? " ":"", c);
252 case VNET_DPDK_PMD_E1000EM:
253 dev_type =
"Intel 82540EM (e1000)";
256 case VNET_DPDK_PMD_IGB:
257 dev_type =
"Intel e1000";
260 case VNET_DPDK_PMD_I40E:
261 dev_type =
"Intel X710/XL710 Family";
264 case VNET_DPDK_PMD_I40EVF:
265 dev_type =
"Intel X710/XL710 Family VF";
268 case VNET_DPDK_PMD_ICE:
269 dev_type =
"Intel E810 Family";
272 case VNET_DPDK_PMD_IAVF:
273 dev_type =
"Intel iAVF";
276 case VNET_DPDK_PMD_FM10K:
277 dev_type =
"Intel FM10000 Family Ethernet Switch";
280 case VNET_DPDK_PMD_IGBVF:
281 dev_type =
"Intel e1000 VF";
284 case VNET_DPDK_PMD_VIRTIO:
285 dev_type =
"Red Hat Virtio";
288 case VNET_DPDK_PMD_IXGBEVF:
289 dev_type =
"Intel 82599 VF";
292 case VNET_DPDK_PMD_IXGBE:
293 dev_type =
"Intel 82599";
296 case VNET_DPDK_PMD_ENIC:
297 dev_type =
"Cisco VIC";
300 case VNET_DPDK_PMD_CXGBE:
301 dev_type =
"Chelsio T4/T5";
304 case VNET_DPDK_PMD_MLX4:
305 dev_type =
"Mellanox ConnectX-3 Family";
308 case VNET_DPDK_PMD_MLX5:
309 dev_type =
"Mellanox ConnectX-4 Family";
312 case VNET_DPDK_PMD_VMXNET3:
313 dev_type =
"VMware VMXNET3";
316 case VNET_DPDK_PMD_AF_PACKET:
317 dev_type =
"af_packet";
320 case VNET_DPDK_PMD_DPAA2:
321 dev_type =
"NXP DPAA2 Mac";
324 case VNET_DPDK_PMD_VIRTIO_USER:
325 dev_type =
"Virtio User";
328 case VNET_DPDK_PMD_THUNDERX:
329 dev_type =
"Cavium ThunderX";
332 case VNET_DPDK_PMD_VHOST_ETHER:
333 dev_type =
"VhostEthernet";
336 case VNET_DPDK_PMD_ENA:
337 dev_type =
"AWS ENA VF";
340 case VNET_DPDK_PMD_FAILSAFE:
341 dev_type =
"FailsafeEthernet";
344 case VNET_DPDK_PMD_LIOVF_ETHER:
345 dev_type =
"Cavium Lio VF";
348 case VNET_DPDK_PMD_QEDE:
349 dev_type =
"Cavium QLogic FastLinQ QL4xxxx";
352 case VNET_DPDK_PMD_NETVSC:
353 dev_type =
"Microsoft Hyper-V Netvsc";
356 case VNET_DPDK_PMD_BNXT:
357 dev_type =
"Broadcom NetXtreme E/S-Series";
362 dev_type =
"### UNKNOWN ###";
366 return format (s, dev_type);
373 struct rte_eth_link *l = &xd->
link;
377 s =
format (s,
"%s ", l->link_status ?
"up" :
"down");
380 u32 promisc = rte_eth_promiscuous_get (xd->
port_id);
382 s =
format (s,
"%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
384 s =
format (s,
"mtu %d %s\n",
hi->max_packet_bytes, promisc ?
393 #define _(n, v, str) \
395 if (format_get_indent (s) > 72) \
396 s = format(s,"\n%U", format_white_space, indent); \
397 s = format(s, "%s ", str); \
403 u64 bitmap = va_arg (*args,
u64);
407 return format (s,
"none");
419 u8 *
id = va_arg (*va,
u8 *);
427 for (
i = 0;
id[
i] != 0 &&
i < l;
i++)
443 if (format_get_indent (s) > 72) \
444 s = format(s,"\n%U", format_white_space, indent); \
445 s = format(s, "%U ", format_offload, func (v)); \
451 u64 bitmap = va_arg (*args,
u32);
456 return format (s,
"none");
458 for (
i = 0;
i < 64;
i++)
462 _(
mask, rte_eth_dev_rx_offload_name);
470 u64 bitmap = va_arg (*args,
u32);
475 return format (s,
"none");
477 for (
i = 0;
i < 64;
i++)
481 _(
mask, rte_eth_dev_tx_offload_name);
506 struct rte_eth_dev_module_info mi = { 0 };
507 struct rte_dev_eeprom_info ei = { 0 };
509 if (rte_eth_dev_get_module_info (xd->
port_id, &mi) != 0)
510 return format (s,
"unknown");
512 ei.length = mi.eeprom_len;
515 if (rte_eth_dev_get_module_eeprom (xd->
port_id, &ei) == 0)
518 (mi.type == RTE_ETH_MODULE_SFF_8436 ? 0x80 : 0));
521 s =
format (s,
"eeprom read error");
530 Dl_info info = { 0 };
532 if (dladdr (p, &info) == 0)
535 return info.dli_sname;
541 struct rte_eth_switch_info *
si =
542 va_arg (*args,
struct rte_eth_switch_info *);
545 s =
format (s,
"name %s ",
si->name);
547 s =
format (s,
"domain id %d port id %d",
si->domain_id,
si->port_id);
555 u32 dev_instance = va_arg (*args,
u32);
556 int verbose = va_arg (*args,
int);
561 struct rte_eth_dev_info
di;
562 struct rte_eth_burst_mode
mode;
568 s =
format (s,
"%U\n%Ucarrier %U",
571 s =
format (s,
"%Uflags: %U\n",
573 if (
di.device->devargs &&
di.device->devargs->args)
574 s =
format (s,
"%UDevargs: %s\n",
576 s =
format (s,
"%Urx: queues %d (max %d), desc %d "
577 "(min %d max %d align %d)\n",
580 di.rx_desc_lim.nb_align);
581 s =
format (s,
"%Utx: queues %d (max %d), desc %d "
582 "(min %d max %d align %d)\n",
585 di.tx_desc_lim.nb_align);
587 if (xd->
flags & DPDK_DEVICE_FLAG_PMD)
589 struct rte_pci_device *pci;
590 struct rte_eth_rss_conf rss_conf;
594 rss_conf.rss_key = 0;
596 retval = rte_eth_dev_rss_hash_conf_get (xd->
port_id, &rss_conf);
598 clib_warning (
"rte_eth_dev_rss_hash_conf_get returned %d", retval);
608 s2 =
format (0,
"unknown");
609 s =
format (s,
"%Upci: device %04x:%04x subsystem %04x:%04x "
610 "address %04x:%02x:%02x.%02x numa %v\n",
612 pci->id.device_id, pci->id.subsystem_vendor_id,
613 pci->id.subsystem_device_id, pci->addr.domain,
614 pci->addr.bus, pci->addr.devid, pci->addr.function, s2);
618 if (
di.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID)
632 indent + 2,
di.max_rx_pktlen);
633 s =
format (s,
"%Upromiscuous: unicast %s all-multicast %s\n",
635 rte_eth_promiscuous_get (xd->
port_id) ?
"on" :
"off",
636 rte_eth_allmulticast_get (xd->
port_id) ?
"on" :
"off");
637 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
638 s =
format (s,
"%Uvlan offload: strip %s filter %s qinq %s\n",
640 vlan_off & ETH_VLAN_STRIP_OFFLOAD ?
"on" :
"off",
641 vlan_off & ETH_VLAN_FILTER_OFFLOAD ?
"on" :
"off",
642 vlan_off & ETH_VLAN_EXTEND_OFFLOAD ?
"on" :
"off");
643 s =
format (s,
"%Urx offload avail: %U\n",
646 s =
format (s,
"%Urx offload active: %U\n",
649 s =
format (s,
"%Utx offload avail: %U\n",
652 s =
format (s,
"%Utx offload active: %U\n",
655 s =
format (s,
"%Urss avail: %U\n"
656 "%Urss active: %U\n",
662 if (rte_eth_tx_burst_mode_get (xd->
port_id, 0, &
mode) == 0)
664 s =
format (s,
"%Utx burst mode: %s%s\n",
667 mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
668 " (per queue)" :
"");
672 s =
format (s,
"%Utx burst function: %s\n",
677 if (rte_eth_rx_burst_mode_get (xd->
port_id, 0, &
mode) == 0)
679 s =
format (s,
"%Urx burst mode: %s%s\n",
682 mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
683 " (per queue)" :
"");
687 s =
format (s,
"%Urx burst function: %s\n",
696 if (xd->stats.V != 0) { \
697 s = format (s, "\n%U%-40U%16Lu", \
698 format_white_space, indent + 2, \
699 format_c_identifier, #N, \
709 struct rte_eth_xstat *xstat;
710 struct rte_eth_xstat_name *xstat_names = 0;
713 int ret = rte_eth_xstats_get_names (xd->
port_id, xstat_names,
len);
715 if (ret >= 0 && ret <=
len)
721 if (verbose == 2 || (verbose && xstat->value))
723 xs =
format(xs,
"\n%U%-38s%16Lu",
736 s =
format (s,
"\n%Uextended stats:%v",
762 s =
format (s,
"%U tx queue %d",
792 s =
format (s,
"%U rx queue %d",
805 t->
mb.data_len > sizeof (t->
data) ?
" (truncated)" :
"");
809 sizeof (t->
data) ? sizeof (t->
data) : t->
mb.data_len);
811 f =
node->format_buffer;
824 u32 *pkt_types = va_arg (*va,
u32 *);
830 s =
format (s,
"Packet Types");
833 if ((*pkt_types & RTE_PTYPE_##L##_MASK) == RTE_PTYPE_##L##_##F) \
835 s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent, \
836 "RTE_PTYPE_" #L "_" #F, RTE_PTYPE_##L##_##F, S); \
847 u64 *ol_flags = va_arg (*va,
u64 *);
850 int rx_dynflag_offset;
855 s =
format (s,
"Packet Offload Flags");
860 s = format (s, "\n%U%s (0x%04x) %s", \
861 format_white_space, indent, #F, F, S); \
868 rx_dynflag_offset = rte_mbuf_dynflag_lookup(RTE_MBUF_DYNFLAG_##F##_NAME, \
870 if (rx_dynflag_offset >= 0) \
872 rx_dynflag = (u64) 1 << rx_dynflag_offset; \
873 if (*ol_flags & rx_dynflag) \
875 s = format (s, "\n%U%s %s", format_white_space, indent, \
888 struct rte_mbuf *mb = va_arg (*va,
struct rte_mbuf *);
889 if (mb->ol_flags & PKT_TX_TCP_SEG)
891 s =
format (s,
"l4_len %u tso_segsz %u", mb->l4_len, mb->tso_segsz);
902 if (clib_net_to_host_u16 (vlan_hdr->
type) == ETHERNET_TYPE_DOT1AD)
904 s =
format (s,
"%U 802.1q vlan ",
920 struct rte_mbuf *mb = va_arg (*va,
struct rte_mbuf *);
926 "PKT MBUF: port %d, nb_segs %d, pkt_len %d"
927 "\n%Ubuf_len %d, data_len %d, ol_flags 0x%lx, data_off %d, phys_addr 0x%x"
928 "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u "
930 "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
932 mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off, mb->buf_iova,
942 if ((mb->ol_flags & PKT_RX_VLAN) &&
943 ((mb->ol_flags & (PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ_STRIPPED)) == 0))
966 else if (unformat (input, s)) \
@ VNET_DPDK_PORT_TYPE_VIRTIO_USER
@ VNET_DPDK_PORT_TYPE_UNKNOWN
static uword clib_mem_is_vec(void *v)
Predicate function, says whether the supplied vector is a clib heap object.
u8 interface_name_format_decimal
struct rte_pci_device * dpdk_get_pci_device(const struct rte_eth_dev_info *info)
static void clib_mem_free(void *p)
vlib_main_t vlib_node_runtime_t * node
#define clib_error_return(e, args...)
vl_api_tunnel_mode_t mode
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
dpdk_port_type_t port_type
@ VNET_DPDK_PORT_TYPE_ETH_10G
@ VNET_DPDK_PORT_TYPE_ETH_40G
@ VNET_DPDK_PORT_TYPE_ETH_1G
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
@ VNET_DPDK_PORT_TYPE_ETH_5G
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
format_function_t format_sfp_eeprom
struct rte_eth_conf port_conf
#define vec_foreach_index(var, v)
Iterate over vector indices.
@ VNET_DPDK_PORT_TYPE_AF_PACKET
@ foreach_dpdk_device_flags
@ VNET_DPDK_PORT_TYPE_ETH_25G
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
format_function_t format_vnet_buffer_no_chain
dpdk_config_main_t * conf
@ VNET_DPDK_PORT_TYPE_ETH_50G
u16 af_packet_instance_num
@ VNET_DPDK_PORT_TYPE_ETH_56G
#define vec_free(V)
Free vector's memory (no header).
@ VNET_DPDK_PORT_TYPE_VHOST_ETHER
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
@ VNET_DPDK_PORT_TYPE_ETH_20G
struct rte_eth_xstat * xstats
#define vec_foreach(var, vec)
Vector iterator.
u8 * interface_name_suffix
@ VNET_DPDK_PORT_TYPE_FAILSAFE
@ VNET_DPDK_PORT_TYPE_ETH_2_5G
@ VNET_DPDK_PORT_TYPE_ETH_100G
#define clib_warning(format, args...)
@ VNET_DPDK_PORT_TYPE_ETH_VF
static f64 vlib_time_now(vlib_main_t *vm)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
vlib_trace_main_t trace_main
@ VNET_DPDK_PORT_TYPE_ETH_SWITCH
static void dpdk_update_counters(dpdk_device_t *xd, f64 now)
#define foreach_dpdk_rss_hf
static void * clib_mem_alloc(uword size)
format_function_t format_vnet_sw_interface_name