DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhiyong Yang <zhiyong.yang@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, yliu@fridaylinux.org,
	maxime.coquelin@redhat.com, Zhiyong Yang <zhiyong.yang@intel.com>
Subject: [dpdk-dev] [PATCH v3] net/virtio: fix wrong TX pkt length stats
Date: Tue, 24 Oct 2017 11:06:14 +0800	[thread overview]
Message-ID: <20171024030614.37690-1-zhiyong.yang@intel.com> (raw)
In-Reply-To: <20171023064036.56821-1-zhiyong.yang@intel.com>

In the function virtqueue_enqueue_xmit(), when can_push is true,
vtnet_hdr_size is added to pkt_len by calling rte_pktmbuf_prepend.
which is wrong for pkt stats, virtio header length should be subtracted
before calling stats function.

Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")

Cc: stable@dpdk.org
Cc: yliu@fridaylinux.org
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---

Changes in V3:
Move code inside "if (can_push)" clause and simplify comments.

Changes in V2:
Put code in the function virtqueue_enqueue_xmit() according to
yuanhan's comments.

 drivers/net/virtio/virtio_rxtx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 2cf82fef4..ac4055d45 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -299,6 +299,10 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 		/* prepend cannot fail, checked by caller */
 		hdr = (struct virtio_net_hdr *)
 			rte_pktmbuf_prepend(cookie, head_size);
+		/* rte_pktmbuf_prepend() counts the hdr size to the pkt length,
+		 * which is wrong. Below subtract restores correct pkt size.
+		 */
+		cookie->pkt_len -= head_size;
 		/* if offload disabled, it is not zeroed below, do it now */
 		if (offload == 0) {
 			ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);
-- 
2.13.3

  parent reply	other threads:[~2017-10-24  3:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  4:39 [dpdk-dev] [PATCH] " Zhiyong Yang
2017-10-13 10:06 ` Maxime Coquelin
2017-10-13 12:44   ` Yang, Zhiyong
2017-10-13 12:47     ` Maxime Coquelin
2017-10-17 13:21 ` Yuanhan Liu
2017-10-23  6:40 ` [dpdk-dev] [PATCH v2] " Zhiyong Yang
2017-10-23 13:21   ` Yuanhan Liu
2017-10-24  2:05     ` Yang, Zhiyong
2017-10-24  3:06   ` Zhiyong Yang [this message]
2017-10-24  8:46     ` [dpdk-dev] [PATCH v3] " Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171024030614.37690-1-zhiyong.yang@intel.com \
    --to=zhiyong.yang@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=yliu@fridaylinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).