printf("\n NIC statistics for port %d cleared\n", port_id);
}
+void
+nic_xstats_display(portid_t port_id)
+{
+ struct rte_eth_xstats *xstats;
+ int len, ret, i;
+
+ printf("###### NIC extended statistics for port %-2d\n", port_id);
+
+ len = rte_eth_xstats_get(port_id, NULL, 0);
+ if (len < 0) {
+ printf("Cannot get xstats count\n");
+ return;
+ }
+ xstats = malloc(sizeof(xstats[0]) * len);
+ if (xstats == NULL) {
+ printf("Cannot allocate memory for xstats\n");
+ return;
+ }
+ ret = rte_eth_xstats_get(port_id, xstats, len);
+ if (ret < 0 || ret > len) {
+ printf("Cannot get xstats\n");
+ free(xstats);
+ return;
+ }
+ for (i = 0; i < len; i++)
+ printf("%s: %"PRIu64"\n", xstats[i].name, xstats[i].value);
+ free(xstats);
+}
+
+void
+nic_xstats_clear(portid_t port_id)
+{
+ rte_eth_xstats_reset(port_id);
+}
void
nic_stats_mapping_display(portid_t port_id)
port_infos_display(portid_t port_id)
{
struct rte_port *port;
+ struct ether_addr mac_addr;
struct rte_eth_link link;
int vlan_offload;
struct rte_mempool * mp;
rte_eth_link_get_nowait(port_id, &link);
printf("\n%s Infos for port %-2d %s\n",
info_border, port_id, info_border);
- print_ethaddr("MAC address: ", &port->eth_addr);
+ rte_eth_macaddr_get(port_id, &mac_addr);
+ print_ethaddr("MAC address: ", &mac_addr);
printf("\nConnect to socket: %u", port->socket_id);
if (port_numa[port_id] != NUMA_NO_CONFIG) {
}
}
-static int
+int
port_id_is_invalid(portid_t port_id)
{
if (port_id < nb_ports)
/*
* RX/TX ring descriptors display functions.
*/
-static int
+int
rx_queue_id_is_invalid(queueid_t rxq_id)
{
if (rxq_id < nb_rxq)
return 1;
}
-static int
+int
tx_queue_id_is_invalid(queueid_t txq_id)
{
if (txq_id < nb_txq)
char mz_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz;
- rte_snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d",
+ snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d",
ports[port_id].dev_info.driver_name, ring_name, port_id, q_id);
mz = rte_memzone_lookup(mz_name);
if (mz == NULL)
} words;
};
-#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
-struct igb_ring_desc_32B {
+struct igb_ring_desc_32_bytes {
union igb_ring_dword lo_dword;
union igb_ring_dword hi_dword;
union igb_ring_dword resv1;
union igb_ring_dword resv2;
};
-#endif
-struct igb_ring_desc {
+struct igb_ring_desc_16_bytes {
union igb_ring_dword lo_dword;
union igb_ring_dword hi_dword;
};
static void
-ring_rx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
+ring_rxd_display_dword(union igb_ring_dword dword)
{
-#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC
- struct igb_ring_desc *ring;
- struct igb_ring_desc rd;
+ printf(" 0x%08X - 0x%08X\n", (unsigned)dword.words.lo,
+ (unsigned)dword.words.hi);
+}
- ring = (struct igb_ring_desc *) ring_mz->addr;
+static void
+ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
+#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+ uint8_t port_id,
#else
- struct igb_ring_desc_32B *ring;
- struct igb_ring_desc_32B rd;
+ __rte_unused uint8_t port_id,
+#endif
+ uint16_t desc_id)
+{
+ struct igb_ring_desc_16_bytes *ring =
+ (struct igb_ring_desc_16_bytes *)ring_mz->addr;
+#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+ struct rte_eth_dev_info dev_info;
- ring = (struct igb_ring_desc_32B *) ring_mz->addr;
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (strstr(dev_info.driver_name, "i40e") != NULL) {
+ /* 32 bytes RX descriptor, i40e only */
+ struct igb_ring_desc_32_bytes *ring =
+ (struct igb_ring_desc_32_bytes *)ring_mz->addr;
+
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].lo_dword));
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].hi_dword));
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].resv1));
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].resv2));
+ return;
+ }
#endif
- rd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
- rd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
- printf(" 0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
- (unsigned)rd.lo_dword.words.lo, (unsigned)rd.lo_dword.words.hi,
- (unsigned)rd.hi_dword.words.lo, (unsigned)rd.hi_dword.words.hi);
+ /* 16 bytes RX descriptor */
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].lo_dword));
+ ring_rxd_display_dword(rte_le_to_cpu_64(
+ ring[desc_id].hi_dword));
}
static void
ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
{
- struct igb_ring_desc *ring;
- struct igb_ring_desc rd;
+ struct igb_ring_desc_16_bytes *ring;
+ struct igb_ring_desc_16_bytes txd;
- ring = (struct igb_ring_desc *) ring_mz->addr;
- rd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
- rd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
+ ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
+ txd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
+ txd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
printf(" 0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
- (unsigned)rd.lo_dword.words.lo, (unsigned)rd.lo_dword.words.hi,
- (unsigned)rd.hi_dword.words.lo, (unsigned)rd.hi_dword.words.hi);
+ (unsigned)txd.lo_dword.words.lo,
+ (unsigned)txd.lo_dword.words.hi,
+ (unsigned)txd.hi_dword.words.lo,
+ (unsigned)txd.hi_dword.words.hi);
}
void
rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id);
if (rx_mz == NULL)
return;
- ring_rx_descriptor_display(rx_mz, rxd_id);
+ ring_rx_descriptor_display(rx_mz, port_id, rxd_id);
}
void
}
void
-tx_cksum_set(portid_t port_id, uint8_t cksum_mask)
+tx_cksum_set(portid_t port_id, uint64_t ol_flags)
{
- uint16_t tx_ol_flags;
+ uint64_t tx_ol_flags;
if (port_id_is_invalid(port_id))
return;
- /* Clear last 4 bits and then set L3/4 checksum mask again */
- tx_ol_flags = (uint16_t) (ports[port_id].tx_ol_flags & 0xFFF0);
- ports[port_id].tx_ol_flags = (uint16_t) ((cksum_mask & 0xf) | tx_ol_flags);
+ /* Clear last 8 bits and then set L3/4 checksum mask again */
+ tx_ol_flags = ports[port_id].tx_ol_flags & (~0x0FFull);
+ ports[port_id].tx_ol_flags = ((ol_flags & 0xff) | tx_ol_flags);
}
void