DPDK patches and discussions
 help / color / mirror / Atom feed
From: yang_y_yi@163.com
To: dev@dpdk.org
Cc: jiayu.hu@intel.com, thomas@monjalon.net, yangyi01@inspur.com,
	yang_y_yi@163.com
Subject: [dpdk-dev] [PATCH 1/3] gso: fix refcnt update issue for external mbuf
Date: Thu, 30 Jul 2020 17:56:08 +0800	[thread overview]
Message-ID: <20200730095610.93384-2-yang_y_yi@163.com> (raw)
In-Reply-To: <20200730095610.93384-1-yang_y_yi@163.com>

From: Yi Yang <yangyi01@inspur.com>

rte_gso_segment will segment original mbuf to multiple
small size mbufs, every mbuf of them has two segments,
the second segment will attach to original mbuf, if
original mbuf is external, rte_gso_segment should update
refcnt of mbuf->shinfo but not refcnt of mbuf. Otherwise,
original mbuf will be invalid on doing sanity check
because refcnt of mbuf is 0.

Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")

Signed-off-by: Yi Yang <yangyi01@inspur.com>
---
 lib/librte_gso/rte_gso.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c
index 751b5b6..b5e8b2a 100644
--- a/lib/librte_gso/rte_gso.c
+++ b/lib/librte_gso/rte_gso.c
@@ -83,7 +83,10 @@
 	if (ret > 1) {
 		pkt_seg = pkt;
 		while (pkt_seg) {
-			rte_mbuf_refcnt_update(pkt_seg, -1);
+			if (RTE_MBUF_HAS_EXTBUF(pkt_seg))
+				rte_mbuf_ext_refcnt_update(pkt_seg->shinfo, -1);
+			else
+				rte_mbuf_refcnt_update(pkt_seg, -1);
 			pkt_seg = pkt_seg->next;
 		}
 	} else if (ret < 0) {
-- 
1.8.3.1


  reply	other threads:[~2020-07-30  9:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30  9:56 [dpdk-dev] [PATCH 0/3] Fix external mbuf free issue in GSO case yang_y_yi
2020-07-30  9:56 ` yang_y_yi [this message]
2020-07-30  9:56 ` [dpdk-dev] [PATCH 2/3] mbuf: change free_cb interface to adapt to " yang_y_yi
2020-07-30 10:16   ` Thomas Monjalon
     [not found]     ` <f16b530ed9234b988241d5c4b4329d1b@inspur.com>
2020-07-30 10:42       ` [dpdk-dev] 答复: " Thomas Monjalon
2020-07-30 10:44         ` yang_y_yi
2020-07-30 12:18         ` yang_y_yi
2020-07-30  9:56 ` [dpdk-dev] [PATCH 3/3] vhost: use new free_cb interface to fix mbuf free issue yang_y_yi

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=20200730095610.93384-2-yang_y_yi@163.com \
    --to=yang_y_yi@163.com \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=thomas@monjalon.net \
    --cc=yangyi01@inspur.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).