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 F0D02A0C45; Wed, 22 Sep 2021 11:19:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 761DE41198; Wed, 22 Sep 2021 11:19:11 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 30F6541196 for ; Wed, 22 Sep 2021 11:19:09 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="220357103" X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="220357103" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 02:19:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="474444463" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga007.jf.intel.com with ESMTP; 22 Sep 2021 02:19:08 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 22 Sep 2021 02:19:08 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 22 Sep 2021 02:19:08 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 22 Sep 2021 02:19:08 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 22 Sep 2021 02:19:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODwBLuRevOotL8HLvoGkxLN85k+U+b6KDnPUWRW37utJ3f86CBbsEh67zmyXThjc817l0nS8GaauFvMYGjITpJHNaRs4wC/7C1CUNdGlLM7jywBKY+q+YY6uLtn+W5n2ey8gBYZXV9lV8K0ywkSqgpShNmIVcAccZiHRoaxqxJEJ561e2IcgnpSmJTnTcG8aopAMb2xIAoj8s5BQdSNk4V62ZknlHLk4L+v4Ws5Q/s4999ZkgGDcj/Rc1hDb8Se0nug9b/jdsSDQo58e4GTTz/Qr1HVAahzZfJPLkP2NuSSHw7ZztfBjFHWPqdqR5aw+CuHQ7DJFPdvizjsrmSrXlg== 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=tVkGXWRjSTfIG5XeE6eRsfn4RU/qozp7szlxjRKVTE4=; b=mCHWmRmySRkSgNhkZHFP5FPTU4uvw08S+i4+RGibPtEwG/px0NcT0Boufk4QdlbRYKyTc+wPg4OfAxetU2riT74Na2sXsql/LPKRjf6DYrjDveHCzcXWErQurtGjaYz0wi2TPGGx4OnUBrgUloZjfCjj6kJXXcPcJAbH5Jn0snBFWGAID87vEbb70dy+awTCOnd8AM0Y26eHW0G6JRVoftnNW3n3PPZW611TuQnWiTzayqReB3//4iQHed7h2SwbiumotXV1CxvDp4Q90NLgiE+G4rkOdAC26Y0BsG39N19DC60gapQkgQrO4Jix5wcFAJ46NhvK6uE4c+eQgjHVoA== 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=tVkGXWRjSTfIG5XeE6eRsfn4RU/qozp7szlxjRKVTE4=; b=lK1ImcutRdVJRhyLQKE0XMQtVIPTIdVF+y4Z5GCP54sVVRNNJh+78Tu/DNNCGmIg6Ip76bbQ33njLE8j9FcCUtqyp+eHYqbKgGBm0iBpGJIGIQco5GXTnuJYO92ZLEh5jLAL3YzsQy+0X8URRWmlvvyfGlDwnV/8NLqXPWa6/iw= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) by BYAPR11MB3589.namprd11.prod.outlook.com (2603:10b6:a03:b3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Wed, 22 Sep 2021 09:19:05 +0000 Received: from SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271]) by SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271%7]) with mapi id 15.20.4523.018; Wed, 22 Sep 2021 09:19:05 +0000 To: fengchengwen , CC: , , References: <20210827172048.558704-1-kevin.laatz@intel.com> <20210917152437.3270330-1-kevin.laatz@intel.com> <20210917152437.3270330-6-kevin.laatz@intel.com> From: Kevin Laatz Message-ID: Date: Wed, 22 Sep 2021 10:18:59 +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-GB X-ClientProxiedBy: DB6PR07CA0054.eurprd07.prod.outlook.com (2603:10a6:6:2a::16) To SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) MIME-Version: 1.0 Received: from [192.168.1.15] (109.76.83.81) by DB6PR07CA0054.eurprd07.prod.outlook.com (2603:10a6:6:2a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.7 via Frontend Transport; Wed, 22 Sep 2021 09:19:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07cf2d7f-3eb1-4fc4-c892-08d97daa065c X-MS-TrafficTypeDiagnostic: BYAPR11MB3589: 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:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KwgPJ5kskwGz6kgJvaBXv45omSv9L3VY3QKRUh/yyufM8YZgUwMmLklLlLchnb/MzpU0Wijtzf5W4UWgkB8XNa9HPEKxezoYe+AucOqo56vXgvd7Vp9M4JnBCvwsPoDleEdoYsRvR9ySmomGes2BrOQYSIpDjdre73TchBeTiGm6uHsdOxbWDikFMEZhKWhTKv8FHs0WjFXe4JALx2HTmwQNvyDER9dvFE15+W/0AhLS6eToyoTAWWusLYpEQnVahZwKGYxCaj1ARXd+lD9/Hn4SvyO1vHozyeqmHDLa4qaoytFtob3tMlUuikrA+u7xbLPcpYc69H80P2Gihl+2dzz3RFFmOaAnp+xdSxhW0oTiNIGI7Al+L1d3wxIh97lLklsaHeH+RYpZbbCuDwDzysPovoAd8JlpR+ex1copHPhuKr/4R9Kqac8WoR6pdZMKilD3WQ59ZJCqebthInQRYKy8lkLjscNPEJUztcevNLSs5boiJiniUDas8C2g0w0sJxob3Td0yKyfR+ubCZoFmst07DHKTYFu0PxIWaSF6C/0WHJiED65KmzQTwG0fkYkwnL28SsOpxiy1maaRs52xoKrd8NmMw1QaTnTLajV7uqjzrhhUtMvLwTFrsWmhw8ouYnpQCKYAiv4M1GK0GYH7t0+ZzTpgKbKbpjgEyTq2Ubhs79iUC6kTyeJPrLFR0Ycf/8JaJ5O5K7zQN7P3CQArOIxXDC1gCoY+52ho6QG+60= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5055.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(83380400001)(316002)(31686004)(107886003)(2616005)(26005)(44832011)(4326008)(508600001)(6486002)(53546011)(86362001)(66556008)(5660300002)(186003)(66476007)(36756003)(16576012)(31696002)(6666004)(2906002)(8936002)(38100700002)(8676002)(66946007)(956004)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RW1RVkFaN2FWV1NrTitUZDRqL3JEM21GUEYxcmlnM3AwKzRmSWVIcFZHZ2ky?= =?utf-8?B?VCs4ZmNKdkpnSlJpYjdXNmp5S21rWWNPY3RuTlVVLzRMdnE3a0xQWDZ6dzVk?= =?utf-8?B?dkErTmVwVi9LdjloTmNkek0zRmg5RDY4aVpobkNPUEFMZHNieHpOdFA2RW9P?= =?utf-8?B?L2kxdGlyS1BmL0RDazNDRmRabG1IeVRxL3ppOFBSNHlrZFR6S2pyL0hMZDhr?= =?utf-8?B?VTlaTTJvdXF1N2dKcVJDaUVYSkl1T055WnRESkNXOTJpSXZ0bCtUbW1Fd1Jy?= =?utf-8?B?UjJGeWFhRlF1anZqRWkwZ09odXowYlgxQnU1SVZRU2U2OHZnSzk5S2FvaHA0?= =?utf-8?B?ZEpPKzZKUzd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?= =?utf-8?B?RkVuVkdmZEhRTjdLMkFSZUFFd1JJbW1xSlU0LzVWRUpXM3dsQnJ1OVJjeVhP?= =?utf-8?B?ZmZVZThsU3AvY1FIR2xiRUx5RmhJTjJDNzA5VDd5VEh0Q1dkeE10dC9YSjE0?= =?utf-8?B?bmt5QXJOQWI1WXpBVlA5aThUaWRrV1hiV1VFQW5UZXdUcFd2RVZQb1hBMk5V?= =?utf-8?B?bmVyYytydlBHTndsZ0J2U2lmWGd3NTRZTkdDQzlJRHB6YXNCZGhZWGg2a3VR?= =?utf-8?B?dE1qSHZFUkZsZjNKQnJHdEJ2SFNGRnBTYWhMQzBmUllQQ2lMaGVLZEJiaGwy?= =?utf-8?B?RDJzNnlKd2I4MHBhaDg5dmtYSU9PNmFQODdtVVJwc2VLK1RKUTdDU2U0MzZj?= =?utf-8?B?TlloRkE4MUtQRDN5NFlwcG41NFlMbWt0OWJxNHRKUmJ6ZFhHRDNaV0V4c0F1?= =?utf-8?B?L1pLWVpMQkUrYWZBWkhzUzlUenQ5SWMvQzk1N0NiM3hmV1JEcXpnd2trNGRX?= =?utf-8?Q?ZzjM6ay4ZBOQBkkVg9eGt2oD5FBDSLVdeuUjibX?= X-MS-Exchange-CrossTenant-Network-Message-Id: 07cf2d7f-3eb1-4fc4-c892-08d97daa065c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5055.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 09:19:05.5267 (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: iAmJ9ye9/nwfRBrFQTLSjuUUHUTPDgxIku4Tz9n3infZaN991h8ekO9RDtSEvVMSPoW4WvFgxdAEqIqRZybVVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3589 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 05/16] dma/idxd: 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 22/09/2021 03:12, fengchengwen wrote: > On 2021/9/17 23:24, Kevin Laatz wrote: >> When a suitable device is found during the PCI probe, create a dmadev >> instance for each HW queue. HW definitions required are also included. >> >> Signed-off-by: Bruce Richardson >> Signed-off-by: Kevin Laatz >> Reviewed-by: Conor Walsh >> >> --- >> v4: rebase changes >> --- >> drivers/dma/idxd/idxd_hw_defs.h | 71 ++++++++ >> drivers/dma/idxd/idxd_internal.h | 16 ++ >> drivers/dma/idxd/idxd_pci.c | 278 ++++++++++++++++++++++++++++++- >> 3 files changed, 362 insertions(+), 3 deletions(-) >> create mode 100644 drivers/dma/idxd/idxd_hw_defs.h >> [snip] >> + >> +static int >> +idxd_dmadev_destroy(const char *name) >> +{ >> + int ret; >> + uint8_t err_code; >> + struct rte_dma_dev *dmadev; >> + struct idxd_dmadev *idxd; >> + int dev_id = rte_dma_get_dev_id(name); >> + >> + if (!name) { >> + IDXD_PMD_ERR("Invalid device name"); >> + return -EINVAL; >> + } >> + >> + if (dev_id < 0) { >> + IDXD_PMD_ERR("Invalid device ID"); >> + return -EINVAL; >> + } >> + >> + dmadev = &rte_dma_devices[dev_id]; >> + if (!dmadev) { >> + IDXD_PMD_ERR("Invalid device name (%s)", name); >> + return -EINVAL; >> + } >> + >> + idxd = dmadev->dev_private; >> + if (!idxd) { >> + IDXD_PMD_ERR("Error getting dev_private"); >> + return -EINVAL; >> + } >> + >> + /* disable the device */ >> + err_code = idxd_pci_dev_command(idxd, idxd_disable_dev); >> + if (err_code) { >> + IDXD_PMD_ERR("Error disabling device: code %#x", err_code); >> + return err_code; >> + } >> + IDXD_PMD_DEBUG("IDXD Device disabled OK"); > Recommended: move the above disable idxd device to rte_dma_close() ops. > when create: mark state as READY > when destroy: direct call rte_dma_pmd_release(name), the lib will call rte_dma_close(). > >> + >> + /* free device memory */ >> + IDXD_PMD_DEBUG("Freeing device driver memory"); >> + dmadev->dev_private = NULL; > The dmalib managed dev_private, so that driver could not do free again. > >> + rte_free(idxd->batch_idx_ring); >> + rte_free(idxd->desc_ring); > Please move above free ops to rte_dma_close() ops. > Will fix, thanks