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 A67C8A0543 for ; Wed, 5 Oct 2022 16:21:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B8CF42685; Wed, 5 Oct 2022 16:21:57 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2048.outbound.protection.outlook.com [40.107.244.48]) by mails.dpdk.org (Postfix) with ESMTP id 9C66E40143; Wed, 5 Oct 2022 16:21:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZo2Q3ticghFfu9kwdiURQqtE74gNgf145sBq0PcLjY8++g89XFmEfmnJ1y6zz1A0FjnkYt/saeYAxAeYJsOBQZysTAQ1zMui25GbU1rJ7T6H0XB3mrz0JKcWf7sc9YFOBeQa01hSk3binNSZCDAJL8YAQs7JgFgEN5j+KEn/alnzc82JPGPJIXGru3D4Ks08B2U7fs1MBupNkNvZ+xes1O0gKRbgQBCGCnoIxcm1VJi41an9F43HpseF9aYHoLhqLQtPCsg6fZErBUvIROTnSW9GBdvswbcUq7Z8GxzxMj1Zc1HV5PwD3BI/YsvvEGfMDR/2D/QWQaDtCTEsHKjNQ== 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=G3m2QCMb9+eDkUojpKsBEfgrS2TqqYfPAtEH1olPmzw=; b=JfTdxMyO8QOu8Z0sb37v9I5rId0EBC9/rEw4TMQ2b8FZVzaRhx4CmBMZ6s3MSYCGOE6Y1f3LKuV534pcgci/CjHt7pk18e5++B5VFO7ZsBe6IkVqUAwkR8awi86dYkXrnuo+xIdps970+4eCwApgfHD7mPHL8RogvmH5ZAueFz+g1pfnWkSBCSmRKbnvziIXdaHn5vGI7lmrCU7e4RyAOWW5IagPDUkNQq/XEvHEuux/ZD5E+poE8W4qrUEZ9JMyZjktCa3IZtbN5ypns9srt6WXBfj8hDKZnz0NMALRPTQSs3fuyzkmBzW1t6LaaF0adu36G9ohpiZdgdka+OqbCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G3m2QCMb9+eDkUojpKsBEfgrS2TqqYfPAtEH1olPmzw=; b=WB7XGLRbP8u/wxLAV8Dg6rEUMUOXpRO1i0p8w4gMswKTTz4n1vNddzIewX3C1U+4shXnL5SHYwSbiYW+O5aL/l8VeVop5U//Pu20vmvEVo2JLQRE1O4HdnvX7vzSg8E3z4xyD5W/plrd4ra0NQxFvVB5a92BtrJM9aMkFKo3syY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by PH0PR12MB5402.namprd12.prod.outlook.com (2603:10b6:510:ef::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24; Wed, 5 Oct 2022 14:21:51 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f%7]) with mapi id 15.20.5676.032; Wed, 5 Oct 2022 14:21:51 +0000 Message-ID: Date: Wed, 5 Oct 2022 15:21:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 15/15] net/dpaa: fix buffer free in slow path Content-Language: en-US To: Gagandeep Singh , dev@dpdk.org Cc: stable@dpdk.org References: <20220928052516.1279442-1-g.singh@nxp.com> <20220928052516.1279442-16-g.singh@nxp.com> From: Ferruh Yigit In-Reply-To: <20220928052516.1279442-16-g.singh@nxp.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0621.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:294::21) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH0PR12MB5402:EE_ X-MS-Office365-Filtering-Correlation-Id: 0006c81b-b565-4f30-812a-08daa6dcf234 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yoFE31addV4+prY+UiFwQJqA5KoEJ1CZiohtVdlyytZPHgJWibHQ7/uEZwlK8jcmfSiL9RKfBaOGvstWL9K05sioWs6/BLn5Om9L6Uz2QN8zI/WZwixMUuh+u2bIBjG7zv94lilDIwwhvAbrgx+UjIjKP7ZrhZUmY01CajHyBXwzV21fJT1VHUNTGGSXZxwZiV701m9YmJzX+7jlbwl0kPHcV2SvYuDg4W/jCq4bQn6n7MtdeZeTLJtCZ2PnKf7tW18bNxVQYZldCq9GUdky3lvVgHrzN1/u/uALpRsfIl3CacjN4ZIg0fHod5LVURHEQKIGUVuiOHieq1A+sDA1Q4abXEpRyIGjTTa+0ivDRKQAJuY73tsATrIRSJMza77HxZDzsuhWzOpGkzzDAAVl24ldTMjhuHbafYlNURhUEJkmcVlV/Zcum26MgH73vMJtj3raZt7RTTBW2wM6S8Hp7KbjZJixB2ZL8ElVGIg2VWso82I5sTZcrHqT1855RZPmIR+M/hZ3nMH02DgeJ+jB8UJxsJXptCxxLp9m7iYY8F9pTwSg9coJIpfw+c/VcKbg38JQrKFL9oZmwIwhGvvTa182T5xJQq/M3V5XtiDB/PIIR/Jf+9GUan/T7Ox62D/r3Gkw9zTmdQwDI4BH7KJwkMQhGrZQnrHoB5TOyw8PW3G4pnGnkkLVdOVqoB2ugIjoLjrnHWeBparDRCdX7hHhRgm/+3FPWMhAePklndodvabfDpm0qV6RECHpjFlDIVePsivs3VlrzcL0wDstJ+jZPTAmMZ7UJO0sCTHjD0szYYs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(376002)(366004)(39860400002)(136003)(451199015)(36756003)(31686004)(86362001)(31696002)(38100700002)(186003)(83380400001)(2616005)(6512007)(26005)(53546011)(6506007)(6666004)(478600001)(6486002)(2906002)(316002)(44832011)(41300700001)(5660300002)(8936002)(66476007)(4326008)(66556008)(66946007)(8676002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TVNXYlhWbGN0Y0I2QkM5VW85c2FiZEg5NWs1RkYxOWEzbW5yNGJESjk5MEJD?= =?utf-8?B?VElvellFckdPK1RnK2VXdEtUcm5qQmFwYklEdEZyYnpmTmY3Nk9nRHFMUnBp?= =?utf-8?B?U3l5VnA3S3dQU2hyRlk5dkd2NFdyQ2llc3UyTEVWa2NsZjhrbEVwRENWWW0v?= =?utf-8?B?NGZxZGxoSy9RYVdGdXhGVjVnU1VseC9nWHNPbndTQzB2Z3Q2dHEzTlVwN2VH?= =?utf-8?B?Z3Yxb1EvdElLMGNPR1ZiSy9vUUFPTnZEQUhLUmswRHdhSTM2SG4vbCtwU1Ji?= =?utf-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rS2ZOOHZlTTl1WjJz?= =?utf-8?Q?wk24=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0006c81b-b565-4f30-812a-08daa6dcf234 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2022 14:21:51.4920 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jJuaHp1haSTisf044WEe4+4XSCXBn90NKRMyfoKGH+WX6/kkydG+qwl9EPKpUS2W X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5402 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 On 9/28/2022 6:25 AM, Gagandeep Singh wrote: > Adding a check in slow path to free those buffers > which are not external. > Can you please explain what was the error before fix, what was happening when you try to free all mbufs? Also it seems previous logic was different, with 'prev_seg' etc, can you explain what/why changed there? > 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; > }