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 BD734A0C45; Tue, 21 Sep 2021 18:25:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACE3541151; Tue, 21 Sep 2021 18:25:27 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8AE3440DF8 for ; Tue, 21 Sep 2021 18:25:25 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="245828157" X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="245828157" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 09:25:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="549558925" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2021 09:25:23 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 09:25:23 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 21 Sep 2021 09:25:23 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.42) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 21 Sep 2021 09:25:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YUicH6B5gV5COEUlQFdTcmRGI/lY9ktJ/W82XK2ZSMWQWR975tW5R78zb8ACdgqH3e+mb6DUwL7C3UJkrf5Trq5H/mSPDqOKKh0R1Y4rP27FY6JpvwQiq8RqNWP3BOIrmIYX3lxw3iYPPq4Zs4AHCfDZKnvXSDwnmnSNjdiprJfMeepu0PkjvpmiN4bmzZybdHgIp9ih5c8HSJXqWj76QthZwfW3g6lDElUbi1uzFbcfcmRBdyoK5pPplUOG3qSJtRuRJ2g9fs12Znl3AuGzibLd+Byqt1qpXgro4+iOHfVAGg9OHgVoip4O4KW8blzCWfDDD0lgXSuyvH5i0LZpbQ== 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; bh=6byJOJFbri0qXUd4p0f5tiRS7ziumnLdkbjYEzOmx4A=; b=og+b1c+ESHbw7t7gZ3hk7u8LHbE7TcLqgd4gcqU4Qzm+RhMr30ofDx2bg5fYNgsWhr/IQzy0NXzSCNXm+bufy50zPtffUjaT2dM49rfhj+QQMH1txkaEUhmQ8ZGg9huS6w9mSOlpyEzpC9lUJQanQPfUw/OyvNhfQ73wzVn9Tc0Q+BjDKxfNW+smp1eCUcUqhBxS2+XJ2GSaxW7/lHScvMBcbNWlY3f5aTY7+PIlhxwHBIBCD4CsSDPo1FWiZaRr467tpBD3KMD7LnszKwPTrlMLA/UFt524azMgq7zk2krvTgChz0kOOsyTWv5TG/i68aE1LT695VTAZyXTb2kc5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6byJOJFbri0qXUd4p0f5tiRS7ziumnLdkbjYEzOmx4A=; b=tGvAIas99YwlyT2UW7tzFmT2mbswLV+dXp9qmk0UyALfXSrmZB00zvzJrLUoCEh8odQ9woHPDo19OBh/DzAz+PTgd8Vl8fTWqPHycgOq9TRS6+GH7ijDPO9UPOBWEAWT0lf6MQO/GuqLwfOOCztBWUhrU48JBCGDW/kIWkgodA0= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) by PH0PR11MB4872.namprd11.prod.outlook.com (2603:10b6:510:32::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 21 Sep 2021 16:25:19 +0000 Received: from PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::9578:a4b5:2716:fbaa]) by PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::9578:a4b5:2716:fbaa%6]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 16:25:19 +0000 To: Bruce Richardson CC: , , , References: <20210827172550.1522362-1-conor.walsh@intel.com> <20210917154227.737554-1-conor.walsh@intel.com> <20210917154227.737554-3-conor.walsh@intel.com> From: Conor Walsh Message-ID: Date: Tue, 21 Sep 2021 17:25:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-ClientProxiedBy: DB9PR01CA0020.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::25) To PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) MIME-Version: 1.0 Received: from [192.168.1.20] (109.77.147.22) by DB9PR01CA0020.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Tue, 21 Sep 2021 16:25:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09d124e3-0ab7-4b5b-080d-08d97d1c6708 X-MS-TrafficTypeDiagnostic: PH0PR11MB4872: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ps92Nc+b/uRF4eU345Pl957umi9g4jjtUbknd9MF2KgW26ioF46uyAF8TqwvrD1xDp3slJpFjBOj5KIMbLzzqSSTLwe+O4YU1Zbi/o1OJpPTpiyVtl9QCc4/XbWeE6WiHhebMA/TmVM6/vvOCEocilvtXLL1nNuKRRApSug+xm0DSuKAM3Mn43RtklsM/IHUYpNMUdCX0YKLIdWURP5QU76wqbts/uAVebxVl5Y7ganwOZ7MXJuXdg6O/SIlAQYvp7fekJ4s+F3u4tSEK/xqRUCjKY8D9S0McJeymviqdZjEBNS0VIA68HpgJoLbobwPDWcMG6IJFiX9h3bpy4CJXHTFd0qSs01/0m0wnomCDgnJXPDo7e3iNmYo6Vl9Rl+4Fnhh0OsCA7jShx8CelyH9FhHtbi+AciURy6DfypFmfLFPQoHce/xI7YvrVZ1PuBE1AiPZvAYIP0PHp84EsA3yXOz7TGUVe4d9hNyhZ/WXBQP/9t+pXMAOOWaA3mMXytrpSECVbRqwsoT6ytqXDJFju4CGcymZT4TIg+XMQLg20vmDpug8xJu24c0L+dVVGQNdh1AKgUJ4x6rzx1+WWKBRPMAAL/CdZc7uYWnooNVI8ZcXkiUgqePj6YSX78DA1i0QpebSNr7SCsUVYVYjoTL1Y4VAbY5F83/9VfzpNeH8H+04C7LDgqWYT+rlrRMO3fL3c6t9Cees5RnUJyLTb4S/A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5207.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(37006003)(38100700002)(36756003)(956004)(2616005)(86362001)(6636002)(2906002)(4326008)(6486002)(8936002)(316002)(26005)(66556008)(31686004)(6666004)(8676002)(83380400001)(16576012)(44832011)(31696002)(508600001)(6862004)(66476007)(186003)(5660300002)(66946007)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aEg2eElaUnRSMDlzRzhZRGtKUW5Lb1NnZDEwSGw1RkdLZFZiNmVGYkNVaE9U?= =?utf-8?B?R2FTUkYwUWVHNmt2VFN0bmxHRVBWU3pqTDRBTnA0dllBWmh0K0wraUpnSEdy?= =?utf-8?B?TWpzVVoyZ2d4SW1tZFIrZFlPK2VYcWR3cjNDVFFsc0RCTlE1TUF1aU1rK1Fn?= =?utf-8?B?ekhtTGtwYWVsVlNEL0dzeW1TdGJ6cENwNTZ1Yy9aOEVvWkpJd0tPOU4vNEpu?= =?utf-8?B?RGF5VUl5MlVrVkg4RlhRN1YvdEN1MG9aNnZFQUEvdWJadkdVc0tpR0FtN3RP?= =?utf-8?B?Y3drWGt3R0FGWENyeDQzcDVaOXhUWmQ5eENmZkF2WnhBYVZrRlFMRmxxREVG?= =?utf-8?B?a2VlTFdPSjBvTzROV2c3MForR3B4OVptOVVIUU5IWEFhNzJYK0dyZzd4MlVa?= =?utf-8?B?dlVJQWJHdkNDejNGZzVlNzNCZUQ3TjBRVVZmU2pvRFhLQW9HRlh2dE5vOEFJ?= =?utf-8?B?MVJCdFU2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= =?utf-8?B?dWU1VC9Zd0N0K3RpUkE3QjBRd3YxM2xiZ01XVEhpTlBpZFk4S2JrWDJEdGFH?= =?utf-8?B?UThNT0hBTEd6NmhHUldkaFNvczF0b1d2c3lQVngwMURQUlBZTG1UaUtsc0R6?= =?utf-8?B?S3AyQThOQ1FkNm43V1R1eHUvK09xZEdxTFdaWG9SNy8xY0pNdnd5U3kzcUhk?= =?utf-8?B?Rm8vaGRJY0hTYUFjK3hpcWJjeWkzQkRRNXpOK0E4WkplLy9RN2hwcVlwRVlL?= =?utf-8?B?aG9RVng1RHRJVGpSYTBRQkw1YlFjM0dwOURkVHFGTERLWDZQblhzSHRNWFZD?= =?utf-8?B?MlBMWVNqU2hrUTdXZ2lYT2lYY241VW1EU0VJTlkva0FtaGxHRU1kSXFsQW1T?= =?utf-8?Q?k++DALcTndzenRsMZCHUHf9gwB4KvU6+s9RgDO6?= X-MS-Exchange-CrossTenant-Network-Message-Id: 09d124e3-0ab7-4b5b-080d-08d97d1c6708 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5207.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 16:25:19.1966 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: u5S7nPH77V3DlriI1Z6SNBudoDZHGI7vsp/0w/ZOCDIt587LU20pYhhAm/pnI8L31ZVuNmWthlXgAiLH7cAFuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4872 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 02/11] dma/ioat: create dmadev instances on PCI probe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > On Fri, Sep 17, 2021 at 03:42:18PM +0000, Conor Walsh wrote: >> When a suitable device is found during the PCI probe, create a dmadev >> instance for each channel. Internal structures and HW definitions required >> for device creation are also included. >> >> Signed-off-by: Conor Walsh >> Reviewed-by: Kevin Laatz >> --- >> drivers/dma/ioat/ioat_dmadev.c | 119 ++++++++++++++++++++++++++++++- >> drivers/dma/ioat/ioat_hw_defs.h | 45 ++++++++++++ >> drivers/dma/ioat/ioat_internal.h | 24 +++++++ >> 3 files changed, 186 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c >> index f3491d45b1..b815d30bcf 100644 >> --- a/drivers/dma/ioat/ioat_dmadev.c >> +++ b/drivers/dma/ioat/ioat_dmadev.c >> @@ -4,6 +4,7 @@ >> > > >> +/* Destroy a DMA device. */ >> +static int >> +ioat_dmadev_destroy(const char *name) >> +{ >> + struct rte_dma_dev *dev; >> + struct ioat_dmadev *ioat; >> + int ret; >> + >> + if (!name) { >> + IOAT_PMD_ERR("Invalid device name"); >> + return -EINVAL; >> + } >> + >> + dev = &rte_dma_devices[rte_dma_get_dev_id(name)]; >> + if (!dev) { >> + IOAT_PMD_ERR("Invalid device name (%s)", name); >> + return -EINVAL; >> + } >> + > I think you need to independently check the return value from > rte_dma_get_dev_id, rather than assuming when it returns an error value the > resultant index location will hold a null pointer. I will assign rte_dma_get_dev_id(name) to a variable and check it before use in v5. > >> + ioat = dev->dev_private; >> + if (!ioat) { >> + IOAT_PMD_ERR("Error getting dev_private"); >> + return -EINVAL; >> + } >> + >> + dev->dev_private = NULL; >> + rte_free(ioat->desc_ring); >> + >> + ret = rte_dma_pmd_release(name); > The rte_dma_pmd_allocate function reserves memory for the private data, so > the release function should free that memory too. However, you have > assigned private_data to NULL just above, so that probably won't work. I think I will actually remove the "dev->dev_private = NULL" in v5 as this is handled by the lib. Thanks, Conor. >> + if (ret) >> + IOAT_PMD_DEBUG("Device cleanup failed"); >> + >> + return 0; >> +} >> + >