From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Zhiyong Yang <zhiyong.yang@intel.com>, dev@dpdk.org
Cc: yliu@fridaylinux.org, jianfeng.tan@intel.com
Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix wrong TX pkt length stats
Date: Fri, 13 Oct 2017 12:06:11 +0200 [thread overview]
Message-ID: <c268770f-625b-dafb-807d-c4d2b515ea95@redhat.com> (raw)
In-Reply-To: <20171011043935.16813-1-zhiyong.yang@intel.com>
Hi Zhiyong,
On 10/11/2017 06:39 AM, 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.
>
> Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
>
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
> 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
> + * 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;
I acknowledge the problem, but I don't like modifying pkt_len.
This is not the case currently, but in case we want to do something
with the mbuf later in virtio_xmit_cleanup(), it could be good to have
the real length there.
What about:
if (can_push == 1)
txvq->stats.bytes += txm->pkt_len - txvq->vq->hw->vtnet_hdr_size;
else
txvq->stats.bytes += txm->pkt_len;
Thanks,
Maxime
> virtio_update_packet_stats(&txvq->stats, txm);
> }
>
next prev parent reply other threads:[~2017-10-13 10:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 4:39 Zhiyong Yang
2017-10-13 10:06 ` Maxime Coquelin [this message]
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 ` [dpdk-dev] [PATCH v3] " Zhiyong Yang
2017-10-24 8:46 ` 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=c268770f-625b-dafb-807d-c4d2b515ea95@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=yliu@fridaylinux.org \
--cc=zhiyong.yang@intel.com \
/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).