#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
-#include <vlib/unix/cj.h>
#include <assert.h>
+#define __USE_GNU
+#include <dlfcn.h>
+
#include <vnet/ethernet/ethernet.h>
+#include <vnet/ethernet/sfp.h>
#include <dpdk/device/dpdk.h>
#include <dpdk/device/dpdk_priv.h>
_ (tx_bytes_ok, q_obytes) \
_ (rx_errors, q_errors)
-#define foreach_dpdk_rss_hf \
- _(ETH_RSS_FRAG_IPV4, "ipv4-frag") \
- _(ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \
- _(ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \
- _(ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \
- _(ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \
- _(ETH_RSS_IPV4, "ipv4") \
- _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \
- _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") \
- _(ETH_RSS_FRAG_IPV6, "ipv6-frag") \
- _(ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \
- _(ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \
- _(ETH_RSS_NONFRAG_IPV6_SCTP, "ipv6-sctp") \
- _(ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \
- _(ETH_RSS_L2_PAYLOAD, "l2-payload") \
- _(ETH_RSS_IPV6_EX, "ipv6-ex") \
- _(ETH_RSS_IPV6, "ipv6")
-
-
-#define foreach_dpdk_rx_offload_caps \
- _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \
- _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
- _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
- _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
- _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \
- _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip")
-
-#define foreach_dpdk_tx_offload_caps \
- _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \
- _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
- _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
- _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
- _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \
- _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \
- _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \
- _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \
- _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert")
-
-#define foreach_dpdk_pkt_rx_offload_flag \
- _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \
- _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \
- _ (PKT_RX_FDIR, "RX packet with FDIR infos") \
- _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \
- _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \
- _ (PKT_RX_EIP_CKSUM_BAD, "External IP header checksum error") \
- _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \
- _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \
- _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \
- _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \
- _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \
- _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped") \
- _ (PKT_RX_TIMESTAMP, "Timestamp field is valid")
+#if RTE_VERSION < RTE_VERSION_NUM(21, 5, 0, 0)
+#define PKT_RX_OUTER_IP_CKSUM_BAD PKT_RX_EIP_CKSUM_BAD
+#endif
+
+#define foreach_dpdk_pkt_rx_offload_flag \
+ _ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \
+ _ (PKT_RX_RSS_HASH, "RX packet with RSS hash result") \
+ _ (PKT_RX_FDIR, "RX packet with FDIR infos") \
+ _ (PKT_RX_L4_CKSUM_BAD, "L4 cksum of RX pkt. is not OK") \
+ _ (PKT_RX_IP_CKSUM_BAD, "IP cksum of RX pkt. is not OK") \
+ _ (PKT_RX_OUTER_IP_CKSUM_BAD, "External IP header checksum error") \
+ _ (PKT_RX_VLAN_STRIPPED, "RX packet VLAN tag stripped") \
+ _ (PKT_RX_IP_CKSUM_GOOD, "IP cksum of RX pkt. is valid") \
+ _ (PKT_RX_L4_CKSUM_GOOD, "L4 cksum of RX pkt. is valid") \
+ _ (PKT_RX_IEEE1588_PTP, "RX IEEE1588 L2 Ethernet PT Packet") \
+ _ (PKT_RX_IEEE1588_TMST, "RX IEEE1588 L2/L4 timestamped packet") \
+ _ (PKT_RX_QINQ_STRIPPED, "RX packet QinQ tags stripped")
#define foreach_dpdk_pkt_type \
_ (L2, ETHER, "Ethernet packet") \
_ (INNER_L3, IPV6_EXT_UNKNOWN, "Inner IPv6 packet with or without extension headers") \
_ (INNER_L4, TCP, "Inner TCP packet") \
_ (INNER_L4, UDP, "Inner UDP packet") \
- _ (INNER_L4, FRAG, "Inner fagmented IP packet") \
+ _ (INNER_L4, FRAG, "Inner fragmented IP packet") \
_ (INNER_L4, SCTP, "Inner SCTP (Stream Control Transmission Protocol) packet") \
_ (INNER_L4, ICMP, "Inner ICMP packet") \
_ (INNER_L4, NONFRAG, "Inner non-fragmented IP packet")
-#define foreach_dpdk_pkt_tx_offload_flag \
- _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \
- _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \
- _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \
- _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \
+#define foreach_dpdk_pkt_tx_offload_flag \
+ _ (PKT_TX_VLAN_PKT, "TX packet is a 802.1q VLAN packet") \
+ _ (PKT_TX_TUNNEL_VXLAN, "TX packet is a VXLAN packet") \
+ _ (PKT_TX_IP_CKSUM, "IP cksum of TX pkt. computed by NIC") \
+ _ (PKT_TX_TCP_CKSUM, "TCP cksum of TX pkt. computed by NIC") \
+ _ (PKT_TX_SCTP_CKSUM, "SCTP cksum of TX pkt. computed by NIC") \
+ _ (PKT_TX_OUTER_IP_CKSUM, "Outer IP cksum of Tx pkt. computed by NIC") \
+ _ (PKT_TX_TCP_SEG, "TSO of TX pkt. done by NIC") \
_ (PKT_TX_IEEE1588_TMST, "TX IEEE1588 packet to timestamp")
#define foreach_dpdk_pkt_offload_flag \
foreach_dpdk_pkt_rx_offload_flag \
foreach_dpdk_pkt_tx_offload_flag
-#define foreach_dpdk_log_level \
- _ (EMERG, "emergency") \
- _ (ALERT, "alert") \
- _ (CRIT, "critical") \
- _ (ERR, "error") \
- _ (WARNING, "warning") \
- _ (NOTICE, "notice") \
- _ (INFO, "info") \
- _ (DEBUG, "debug")
+#define foreach_dpdk_pkt_dyn_rx_offload_flag \
+ _ (RX_TIMESTAMP, 0, "Timestamp field is valid")
u8 *
format_dpdk_device_name (u8 * s, va_list * args)
char *devname_format;
char *device_name;
u32 i = va_arg (*args, u32);
+ dpdk_device_t *xd = vec_elt_at_index (dm->devices, i);
struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
u8 *ret;
+ if (xd->name)
+ return format (s, "%s", xd->name);
+
if (dm->conf->interface_name_format_decimal)
devname_format = "%s%d/%d/%d";
else
devname_format = "%s%x/%x/%x";
- switch (dm->devices[i].port_type)
+ switch (xd->port_type)
{
case VNET_DPDK_PORT_TYPE_ETH_1G:
device_name = "GigabitEthernet";
device_name = "HundredGigabitEthernet";
break;
- case VNET_DPDK_PORT_TYPE_ETH_BOND:
- return format (s, "BondEthernet%d", dm->devices[i].port_id);
-
case VNET_DPDK_PORT_TYPE_ETH_SWITCH:
device_name = "EthernetSwitch";
break;
break;
case VNET_DPDK_PORT_TYPE_AF_PACKET:
- rte_eth_dev_info_get (i, &dev_info);
- return format (s, "af_packet%d", dm->devices[i].port_id);
+ return format (s, "af_packet%d", xd->af_packet_instance_num);
case VNET_DPDK_PORT_TYPE_VIRTIO_USER:
device_name = "VirtioUser";
break;
}
- rte_eth_dev_info_get (i, &dev_info);
+ rte_eth_dev_info_get (xd->port_id, &dev_info);
+ pci_dev = dpdk_get_pci_device (&dev_info);
- if (dev_info.pci_dev &&
- dm->devices[i].port_type != VNET_DPDK_PORT_TYPE_FAILSAFE)
- ret = format (s, devname_format, device_name, dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
+ if (pci_dev && xd->port_type != VNET_DPDK_PORT_TYPE_FAILSAFE)
+ ret = format (s, devname_format, device_name, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
else
- ret = format (s, "%s%d", device_name, dm->devices[i].device_index);
+ ret = format (s, "%s%d", device_name, xd->port_id);
- if (dm->devices[i].interface_name_suffix)
- return format (ret, "/%s", dm->devices[i].interface_name_suffix);
+ if (xd->interface_name_suffix)
+ return format (ret, "/%s", xd->interface_name_suffix);
return ret;
}
dev_type = "Intel X710/XL710 Family VF";
break;
+ case VNET_DPDK_PMD_ICE:
+ dev_type = "Intel E810 Family";
+ break;
+
+ case VNET_DPDK_PMD_IAVF:
+ dev_type = "Intel iAVF";
+ break;
+
case VNET_DPDK_PMD_FM10K:
dev_type = "Intel FM10000 Family Ethernet Switch";
break;
dev_type = "af_packet";
break;
- case VNET_DPDK_PMD_BOND:
- dev_type = "Ethernet Bonding";
- break;
-
case VNET_DPDK_PMD_DPAA2:
dev_type = "NXP DPAA2 Mac";
break;
break;
case VNET_DPDK_PMD_FAILSAFE:
- dev_type = "Failsafe Ethernet";
+ dev_type = "FailsafeEthernet";
+ break;
+
+ case VNET_DPDK_PMD_LIOVF_ETHER:
+ dev_type = "Cavium Lio VF";
+ break;
+
+ case VNET_DPDK_PMD_QEDE:
+ dev_type = "Cavium QLogic FastLinQ QL4xxxx";
+ break;
+
+ case VNET_DPDK_PMD_NETVSC:
+ dev_type = "Microsoft Hyper-V Netvsc";
+ break;
+
+ case VNET_DPDK_PMD_BNXT:
+ dev_type = "Broadcom NetXtreme E/S-Series";
break;
default:
s = format (s, "%s ", l->link_status ? "up" : "down");
if (l->link_status)
{
- u32 promisc = rte_eth_promiscuous_get (xd->device_index);
+ u32 promisc = rte_eth_promiscuous_get (xd->port_id);
s = format (s, "%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
"full" : "half");
- s = format (s, "speed %u mtu %d %s\n", l->link_speed,
- hi->max_packet_bytes, promisc ? " promisc" : "");
+ s = format (s, "mtu %d %s\n", hi->max_packet_bytes, promisc ?
+ " promisc" : "");
}
else
s = format (s, "\n");
return s;
}
-#define _line_len 72
-#define _(v, str) \
+#define _(n, v, str) \
if (bitmap & v) { \
- if (format_get_indent (s) > next_split ) { \
- next_split += _line_len; \
+ if (format_get_indent (s) > 72) \
s = format(s,"\n%U", format_white_space, indent); \
- } \
s = format(s, "%s ", str); \
}
-static u8 *
+u8 *
format_dpdk_rss_hf_name (u8 * s, va_list * args)
{
u64 bitmap = va_arg (*args, u64);
- int next_split = _line_len;
u32 indent = format_get_indent (s);
if (!bitmap)
foreach_dpdk_rss_hf return s;
}
+#undef _
+
+/* Convert to all lower case e.g "VLAN_STRIP" -> "vlan-strip"
+ Works for both vector names and null terminated c strings. */
static u8 *
+format_offload (u8 * s, va_list * va)
+{
+ u8 *id = va_arg (*va, u8 *);
+ uword i, l;
+
+ l = ~0;
+ if (clib_mem_is_vec (id))
+ l = vec_len (id);
+
+ if (id)
+ for (i = 0; id[i] != 0 && i < l; i++)
+ {
+ u8 c = id[i];
+
+ if (c == '_')
+ c = '-';
+ else
+ c = tolower (c);
+ vec_add1 (s, c);
+ }
+
+ return s;
+}
+
+#define _(v, func) \
+if (bitmap & v) { \
+ if (format_get_indent (s) > 72) \
+ s = format(s,"\n%U", format_white_space, indent); \
+ s = format(s, "%U ", format_offload, func (v)); \
+}
+
+u8 *
format_dpdk_rx_offload_caps (u8 * s, va_list * args)
{
- u32 bitmap = va_arg (*args, u32);
- int next_split = _line_len;
+ u64 bitmap = va_arg (*args, u32);
u32 indent = format_get_indent (s);
+ uword i;
if (!bitmap)
return format (s, "none");
- foreach_dpdk_rx_offload_caps return s;
+ for (i = 0; i < 64; i++)
+ {
+ u64 mask = (u64) 1 << i;
+
+ _(mask, rte_eth_dev_rx_offload_name);
+ }
+ return s;
}
-static u8 *
+u8 *
format_dpdk_tx_offload_caps (u8 * s, va_list * args)
{
- u32 bitmap = va_arg (*args, u32);
- int next_split = _line_len;
+ u64 bitmap = va_arg (*args, u32);
u32 indent = format_get_indent (s);
+ uword i;
+
if (!bitmap)
return format (s, "none");
- foreach_dpdk_tx_offload_caps return s;
+ for (i = 0; i < 64; i++)
+ {
+ u64 mask = (u64) 1 << i;
+
+ _(mask, rte_eth_dev_tx_offload_name);
+ }
+ return s;
}
-#undef _line_len
#undef _
u8 *
return s;
}
+static u8 *
+format_dpdk_device_module_info (u8 * s, va_list * args)
+{
+ dpdk_device_t *xd = va_arg (*args, dpdk_device_t *);
+ struct rte_eth_dev_module_info mi = { 0 };
+ struct rte_dev_eeprom_info ei = { 0 };
+
+ if (rte_eth_dev_get_module_info (xd->port_id, &mi) != 0)
+ return format (s, "unknown");
+
+ ei.length = mi.eeprom_len;
+ ei.data = clib_mem_alloc (mi.eeprom_len);
+
+ if (rte_eth_dev_get_module_eeprom (xd->port_id, &ei) == 0)
+ {
+ s = format (s, "%U", format_sfp_eeprom, ei.data +
+ (mi.type == RTE_ETH_MODULE_SFF_8436 ? 0x80 : 0));
+ }
+ else
+ s = format (s, "eeprom read error");
+
+ clib_mem_free (ei.data);
+ return s;
+}
+
+static const char *
+ptr2sname (void *p)
+{
+ Dl_info info = { 0 };
+
+ if (dladdr (p, &info) == 0)
+ return 0;
+
+ return info.dli_sname;
+}
+
+static u8 *
+format_switch_info (u8 * s, va_list * args)
+{
+ struct rte_eth_switch_info *si =
+ va_arg (*args, struct rte_eth_switch_info *);
+
+ if (si->name)
+ s = format (s, "name %s ", si->name);
+
+ s = format (s, "domain id %d port id %d", si->domain_id, si->port_id);
+
+ return s;
+}
+
u8 *
format_dpdk_device (u8 * s, va_list * args)
{
u32 indent = format_get_indent (s);
f64 now = vlib_time_now (dm->vlib_main);
struct rte_eth_dev_info di;
+ struct rte_eth_burst_mode mode;
dpdk_update_counters (xd, now);
dpdk_update_link_state (xd, now);
+ rte_eth_dev_info_get (xd->port_id, &di);
s = format (s, "%U\n%Ucarrier %U",
- format_dpdk_device_type, xd->device_index,
+ format_dpdk_device_type, dev_instance,
format_white_space, indent + 2, format_dpdk_link_status, xd);
s = format (s, "%Uflags: %U\n",
format_white_space, indent + 2, format_dpdk_device_flags, xd);
-
- rte_eth_dev_info_get (xd->device_index, &di);
-
- if (verbose > 1 && xd->flags & DPDK_DEVICE_FLAG_PMD)
+ if (di.device->devargs && di.device->devargs->args)
+ s = format (s, "%UDevargs: %s\n",
+ format_white_space, indent + 2, di.device->devargs->args);
+ s = format (s, "%Urx: queues %d (max %d), desc %d "
+ "(min %d max %d align %d)\n",
+ format_white_space, indent + 2, xd->rx_q_used, di.max_rx_queues,
+ xd->nb_rx_desc, di.rx_desc_lim.nb_min, di.rx_desc_lim.nb_max,
+ di.rx_desc_lim.nb_align);
+ s = format (s, "%Utx: queues %d (max %d), desc %d "
+ "(min %d max %d align %d)\n",
+ format_white_space, indent + 2, xd->tx_q_used, di.max_tx_queues,
+ xd->nb_tx_desc, di.tx_desc_lim.nb_min, di.tx_desc_lim.nb_max,
+ di.tx_desc_lim.nb_align);
+
+ if (xd->flags & DPDK_DEVICE_FLAG_PMD)
{
struct rte_pci_device *pci;
struct rte_eth_rss_conf rss_conf;
int retval;
rss_conf.rss_key = 0;
- retval = rte_eth_dev_rss_hash_conf_get (xd->device_index, &rss_conf);
+ rss_conf.rss_hf = 0;
+ retval = rte_eth_dev_rss_hash_conf_get (xd->port_id, &rss_conf);
if (retval < 0)
clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval);
- pci = di.pci_dev;
+
+ pci = dpdk_get_pci_device (&di);
if (pci)
- s =
- format (s,
- "%Upci id: device %04x:%04x subsystem %04x:%04x\n"
- "%Upci address: %04x:%02x:%02x.%02x\n",
- format_white_space, indent + 2, pci->id.vendor_id,
- pci->id.device_id, pci->id.subsystem_vendor_id,
- pci->id.subsystem_device_id, format_white_space, indent + 2,
- pci->addr.domain, pci->addr.bus, pci->addr.devid,
- pci->addr.function);
- s =
- format (s, "%Umax rx packet len: %d\n", format_white_space,
- indent + 2, di.max_rx_pktlen);
- s =
- format (s, "%Umax num of queues: rx %d tx %d\n", format_white_space,
- indent + 2, di.max_rx_queues, di.max_tx_queues);
- s =
- format (s, "%Upromiscuous: unicast %s all-multicast %s\n",
- format_white_space, indent + 2,
- rte_eth_promiscuous_get (xd->device_index) ? "on" : "off",
- rte_eth_allmulticast_get (xd->device_index) ? "on" : "off");
- vlan_off = rte_eth_dev_get_vlan_offload (xd->device_index);
- s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n",
+ {
+ u8 *s2;
+ if (xd->cpu_socket > -1)
+ s2 = format (0, "%d", xd->cpu_socket);
+ else
+ s2 = format (0, "unknown");
+ s = format (s, "%Upci: device %04x:%04x subsystem %04x:%04x "
+ "address %04x:%02x:%02x.%02x numa %v\n",
+ format_white_space, indent + 2, pci->id.vendor_id,
+ pci->id.device_id, pci->id.subsystem_vendor_id,
+ pci->id.subsystem_device_id, pci->addr.domain,
+ pci->addr.bus, pci->addr.devid, pci->addr.function, s2);
+ vec_free (s2);
+ }
+
+ if (di.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID)
+ {
+ s =
+ format (s, "%Uswitch info: %U\n", format_white_space, indent + 2,
+ format_switch_info, &di.switch_info);
+ }
+
+ if (1 < verbose)
+ {
+ s = format (s, "%Umodule: %U\n", format_white_space, indent + 2,
+ format_dpdk_device_module_info, xd);
+ }
+
+ s = format (s, "%Umax rx packet len: %d\n", format_white_space,
+ indent + 2, di.max_rx_pktlen);
+ s = format (s, "%Upromiscuous: unicast %s all-multicast %s\n",
+ format_white_space, indent + 2,
+ rte_eth_promiscuous_get (xd->port_id) ? "on" : "off",
+ rte_eth_allmulticast_get (xd->port_id) ? "on" : "off");
+ vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id);
+ s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n",
format_white_space, indent + 2,
vlan_off & ETH_VLAN_STRIP_OFFLOAD ? "on" : "off",
vlan_off & ETH_VLAN_FILTER_OFFLOAD ? "on" : "off",
vlan_off & ETH_VLAN_EXTEND_OFFLOAD ? "on" : "off");
- s = format (s, "%Urx offload caps: %U\n",
+ s = format (s, "%Urx offload avail: %U\n",
format_white_space, indent + 2,
format_dpdk_rx_offload_caps, di.rx_offload_capa);
- s = format (s, "%Utx offload caps: %U\n",
+ s = format (s, "%Urx offload active: %U\n",
+ format_white_space, indent + 2,
+ format_dpdk_rx_offload_caps, xd->port_conf.rxmode.offloads);
+ s = format (s, "%Utx offload avail: %U\n",
format_white_space, indent + 2,
format_dpdk_tx_offload_caps, di.tx_offload_capa);
- s = format (s, "%Urss active: %U\n"
- "%Urss supported: %U\n",
+ s = format (s, "%Utx offload active: %U\n",
format_white_space, indent + 2,
- format_dpdk_rss_hf_name, rss_conf.rss_hf,
+ format_dpdk_tx_offload_caps, xd->port_conf.txmode.offloads);
+ s = format (s, "%Urss avail: %U\n"
+ "%Urss active: %U\n",
format_white_space, indent + 2,
- format_dpdk_rss_hf_name, di.flow_type_rss_offloads);
- }
+ format_dpdk_rss_hf_name, di.flow_type_rss_offloads,
+ format_white_space, indent + 2,
+ format_dpdk_rss_hf_name, rss_conf.rss_hf);
- s = format (s, "%Urx queues %d, rx desc %d, tx queues %d, tx desc %d\n",
- format_white_space, indent + 2,
- xd->rx_q_used, xd->nb_rx_desc, xd->tx_q_used, xd->nb_tx_desc);
+ if (rte_eth_tx_burst_mode_get (xd->port_id, 0, &mode) == 0)
+ {
+ s = format (s, "%Utx burst mode: %s%s\n",
+ format_white_space, indent + 2,
+ mode.info,
+ mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
+ " (per queue)" : "");
+ }
+ else
+ {
+ s = format (s, "%Utx burst function: %s\n",
+ format_white_space, indent + 2,
+ ptr2sname (rte_eth_devices[xd->port_id].tx_pkt_burst));
+ }
- if (xd->cpu_socket > -1)
- s = format (s, "%Ucpu socket %d\n",
- format_white_space, indent + 2, xd->cpu_socket);
+ if (rte_eth_rx_burst_mode_get (xd->port_id, 0, &mode) == 0)
+ {
+ s = format (s, "%Urx burst mode: %s%s\n",
+ format_white_space, indent + 2,
+ mode.info,
+ mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ?
+ " (per queue)" : "");
+ }
+ else
+ {
+ s = format (s, "%Urx burst function: %s\n",
+ format_white_space, indent + 2,
+ ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst));
+ }
+ }
/* $$$ MIB counters */
{
#define _(N, V) \
- if ((xd->stats.V - xd->last_cleared_stats.V) != 0) { \
- s = format (s, "\n%U%-40U%16Ld", \
+ if (xd->stats.V != 0) { \
+ s = format (s, "\n%U%-40U%16Lu", \
format_white_space, indent + 2, \
format_c_identifier, #N, \
- xd->stats.V - xd->last_cleared_stats.V); \
+ xd->stats.V); \
} \
foreach_dpdk_counter
u8 *xs = 0;
u32 i = 0;
- struct rte_eth_xstat *xstat, *last_xstat;
+ struct rte_eth_xstat *xstat;
struct rte_eth_xstat_name *xstat_names = 0;
- int len = rte_eth_xstats_get_names (xd->device_index, NULL, 0);
+ int len = vec_len (xd->xstats);
vec_validate (xstat_names, len - 1);
- rte_eth_xstats_get_names (xd->device_index, xstat_names, len);
-
- ASSERT (vec_len (xd->xstats) == vec_len (xd->last_cleared_xstats));
+ int ret = rte_eth_xstats_get_names (xd->port_id, xstat_names, len);
- /* *INDENT-OFF* */
- vec_foreach_index(i, xd->xstats)
+ if (ret >= 0 && ret <= len)
{
- u64 delta = 0;
- xstat = vec_elt_at_index(xd->xstats, i);
- last_xstat = vec_elt_at_index(xd->last_cleared_xstats, i);
-
- delta = xstat->value - last_xstat->value;
- if (verbose == 2 || (verbose && delta))
+ /* *INDENT-OFF* */
+ vec_foreach_index(i, xd->xstats)
{
- /* format_c_identifier doesn't like c strings inside vector */
- u8 * name = format(0,"%s", xstat_names[i].name);
- xs = format(xs, "\n%U%-38U%16Ld",
- format_white_space, indent + 4,
- format_c_identifier, name, delta);
- vec_free(name);
+ xstat = vec_elt_at_index(xd->xstats, i);
+ if (verbose == 2 || (verbose && xstat->value))
+ {
+ xs = format(xs, "\n%U%-38s%16Lu",
+ format_white_space, indent + 4,
+ xstat_names[i].name,
+ xstat->value);
+ }
}
- }
- /* *INDENT-ON* */
+ /* *INDENT-ON* */
- vec_free (xstat_names);
+ vec_free (xstat_names);
+ }
if (xs)
{
s = format (s, "%U tx queue %d",
format_vnet_sw_interface_name, vnm, sw, t->queue_index);
- s = format (s, "\n%Ubuffer 0x%x: %U",
- format_white_space, indent,
- t->buffer_index, format_vnet_buffer, &t->buffer);
+ s = format (s, "\n%Ubuffer 0x%x: %U", format_white_space, indent,
+ t->buffer_index, format_vnet_buffer_no_chain, &t->buffer);
s = format (s, "\n%U%U",
format_white_space, indent,
s = format (s, "%U rx queue %d",
format_vnet_sw_interface_name, vnm, sw, t->queue_index);
- s = format (s, "\n%Ubuffer 0x%x: %U",
- format_white_space, indent,
- t->buffer_index, format_vnet_buffer, &t->buffer);
+ s = format (s, "\n%Ubuffer 0x%x: %U", format_white_space, indent,
+ t->buffer_index, format_vnet_buffer_no_chain, &t->buffer);
s = format (s, "\n%U%U",
format_white_space, indent,
{
u64 *ol_flags = va_arg (*va, u64 *);
u32 indent = format_get_indent (s) + 2;
+ u64 rx_dynflag;
+ int rx_dynflag_offset;
if (!*ol_flags)
return s;
}
foreach_dpdk_pkt_offload_flag
+#undef _
+#define _(F, P, S) \
+ { \
+ rx_dynflag_offset = rte_mbuf_dynflag_lookup(RTE_MBUF_DYNFLAG_##F##_NAME, \
+ P); \
+ if (rx_dynflag_offset >= 0) \
+ { \
+ rx_dynflag = (u64) 1 << rx_dynflag_offset; \
+ if (*ol_flags & rx_dynflag) \
+ { \
+ s = format (s, "\n%U%s %s", format_white_space, indent, \
+ #F, S); \
+ } \
+ } \
+ }
+ foreach_dpdk_pkt_dyn_rx_offload_flag
#undef _
return s;
}
+u8 *
+format_dpdk_rte_mbuf_tso (u8 *s, va_list *va)
+{
+ struct rte_mbuf *mb = va_arg (*va, struct rte_mbuf *);
+ if (mb->ol_flags & PKT_TX_TCP_SEG)
+ {
+ s = format (s, "l4_len %u tso_segsz %u", mb->l4_len, mb->tso_segsz);
+ }
+ return s;
+}
+
u8 *
format_dpdk_rte_mbuf_vlan (u8 * s, va_list * va)
{
ethernet_header_t *eth_hdr = va_arg (*va, ethernet_header_t *);
u32 indent = format_get_indent (s) + 2;
- s = format (s, "PKT MBUF: port %d, nb_segs %d, pkt_len %d"
- "\n%Ubuf_len %d, data_len %d, ol_flags 0x%lx, data_off %d, phys_addr 0x%x"
- "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u"
- "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
- mb->port, mb->nb_segs, mb->pkt_len,
- format_white_space, indent,
- mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off,
- mb->buf_physaddr, format_white_space, indent, mb->packet_type,
- mb->l2_len, mb->l3_len, mb->outer_l2_len, mb->outer_l3_len,
- format_white_space, indent, mb->hash.rss, mb->hash.fdir.hi,
- mb->hash.fdir.lo);
+ s = format (
+ s,
+ "PKT MBUF: port %d, nb_segs %d, pkt_len %d"
+ "\n%Ubuf_len %d, data_len %d, ol_flags 0x%lx, data_off %d, phys_addr 0x%x"
+ "\n%Upacket_type 0x%x l2_len %u l3_len %u outer_l2_len %u outer_l3_len %u "
+ "%U"
+ "\n%Urss 0x%x fdir.hi 0x%x fdir.lo 0x%x",
+ mb->port, mb->nb_segs, mb->pkt_len, format_white_space, indent,
+ mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off, mb->buf_iova,
+ format_white_space, indent, mb->packet_type, mb->l2_len, mb->l3_len,
+ mb->outer_l2_len, mb->outer_l3_len, format_dpdk_rte_mbuf_tso, mb,
+ format_white_space, indent, mb->hash.rss, mb->hash.fdir.hi,
+ mb->hash.fdir.lo);
if (mb->ol_flags)
s = format (s, "\n%U%U", format_white_space, indent,
if (0)
;
#undef _
-#define _(f, s) \
+#define _(n, f, s) \
else if (unformat (input, s)) \
*rss_fn |= f;
return 0;
}
-uword
-unformat_dpdk_log_level (unformat_input_t * input, va_list * args)
-{
- u32 *r = va_arg (*args, u32 *);
-
- if (0);
-#define _(v,s) else if (unformat (input, s)) *r = RTE_LOG_##v;
- foreach_dpdk_log_level
-#undef _
- else
- return 0;
- return 1;
-}
-
-clib_error_t *
-unformat_hqos (unformat_input_t * input, dpdk_device_config_hqos_t * hqos)
-{
- clib_error_t *error = 0;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "hqos-thread %u", &hqos->hqos_thread))
- hqos->hqos_thread_valid = 1;
- else
- {
- error = clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
- break;
- }
- }
-
- return error;
-}
/*
* fd.io coding-style-patch-verification: ON