On 12/8/21 21:25, David Marchand wrote:
On Wed, Nov 24, 2021 at 10:24 PM Maxime Coquelin
<maxime.coque...@redhat.com> wrote:
@@ -2385,6 +2408,7 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_dpdk 
*dev,
          }

          stats->rx_bytes += packet_size;
+        q_stats->bytes += packet_size;
      }

      if (OVS_UNLIKELY(qos_drops)) {
@@ -2437,7 +2461,7 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
      }

      rte_spinlock_lock(&dev->stats_lock);
-    netdev_dpdk_vhost_update_rx_counters(dev, batch->packets,
+    netdev_dpdk_vhost_update_rx_counters(dev, qid, batch->packets,

After some testing, instead of qid here, we should use rxq->queue_id :-)
The tx part is ok.

Oops. Yes, it needs to be rxq->queue_id.


                                           nb_rx, qos_drops);
      rte_spinlock_unlock(&dev->stats_lock);


[snip]


With this fix, I start a vm with a 4 rxq vhost port.
This vhost port has a virtio counterpart bound to the vm virtio-net kmod.

After a while, I can see some stats for rx and tx packets:
# ovs-vsctl get interface vhost4 statistics | sed -e 's#[{}]##g' -e
's#, #\n#g' | grep -v '=0$'
rx_1_to_64_packets=15
rx_256_to_511_packets=25
rx_65_to_127_packets=35
rx_bytes=12185
rx_packets=75
rx_q1_bytes=242
rx_q1_packets=3
rx_q2_bytes=242
rx_q2_packets=3
rx_q3_bytes=11701
rx_q3_packets=69
tx_bytes=2414
tx_packets=20
tx_q0_bytes=2414
tx_q0_packets=20

All good, and per q stats nicely sums to the same value than the "global" stats.

I then stop the vm and look at stats:
# ovs-vsctl get interface vhost4 statistics | sed -e 's#[{}]##g' -e
's#, #\n#g' | grep -v '=0$'
rx_1_to_64_packets=15
rx_256_to_511_packets=26
rx_65_to_127_packets=38
rx_bytes=12776
rx_packets=79
tx_bytes=2414
tx_dropped=1
tx_packets=20
tx_q0_bytes=2414
tx_q0_packets=20


So we end up with misalignment of "global" stats and per q stats in
this situation.
Can we do something about it?

I am unsure about resetting all stats to 0, but it could be the
simpler solution...

I would vote for resetting all counters on number of queues changes,
both per-queue and global, as discussed off-list. That's the only way to
keep consistency between global and per-queue counters.

Maxime



_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to