From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCB76A00C2 for ; Wed, 28 Sep 2022 07:26:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C03AC42BAE; Wed, 28 Sep 2022 07:26:07 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) by mails.dpdk.org (Postfix) with ESMTP id 1CA8742BCC; Wed, 28 Sep 2022 07:26:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M5UtA57vshfodOlZO1LZY03e2tQJHFN+z0lXYPoHj/vZuZyztu90Mepk5KdME70M+rJAP1qAvifcGS1ClzlZSYUW6fYX0R+ZbXN4DqCXHsyJkImJSGR6Chmg6cC/tWKCQD5BpYQGju1aWAPNY2UxNsIQbJpuLhfbjUW54bZTfu3/l0STCCgQB9yZ274sSF/rYQ5h4Pib8U16EXlJfBuVsynnC+OrsmEDDz/TRGY6D64F0+EQEbdPWSOqlYqC5jqyWs4xIqi33nlRAKE3ZG34rQkrd0Q4ZrYMGzEHm2EEW27F63K2ROLR/FPmrxzhTUVXxWMMfXgpY3nzu+SpP4GFIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r+QpVLrLpeO4VxgrvGUdY2yYiUsvDbVpkzG7RqjN2Nc=; b=ZzWK6R0IA/VbaQe09UQtrHk2+9uqAtcT1MXth/ezfqTmcBoD3ajU4IirJAaBLhaKo8O+AXvKBQOTBPGskuXJ+N+HsyzIxo3QEI+OcbcP2JXJI5ZytwZ0AuWXc797nUOdlP1obdS2wySqeF8g3AGxM9URG9uNZghKGR0eUItLIYvTUa/h3r1M7omKPnpZjVhwi3fkAxb1KeIHS12vZTHJ+d+Ar7hIpdtCVEtpnjswcDrqAIkyG9QmcJc3b8P/Rp0fpBL43QoRdjBIQPTDOx/ngBZw0ZCf6br88yGaXGJGsBjr7YgsHJE2jAzc/8QveU1se1z+vJKTXqlMZCa4WcFBuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r+QpVLrLpeO4VxgrvGUdY2yYiUsvDbVpkzG7RqjN2Nc=; b=KdgkuQBJm9v7ODnjh+TLgCd8TZ03twSVloHBAXGxW86YahOXxmYe3/d6pWlT84SONmXxGQyc/uHW6bd/zeaGz5hozpBhTrxxcCamMAzpBqcsRqyc3qk/P73KK14ah3d2xL0xlpmZHF5s3u0138kwOb0SJU81a1hdDEo3hynYz4s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM9PR04MB8988.eurprd04.prod.outlook.com (2603:10a6:20b:40b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Wed, 28 Sep 2022 05:26:04 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::14d0:4458:d6ec:b8b1]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::14d0:4458:d6ec:b8b1%7]) with mapi id 15.20.5676.017; Wed, 28 Sep 2022 05:26:04 +0000 From: Gagandeep Singh To: ferruh.yigit@amd.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH 15/15] net/dpaa: fix buffer free in slow path Date: Wed, 28 Sep 2022 10:55:16 +0530 Message-Id: <20220928052516.1279442-16-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928052516.1279442-1-g.singh@nxp.com> References: <20220928052516.1279442-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGBP274CA0015.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::27) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AM9PR04MB8988:EE_ X-MS-Office365-Filtering-Correlation-Id: 69ef2dbc-ca78-491a-7576-08daa111f02d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjUhNcKaRoq9A3TPe4jnE0KIe7J7QcLpMFgnu7WTmtecTWlGGlX5dcnW0wGkKbpn4Mv3utnaiJcmn5cZw+Uf5zDEaXV9tjxHS3Izul6UQZThyx9oalnQmtEXvRuE5tZkmATcHbIqbSGCnQ+GFxdd82tkwN5nCWligciNetyF16+N2uQEnB8ZA9Q9Xbzv14atXnexibCyNsMNXBJ1I6XRhHi78Fpb6q9ue+kxQGTvJbnnrZhKJbNOjPimy5VqjrNu3Ncz1FFDwB+XaqF9JXC/IpqOutTvXU06rUKkYbqvpec/nWwFRbMo4Tu6aM/MLFAH/xk2vgdDowzrD0g/nqzPvK5sZ4jSv6L4jjId6EzP45kdk0UJ3+xwAkgiXPUaONCxHNx9Jsf5JAP7jXQExIRzWGjgRdyFdFWJQYDlD0J2mi081RECp9Zz7hVo7fWFG4XdgoyYPQRVl0j3xPIJ0cde2jFlgdiJj6lbkMoUpat0JQ+HR/vKdsD161IM5a0DWckxSDfWBsGBij5ONisQRpuc1jvmtXLn4BoejX7zKrKHsmVqZsPD3qKmM0Concyqk0MTr88APVsdJl5chrcWuObA4R/4tMHow4FzFGdPWTCE//d+7czaPXboBLT7yKnPWmcK5I9rISq2yrOCwtvY9sQYRck0F0c5N1xFAxD+hc8aRn0K9yH7KDBnDRwXN74GsfJWWrjdeB/zXNZJl/c5NwjDNQBu1ePYuttk4KX1D3peUzljCVB82kBUGhaUgtoFtoRB258wV4isWcrjw6Vu9n6YJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199015)(26005)(52116002)(6512007)(478600001)(6506007)(6666004)(83380400001)(2616005)(186003)(1076003)(2906002)(5660300002)(8936002)(316002)(6486002)(41300700001)(66556008)(66476007)(4326008)(8676002)(66946007)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?itrQ0i3TmHX33Slf0lgq6HcHbos+2O7NPVMyIXOGu/H656zOsGZFf2PPbreb?= =?us-ascii?Q?fEgrRiNHdqIjX/FXDEYmRoNvql/V0YPHF45tt1bJapg/bd7voPb7BRnplVdl?= =?us-ascii?Q?rP2xj+tWPc+pZNY+QQ060bBWCWoq2UVxCRo7q9NA05zLHjoltNH9GlOZ03jz?= =?us-ascii?Q?1m3JdFWKgzXSUH5iu8BAMSRnLG3sOhyOnZEQMm87uKW4XteZajIs8dBjCEKr?= =?us-ascii?Q?pBMywtNiVkfB0gMTzeaCleIGQBnTF/57mmCFHcwL81g+9LjbEtzYDIQlTFtE?= =?us-ascii?Q?wqzUuyXiqmulETs5/Xchx0AeQkEGHfQc0caCYWCHE9xruaB7HJ7eggKwPg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DhOJdkenH6dO/aqM0gG7bciJqx8dt9iU?= =?us-ascii?Q?4l/Jl+w/XkyLsOlmbtAmC8SWOLFNi+wG0vB4I7UJ7pzmSZi3NQjDO4xcf1Mj?= =?us-ascii?Q?0EiZEGyW72oc3R/b/3AEmlAcQKWjfbLybdoclcYu1LXkYrZ8zF4OKTV5bmrm?= =?us-ascii?Q?r5OibIz96hLkCNPJEXQkZ/OR1iiwb8IZgX29sWwMyFw9MaS1DPbMBAmOG2vK?= =?us-ascii?Q?7L/Vay0n27yVcwbjQSfYF5hKwQUjwtn7axKyCUP3DDNRtXrp7C9qWCUrXbLL?= =?us-ascii?Q?WEP6T2to2B7DtSbxfN40amVlby35KIyrZ5Q2WTJJcqAGrpMIRl/bPW5MaqdN?= =?us-ascii?Q?WvHwVMcL8SRN7p6+e3fUj8bdyGjqwTHgicoWw7Wa?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69ef2dbc-ca78-491a-7576-08daa111f02d X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 05:26:04.4561 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hf5kjBvhm0hsb1kvLUfVL71Fyg8SMSiX8Yup+hZjUG9TiFPChRFrdN5/56hfYKuy X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8988 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Adding a check in slow path to free those buffers which are not external. Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 4d285b4f38..ce4f3d6c85 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info = DPAA_BPID_TO_POOL_INFO(fd->bpid); format = (fd->opaque & DPAA_FD_FORMAT_MASK) >> DPAA_FD_FORMAT_SHIFT; if (unlikely(format == qm_fd_sg)) { - struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; + struct rte_mbuf *first_seg, *cur_seg; struct qm_sg_entry *sgt, *sg_temp; void *vaddr, *sg_vaddr; int i = 0; @@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++]; hw_sg_to_cpu(sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, qm_sg_entry_get64(sg_temp)); - first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs = 1; - prev_seg = first_seg; while (i < DPAA_SGT_MAX_ENTRIES) { sg_temp = &sgt[i++]; hw_sg_to_cpu(sg_temp); - sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, + if (sg_temp->bpid != 0xFF) { + bp_info = DPAA_BPID_TO_POOL_INFO(sg_temp->bpid); + sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, qm_sg_entry_get64(sg_temp)); - cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); - first_seg->nb_segs += 1; - prev_seg->next = cur_seg; - if (sg_temp->final) { - cur_seg->next = NULL; - break; + rte_pktmbuf_free_seg(cur_seg); } - prev_seg = cur_seg; + if (sg_temp->final) + break; } - - rte_pktmbuf_free_seg(temp); rte_pktmbuf_free_seg(first_seg); return 0; } -- 2.25.1