From patchwork Thu Jul 30 12:08:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang_y_yi X-Patchwork-Id: 75036 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFEFEA052B; Thu, 30 Jul 2020 14:09:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D1862BC7; Thu, 30 Jul 2020 14:09:08 +0200 (CEST) Received: from mail-m974.mail.163.com (mail-m974.mail.163.com [123.126.97.4]) by dpdk.org (Postfix) with ESMTP id 7B7871023 for ; Thu, 30 Jul 2020 14:09:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Z0xEf AcIlG7UazUOoxO0z8+F9G+0Lb/6Ky1JI6Ak4OA=; b=iYx6B9EoNPcrE4+G7nHf0 /0znqkPXhl/eYXTCpHLUBa20+cq0h47L99zCWSvKrLQYyfHMgqGPXcywbCBVu27R H5TgMzP3BrI6TSNYpFVRvEAKBnM36IOhIHjTKoFjrX136Is3l2jTd9dxOk0gRzBQ 1wZwsHCT2ONicWtY5cPK/k= Received: from yangyi0100.home.langchao.com (unknown [61.48.210.155]) by smtp4 (Coremail) with SMTP id HNxpCgBXekNcuCJfZo1vIA--.3698S3; Thu, 30 Jul 2020 20:09:02 +0800 (CST) 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 Date: Thu, 30 Jul 2020 20:08:58 +0800 Message-Id: <20200730120900.108232-2-yang_y_yi@163.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20200730120900.108232-1-yang_y_yi@163.com> References: <20200730120900.108232-1-yang_y_yi@163.com> MIME-Version: 1.0 X-CM-TRANSID: HNxpCgBXekNcuCJfZo1vIA--.3698S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7JF1rJrWruF1UGF4fAFyxZrb_yoWDKFc_ua 4FkF1ktay7Jr4xZw43Jw4Yga1xurW7Aa18Ww4Igw45Xr4qgFsxu34DJr42qFWDu3yUGFWx WF43uFn2yr1FvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8wSdDUUUUU== X-Originating-IP: [61.48.210.155] X-CM-SenderInfo: 51dqwsp1b1xqqrwthudrp/xtbB0h5xi1UMX9eJ+wAAsV Subject: [dpdk-dev] [PATCH V1 1/3] gso: fix refcnt update issue for external mbuf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yi Yang 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 --- 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) {