Skip to contentSkip to conversation

net/virtio: avoid double accounting of bytes

PATCH Applied Jens Freimann 2 participants 3 messages Dec 20, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/virtio: avoid double accounting of bytes

Accounting of bytes was moved to a common function, so at the moment we do it twice. This patches fixes it for sending packets with packed virtqueues.

---
 drivers/net/virtio/virtio_rxtx.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +0 -1
index 8564f18a7..8a08606fb 100644
@@ -1931,7 +1931,6 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,
 		/* Enqueue Packet buffers */
 		virtqueue_enqueue_xmit_packed(txvq, txm, slots, can_push);
 
-		txvq->stats.bytes += txm->pkt_len;
 		virtio_update_packet_stats(&txvq->stats, txm);
 	}
 
Signature · 1 line
2.17.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Jens Freimann

Accounting of bytes was moved to a common function, so at the moment we do it twice. This patches fixes it for sending packets with packed virtqueues.

---
  drivers/net/virtio/virtio_rxtx.c | 1 -
  1 file changed, 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +0 -0
index 8564f18a7..8a08606fb 100644

drivers/net/virtio/virtio_rxtx.c virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1936

Quoted 7 lines
drivers/net/virtio/virtio_rxtx.c +0 -1
@@ -1931,7 +1931,6 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,
  		/* Enqueue Packet buffers */
  		virtqueue_enqueue_xmit_packed(txvq, txm, slots, can_push);
 
-		txvq->stats.bytes += txm->pkt_len;
  		virtio_update_packet_stats(&txvq->stats, txm);
  	}
 

Thanks Jens for the quick fix:

Maxime

#2 lore raw
In reply to Jens Freimann
Quoted 8 lines · Jens Freimann

Accounting of bytes was moved to a common function, so at the moment we do it twice. This patches fixes it for sending packets with packed virtqueues.

---
  drivers/net/virtio/virtio_rxtx.c | 1 -
  1 file changed, 1 deletion(-)

Applied to dpdk-next-virtio.

Maxime