From: Yuying Zhang <yuying.zhang@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: Yuying Zhang <yuying.zhang@intel.com>, stable@dpdk.org
Subject: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
Date: Tue, 1 Mar 2022 07:28:02 +0000 [thread overview]
Message-ID: <20220301072802.1349736-1-yuying.zhang@intel.com> (raw)
The PMD frees a packet mbuf back into its original mempool
after sending a packet. However, old data is not cleaned up
which causes error in payload of new packets. This patch clear
data of packet mbuf before freeing mbuf.
Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org
Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
drivers/net/vhost/rte_eth_vhost.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 070f0e6dfd..92ed07a334 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -417,10 +417,11 @@ static uint16_t
eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
{
struct vhost_queue *r = q;
- uint16_t i, nb_tx = 0;
+ uint16_t i, j, nb_tx = 0;
uint16_t nb_send = 0;
uint64_t nb_bytes = 0;
uint64_t nb_missed = 0;
+ void *data = NULL;
if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
return 0;
@@ -483,8 +484,13 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
for (i = nb_tx; i < nb_bufs; i++)
vhost_count_xcast_packets(r, bufs[i]);
- for (i = 0; likely(i < nb_tx); i++)
+ for (i = 0; likely(i < nb_tx); i++) {
+ for (j = 0; j < bufs[i]->nb_segs; j++) {
+ data = rte_pktmbuf_mtod(bufs[i], void *);
+ memset(data, 0, bufs[i]->data_len);
+ }
rte_pktmbuf_free(bufs[i]);
+ }
out:
rte_atomic32_set(&r->while_queuing, 0);
--
2.25.1
next reply other threads:[~2022-03-01 7:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 7:28 Yuying Zhang [this message]
2022-03-01 8:38 ` Ling, WeiX
2022-03-01 8:43 ` David Marchand
2022-03-01 9:02 ` Zhang, Yuying
2022-03-01 9:47 ` David Marchand
2022-03-01 17:05 ` Stephen Hemminger
2022-03-02 8:58 ` Zhang, Yuying
2022-03-03 6:49 ` Xia, Chenbo
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=20220301072802.1349736-1-yuying.zhang@intel.com \
--to=yuying.zhang@intel.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.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).