[ovs-dev] [PATCH] netdev-dpdk: Fix sw stats perf drop.
Kevin Traynor
ktraynor at redhat.com
Tue Dec 17 15:07:37 UTC 2019
Accessing the sw stats in the vhost datapath of a PVP test
can incur a performance drop of ~2%.
Most of the time these stats will just be getting zero added
to them. By checking if there is a non-zero update first, we
can avoid accessing them when they won't be updated and avoid
the performance drop.
Fixes: 2f862c712e52 ("netdev-dpdk: Detailed packet drop statistics.")
Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
---
lib/netdev-dpdk.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 89c73a29b..238f29a2a 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2175,5 +2175,4 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_dpdk *dev,
int qos_drops)
{
- struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats;
struct netdev_stats *stats = &dev->stats;
struct dp_packet *packet;
@@ -2206,5 +2205,7 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_dpdk *dev,
}
- sw_stats->rx_qos_drops += qos_drops;
+ if (OVS_UNLIKELY(qos_drops)) {
+ dev->sw_stats->rx_qos_drops += qos_drops;
+ }
}
@@ -2370,5 +2371,4 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_dpdk *dev,
struct netdev_dpdk_sw_stats *sw_stats_add)
{
- struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats;
int dropped = sw_stats_add->tx_mtu_exceeded_drops +
sw_stats_add->tx_qos_drops +
@@ -2385,8 +2385,12 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_dpdk *dev,
}
- sw_stats->tx_retries += sw_stats_add->tx_retries;
- sw_stats->tx_failure_drops += sw_stats_add->tx_failure_drops;
- sw_stats->tx_mtu_exceeded_drops += sw_stats_add->tx_mtu_exceeded_drops;
- sw_stats->tx_qos_drops += sw_stats_add->tx_qos_drops;
+ if (OVS_UNLIKELY(dropped || sw_stats_add->tx_retries)) {
+ struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats;
+
+ sw_stats->tx_retries += sw_stats_add->tx_retries;
+ sw_stats->tx_failure_drops += sw_stats_add->tx_failure_drops;
+ sw_stats->tx_mtu_exceeded_drops += sw_stats_add->tx_mtu_exceeded_drops;
+ sw_stats->tx_qos_drops += sw_stats_add->tx_qos_drops;
+ }
}
--
2.21.0
More information about the dev
mailing list