#define XSTAT_RX_FRAGMENTED_ERRORS "rx_fragmented_errors"
#define XSTAT_RX_JABBER_ERRORS "rx_jabber_errors"
+/* Size of vHost custom stats. */
+#define VHOST_CUSTOM_STATS_SIZE 1
+
+/* Names of vHost custom stats. */
+#define VHOST_STAT_TX_RETRIES "tx_retries"
+
#define SOCKET0 0
/* Default size of Physical NIC RXQ */
PADDED_MEMBERS(CACHE_LINE_SIZE,
struct netdev_stats stats;
+ /* Custom stat for retries when unable to transmit. */
+ uint64_t tx_retries;
/* Protects stats */
rte_spinlock_t stats_lock;
- /* 44 pad bytes here. */
+ /* 4 pad bytes here. */
);
PADDED_MEMBERS(CACHE_LINE_SIZE,
dev->rte_xstats_ids = NULL;
dev->rte_xstats_ids_size = 0;
+ dev->tx_retries = 0;
+
return 0;
}
rte_spinlock_lock(&dev->stats_lock);
netdev_dpdk_vhost_update_tx_counters(&dev->stats, pkts, total_pkts,
cnt + dropped);
+ dev->tx_retries += MIN(retries, VHOST_ENQ_RETRY_NUM);
rte_spinlock_unlock(&dev->stats_lock);
out:
return 0;
}
+static int
+netdev_dpdk_vhost_get_custom_stats(const struct netdev *netdev,
+ struct netdev_custom_stats *custom_stats)
+{
+ struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+
+ ovs_mutex_lock(&dev->mutex);
+
+ custom_stats->size = VHOST_CUSTOM_STATS_SIZE;
+ custom_stats->counters = xcalloc(custom_stats->size,
+ sizeof *custom_stats->counters);
+ ovs_strlcpy(custom_stats->counters[0].name, VHOST_STAT_TX_RETRIES,
+ NETDEV_CUSTOM_STATS_NAME_SIZE);
+
+ rte_spinlock_lock(&dev->stats_lock);
+ custom_stats->counters[0].value = dev->tx_retries;
+ rte_spinlock_unlock(&dev->stats_lock);
+
+ ovs_mutex_unlock(&dev->mutex);
+
+ return 0;
+}
+
static int
netdev_dpdk_get_features(const struct netdev *netdev,
enum netdev_features *current,
.send = netdev_dpdk_vhost_send,
.get_carrier = netdev_dpdk_vhost_get_carrier,
.get_stats = netdev_dpdk_vhost_get_stats,
+ .get_custom_stats = netdev_dpdk_vhost_get_custom_stats,
.get_status = netdev_dpdk_vhost_user_get_status,
.reconfigure = netdev_dpdk_vhost_reconfigure,
.rxq_recv = netdev_dpdk_vhost_rxq_recv,
.send = netdev_dpdk_vhost_send,
.get_carrier = netdev_dpdk_vhost_get_carrier,
.get_stats = netdev_dpdk_vhost_get_stats,
+ .get_custom_stats = netdev_dpdk_vhost_get_custom_stats,
.get_status = netdev_dpdk_vhost_user_get_status,
.reconfigure = netdev_dpdk_vhost_client_reconfigure,
.rxq_recv = netdev_dpdk_vhost_rxq_recv,