From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH] net/virtio: fix wrong TX pkt length stats Date: Tue, 17 Oct 2017 21:21:15 +0800 Message-ID: <20171017132114.GX1545@yliu-home> References: <20171011043935.16813-1-zhiyong.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, maxime.coquelin@redhat.com, jianfeng.tan@intel.com To: Zhiyong Yang Return-path: Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 27C7F1B71D for ; Tue, 17 Oct 2017 15:21:25 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20171011043935.16813-1-zhiyong.yang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Oct 11, 2017 at 12:39:35PM +0800, Zhiyong Yang wrote: > In the function virtqueue_enqueue_xmit(), when can_push == 1 is true, > vtnet_hdr_size is added to pkt_len by calling rte_pktmbuf_prepend. > So, virtio header len should be subtracted before calling stats > function. Nice catch! > Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload") It should also Cc stable. > Signed-off-by: Zhiyong Yang > --- > drivers/net/virtio/virtio_rxtx.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c > index 609b4138a..bf14f9a99 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -1079,6 +1079,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) > /* Enqueue Packet buffers */ > virtqueue_enqueue_xmit(txvq, txm, slots, use_indirect, can_push); > > + /* In function virtqueue_enqueue_xmit(), when can_push == 1 Hmm..., why not modifying it directly in virtqueue_enqueue_xmit()? --yliu > + * is true, vtnet_hdr_size is added to pkt_len of mbuf. So, it > + * should be subtracted before calling stats function. > + */ > + if (can_push == 1) > + txm->pkt_len -= txvq->vq->hw->vtnet_hdr_size; > txvq->stats.bytes += txm->pkt_len; > virtio_update_packet_stats(&txvq->stats, txm); > } > -- > 2.13.3