|
FD.io VPP
v21.06-3-gbb25fbf28
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 #define foreach_dpdk_pkt_rx_offload_flag \
48 _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \
49 _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \
50 _ (PKT_RX_FDIR, "RX packet with FDIR infos") \
51 _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \
52 _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \
53 _ (PKT_RX_EIP_CKSUM_BAD, "External IP header checksum error") \
54 _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \
55 _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \
56 _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \
57 _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \
58 _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \
59 _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped")
61 #define foreach_dpdk_pkt_type \
62 _ (L2, ETHER, "Ethernet packet") \
63 _ (L2, ETHER_TIMESYNC, "Ethernet packet for time sync") \
64 _ (L2, ETHER_ARP, "ARP packet") \
65 _ (L2, ETHER_LLDP, "LLDP (Link Layer Discovery Protocol) packet") \
66 _ (L2, ETHER_NSH, "NSH (Network Service Header) packet") \
67 _ (L2, ETHER_VLAN, "VLAN packet") \
68 _ (L2, ETHER_QINQ, "QinQ packet") \
69 _ (L3, IPV4, "IPv4 packet without extension headers") \
70 _ (L3, IPV4_EXT, "IPv4 packet with extension headers") \
71 _ (L3, IPV4_EXT_UNKNOWN, "IPv4 packet with or without extension headers") \
72 _ (L3, IPV6, "IPv6 packet without extension headers") \
73 _ (L3, IPV6_EXT, "IPv6 packet with extension headers") \
74 _ (L3, IPV6_EXT_UNKNOWN, "IPv6 packet with or without extension headers") \
75 _ (L4, TCP, "TCP packet") \
76 _ (L4, UDP, "UDP packet") \
77 _ (L4, FRAG, "Fragmented IP packet") \
78 _ (L4, SCTP, "SCTP (Stream Control Transmission Protocol) packet") \
79 _ (L4, ICMP, "ICMP packet") \
80 _ (L4, NONFRAG, "Non-fragmented IP packet") \
81 _ (TUNNEL, GRE, "GRE tunneling packet") \
82 _ (TUNNEL, VXLAN, "VXLAN tunneling packet") \
83 _ (TUNNEL, NVGRE, "NVGRE Tunneling packet") \
84 _ (TUNNEL, GENEVE, "GENEVE Tunneling packet") \
85 _ (TUNNEL, GRENAT, "Teredo, VXLAN or GRE Tunneling packet") \
86 _ (INNER_L2, ETHER, "Inner Ethernet packet") \
87 _ (INNER_L2, ETHER_VLAN, "Inner Ethernet packet with VLAN") \
88 _ (INNER_L3, IPV4, "Inner IPv4 packet without extension headers") \
89 _ (INNER_L3, IPV4_EXT, "Inner IPv4 packet with extension headers") \
90 _ (INNER_L3, IPV4_EXT_UNKNOWN, "Inner IPv4 packet with or without extension headers") \
91 _ (INNER_L3, IPV6, "Inner IPv6 packet without extension headers") \
92 _ (INNER_L3, IPV6_EXT, "Inner IPv6 packet with extension headers") \
93 _ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \
94 _ (INNER_L4, TCP, "Inner TCP packet") \
95 _ (INNER_L4, UDP, "Inner UDP packet") \
96 _ (INNER_L4, FRAG, "Inner fragmented IP packet") \
97 _ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \
98 _ (INNER_L4, ICMP, "Inner ICMP packet") \
99 _ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet")
101 #define foreach_dpdk_pkt_tx_offload_flag \
102 _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \
103 _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \
104 _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \
105 _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \
106 _ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp")
108 #define foreach_dpdk_pkt_offload_flag \
109 foreach_dpdk_pkt_rx_offload_flag \
110 foreach_dpdk_pkt_tx_offload_flag
112 #define foreach_dpdk_pkt_dyn_rx_offload_flag \
113 _ (RX_TIMESTAMP, 0, "Timestamp field is valid")
119 char *devname_format;
123 struct rte_eth_dev_info dev_info;
124 struct rte_pci_device *pci_dev;
131 devname_format =
"%s%d/%d/%d";
133 devname_format =
"%s%x/%x/%x";
138 device_name =
"GigabitEthernet";
142 device_name =
"Two_FiveGigabitEthernet";
146 device_name =
"FiveGigabitEthernet";
150 device_name =
"TenGigabitEthernet";
154 device_name =
"TwentyGigabitEthernet";
158 device_name =
"TwentyFiveGigabitEthernet";
162 device_name =
"FortyGigabitEthernet";
166 device_name =
"FiftyGigabitEthernet";
170 device_name =
"FiftySixGigabitEthernet";
174 device_name =
"HundredGigabitEthernet";
178 device_name =
"EthernetSwitch";
182 device_name =
"VirtualFunctionEthernet";
189 device_name =
"VirtioUser";
193 device_name =
"VhostEthernet";
197 device_name =
"FailsafeEthernet";
202 device_name =
"UnknownEthernet";
206 rte_eth_dev_info_get (xd->
port_id, &dev_info);
210 ret =
format (s, devname_format, device_name, pci_dev->addr.bus,
211 pci_dev->addr.devid, pci_dev->addr.function);
226 #define _(a, b, c) if (xd->flags & (1 << a)) \
227 t = format (t, "%s%s", t ? " ":"", c);
244 case VNET_DPDK_PMD_E1000EM:
245 dev_type =
"Intel 82540EM (e1000)";
248 case VNET_DPDK_PMD_IGB:
249 dev_type =
"Intel e1000";
252 case VNET_DPDK_PMD_I40E:
253 dev_type =
"Intel X710/XL710 Family";
256 case VNET_DPDK_PMD_I40EVF:
257 dev_type =
"Intel X710/XL710 Family VF";
260 case VNET_DPDK_PMD_ICE:
261 dev_type =
"Intel E810 Family";
264 case VNET_DPDK_PMD_IAVF:
265 dev_type =
"Intel iAVF";
268 case VNET_DPDK_PMD_FM10K:
269 dev_type =
"Intel FM10000 Family Ethernet Switch";
272 case VNET_DPDK_PMD_IGBVF:
273 dev_type =
"Intel e1000 VF";
276 case VNET_DPDK_PMD_VIRTIO:
277 dev_type =
"Red Hat Virtio";
280 case VNET_DPDK_PMD_IXGBEVF:
281 dev_type =
"Intel 82599 VF";
284 case VNET_DPDK_PMD_IXGBE:
285 dev_type =
"Intel 82599";
288 case VNET_DPDK_PMD_ENIC:
289 dev_type =
"Cisco VIC";
292 case VNET_DPDK_PMD_CXGBE:
293 dev_type =
"Chelsio T4/T5";
296 case VNET_DPDK_PMD_MLX4:
297 dev_type =
"Mellanox ConnectX-3 Family";
300 case VNET_DPDK_PMD_MLX5:
301 dev_type =
"Mellanox ConnectX-4 Family";
304 case VNET_DPDK_PMD_VMXNET3:
305 dev_type =
"VMware VMXNET3";
308 case VNET_DPDK_PMD_AF_PACKET:
309 dev_type =
"af_packet";
312 case VNET_DPDK_PMD_DPAA2:
313 dev_type =
"NXP DPAA2 Mac";
316 case VNET_DPDK_PMD_VIRTIO_USER:
317 dev_type =
"Virtio User";
320 case VNET_DPDK_PMD_THUNDERX:
321 dev_type =
"Cavium ThunderX";
324 case VNET_DPDK_PMD_VHOST_ETHER:
325 dev_type =
"VhostEthernet";
328 case VNET_DPDK_PMD_ENA:
329 dev_type =
"AWS ENA VF";
332 case VNET_DPDK_PMD_FAILSAFE:
333 dev_type =
"FailsafeEthernet";
336 case VNET_DPDK_PMD_LIOVF_ETHER:
337 dev_type =
"Cavium Lio VF";
340 case VNET_DPDK_PMD_QEDE:
341 dev_type =
"Cavium QLogic FastLinQ QL4xxxx";
344 case VNET_DPDK_PMD_NETVSC:
345 dev_type =
"Microsoft Hyper-V Netvsc";
348 case VNET_DPDK_PMD_BNXT:
349 dev_type =
"Broadcom NetXtreme E/S-Series";
354 dev_type =
"### UNKNOWN ###";
358 return format (s, dev_type);
365 struct rte_eth_link *l = &xd->
link;
369 s =
format (s,
"%s ", l->link_status ?
"up" :
"down");
372 u32 promisc = rte_eth_promiscuous_get (xd->
port_id);
374 s =
format (s,
"%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
376 s =
format (s,
"mtu %d %s\n",
hi->max_packet_bytes, promisc ?
385 #define _(n, v, str) \
387 if (format_get_indent (s) > 72) \
388 s = format(s,"\n%U", format_white_space, indent); \
389 s = format(s, "%s ", str); \
395 u64 bitmap = va_arg (*args,
u64);
399 return format (s,
"none");
411 u8 *
id = va_arg (*va,
u8 *);
419 for (
i = 0;
id[
i] != 0 &&
i < l;
i++)
435 if (format_get_indent (s) > 72) \
436 s = format(s,"\n%U", format_white_space, indent); \
437 s = format(s, "%U ", format_offload, func (v)); \
443 u64 bitmap = va_arg (*args,
u32);
448 return format (s,
"none");
450 for (
i = 0;
i < 64;
i++)
454 _(
mask, rte_eth_dev_rx_offload_name);
462 u64 bitmap = va_arg (*args,
u32);
467 return format (s,
"none");
469 for (
i = 0;
i < 64;
i++)
473 _(
mask, rte_eth_dev_tx_offload_name);
498 struct rte_eth_dev_module_info mi = { 0 };
499 struct rte_dev_eeprom_info ei = { 0 };
501 if (rte_eth_dev_get_module_info (xd->
port_id, &mi) != 0)
502 return format (s,
"unknown");
504 ei.length = mi.eeprom_len;
507 if (rte_eth_dev_get_module_eeprom (xd->
port_id, &ei) == 0)
510 (mi.type == RTE_ETH_MODULE_SFF_8436 ? 0x80 : 0));
513 s =
format (s,
"eeprom read error");
522 Dl_info info = { 0 };
524 if (dladdr (p, &info) == 0)
527 return info.dli_sname;
533 struct rte_eth_switch_info *
si =
534 va_arg (*args,
struct rte_eth_switch_info *);
537 s =
format (s,
"name %s ",
si->name);
539 s =
format (s,
"domain id %d port id %d",
si->domain_id,
si->port_id);
547 u32 dev_instance = va_arg (*args,
u32);
548 int verbose = va_arg (*args,
int);
553 struct rte_eth_dev_info
di;
554 struct rte_eth_burst_mode
mode;
560 s =
format (s,
"%U\n%Ucarrier %U",
563 s =
format (s,
"%Uflags: %U\n",
565 if (
di.device->devargs &&
di.device->devargs->args)
566 s =
format (s,
"%UDevargs: %s\n",
568 s =
format (s,
"%Urx: queues %d (max %d), desc %d "
569 "(min %d max %d align %d)\n",
572 di.rx_desc_lim.nb_align);
573 s =
format (s,
"%Utx: queues %d (max %d), desc %d "
574 "(min %d max %d align %d)\n",
577 di.tx_desc_lim.nb_align);
579 if (xd->
flags & DPDK_DEVICE_FLAG_PMD)
581 struct rte_pci_device *pci;
582 struct rte_eth_rss_conf rss_conf;
586 rss_conf.rss_key = 0;
588 retval = rte_eth_dev_rss_hash_conf_get (xd->
port_id, &rss_conf);
590 clib_warning (
"rte_eth_dev_rss_hash_conf_get returned %d", retval);
600 s2 =
format (0,
"unknown");
601 s =
format (s,
"%Upci: device %04x:%04x subsystem %04x:%04x "
602 "address %04x:%02x:%02x.%02x numa %v\n",
604 pci->id.device_id, pci->id.subsystem_vendor_id,
605 pci->id.subsystem_device_id, pci->addr.domain,
606 pci->addr.bus, pci->addr.devid, pci->addr.function, s2);
610 if (
di.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID)
624 indent + 2,
di.max_rx_pktlen);
625 s =
format (s,
"%Upromiscuous: unicast %s all-multicast %s\n",
627 rte_eth_promiscuous_get (xd->
port_id) ?
"on" :
"off",
628 rte_eth_allmulticast_get (xd->
port_id) ?
"on" :
"off");
629 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
630 s =
format (s,
"%Uvlan offload: strip %s filter %s qinq %s\n",
632 vlan_off & ETH_VLAN_STRIP_OFFLOAD ?
"on" :
"off",
633 vlan_off & ETH_VLAN_FILTER_OFFLOAD ?
"on" :
"off",
634 vlan_off & ETH_VLAN_EXTEND_OFFLOAD ?
"on" :
"off");
635 s =
format (s,
"%Urx offload avail: %U\n",
638 s =
format (s,
"%Urx offload active: %U\n",
641 s =
format (s,
"%Utx offload avail: %U\n",
644 s =
format (s,
"%Utx offload active: %U\n",
647 s =
format (s,
"%Urss avail: %U\n"
648 "%Urss active: %U\n",
654 if (rte_eth_tx_burst_mode_get (xd->
port_id, 0, &
mode) == 0)
656 s =
format (s,
"%Utx burst mode: %s%s\n",
659 mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
660 " (per queue)" :
"");
664 s =
format (s,
"%Utx burst function: %s\n",
669 if (rte_eth_rx_burst_mode_get (xd->
port_id, 0, &
mode) == 0)
671 s =
format (s,
"%Urx burst mode: %s%s\n",
674 mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
675 " (per queue)" :
"");
679 s =
format (s,
"%Urx burst function: %s\n",
688 if (xd->stats.V != 0) { \
689 s = format (s, "\n%U%-40U%16Lu", \
690 format_white_space, indent + 2, \
691 format_c_identifier, #N, \
701 struct rte_eth_xstat *xstat;
702 struct rte_eth_xstat_name *xstat_names = 0;
705 int ret = rte_eth_xstats_get_names (xd->
port_id, xstat_names,
len);
707 if (ret >= 0 && ret <=
len)
713 if (verbose == 2 || (verbose && xstat->value))
715 xs =
format(xs,
"\n%U%-38s%16Lu",
728 s =
format (s,
"\n%Uextended stats:%v",
754 s =
format (s,
"%U tx queue %d",
757 s =
format (s,
"\n%Ubuffer 0x%x: %U",
785 s =
format (s,
"%U rx queue %d",
788 s =
format (s,
"\n%Ubuffer 0x%x: %U",
799 t->
mb.data_len > sizeof (t->
data) ?
" (truncated)" :
"");
803 sizeof (t->
data) ? sizeof (t->
data) : t->
mb.data_len);
805 f =
node->format_buffer;
818 u32 *pkt_types = va_arg (*va,
u32 *);
824 s =
format (s,
"Packet Types");
827 if ((*pkt_types & RTE_PTYPE_##L##_MASK) == RTE_PTYPE_##L##_##F) \
829 s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent, \
830 "RTE_PTYPE_" #L "_" #F, RTE_PTYPE_##L##_##F, S); \
841 u64 *ol_flags = va_arg (*va,
u64 *);
844 int rx_dynflag_offset;
849 s =
format (s,
"Packet Offload Flags");
854 s = format (s, "\n%U%s (0x%04x) %s", \
855 format_white_space, indent, #F, F, S); \
862 rx_dynflag_offset = rte_mbuf_dynflag_lookup(RTE_MBUF_DYNFLAG_##F##_NAME, \
864 if (rx_dynflag_offset >= 0) \
866 rx_dynflag = (u64) 1 << rx_dynflag_offset; \
867 if (*ol_flags & rx_dynflag) \
869 s = format (s, "\n%U%s %s", format_white_space, indent, \
885 if (clib_net_to_host_u16 (vlan_hdr->
type) == ETHERNET_TYPE_DOT1AD)
887 s =
format (s,
"%U 802.1q vlan ",
903 struct rte_mbuf *mb = va_arg (*va,
struct rte_mbuf *);
907 s =
format (s,
"PKT MBUF: port %d, nb_segs %d, pkt_len %d"
908 "\n%Ubuf_len %d, data_len %d, ol_flags 0x%lx, data_off %d, phys_addr 0x%x"
909 "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u"
910 "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
911 mb->port, mb->nb_segs, mb->pkt_len,
913 mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off,
915 mb->l2_len, mb->l3_len, mb->outer_l2_len, mb->outer_l3_len,
923 if ((mb->ol_flags & PKT_RX_VLAN) &&
924 ((mb->ol_flags & (PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ_STRIPPED)) == 0))
947 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
sll srl srl sll sra u16x4 i
@ VNET_DPDK_PORT_TYPE_ETH_25G
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
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
@ foreach_dpdk_device_flags
@ 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_buffer
format_function_t format_vnet_sw_interface_name