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 9F656A0C54; Fri, 3 Sep 2021 17:14:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8955E4114B; Fri, 3 Sep 2021 17:14:19 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id CD5124113D for ; Fri, 3 Sep 2021 17:14:17 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10096"; a="283150727" X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="283150727" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2021 08:14:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="511504909" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP; 03 Sep 2021 08:14:16 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 3 Sep 2021 08:14:16 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 3 Sep 2021 08:14:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 3 Sep 2021 08:14:15 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.105) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Fri, 3 Sep 2021 08:14:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JHyIvTquw07xT06F6pAYykAPX4MyBM4xvzsHENZWePFsiqua8zfA4DzXGaZ+pPx5GjChzPnxUwz9vllCTymfe1kGX1/WUPSzDTiDQIkMletn1Dmzpo3nsHV9wVkAFwPzNUd+wnvoIlV7eG0Du1ina/w/8tFSx1aMg7YRtKxJqUSXWYmLsuPFXcy7xjVeHYvfTMY9tbqpca3brA80J2IP8FuQJspH46jHvrPU6V+U6A6CTkebiMmBk6xeY2Rd6FtHtMi5rKac2i8kKsAaHhorcFwTDzK0mYEjofS60Q6awX0oGm4gNMx1JfeFMCrcHyVZdXdeuMUA+o0u05ra+9/7MQ== 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=l4XwKxh0hAJM9BWZXC9Pt4yM31P/vRCAmn+2E7j7ToY=; b=m6CMvB1c9+ONKCiLxuO/LxnSp4gHQAeAhm2tVKB3Zhw34AV/oVd2LdfxhS5n9N2yzNwet88Lzot96CL79gHu4sA0KYQin3LKDsnBFJgm9HcdT5JYXp8aiL6OnQUlOGweoDg38UnvZ7VqjfsHh6ZrjBdDsovZiBbR2NfyL8dScmyRwDPEuZueStdOYCWXN/YZvt/mdEnasxihDpaDGf9Iaklybf3fSXaUD4A7dvHaWqNdWa4ycTbcjJM1gahT6i1sr5HxGXtI9O70rK4tDdvC+XOQgvso4bY3Ii8Srv8N0pmZU76eaedZYlyJsMtdpcCs5du+/HmA6T2v1D8gkG7Iww== 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=l4XwKxh0hAJM9BWZXC9Pt4yM31P/vRCAmn+2E7j7ToY=; b=EY5fsfsSO3jh0atn/W4nWNft540Ows67WgnX97QzZkATdVV+ru5vad/tvvJZp+NmzZeH2qavc4i4aQs4Wa4naYrp3JOovd4mSS4vvrHJy5s7PDRyLrPwbnZ23N5k/axdjlb25kbtgV72YFwT9TanDA2XYXvVNJM9OlvpwEGs3RQ= 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 BYAPR11MB2822.namprd11.prod.outlook.com (2603:10b6:a02:c8::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Fri, 3 Sep 2021 15:14:13 +0000 Received: from SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271]) by SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271%5]) with mapi id 15.20.4478.022; Fri, 3 Sep 2021 15:14:13 +0000 To: Chengwen Feng , , , , , , CC: , , , , , , , , , , References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <1630588395-2804-1-git-send-email-fengchengwen@huawei.com> <1630588395-2804-7-git-send-email-fengchengwen@huawei.com> From: Kevin Laatz Message-ID: <91f6b538-88a8-ce80-36ff-161ff75e2fea@intel.com> Date: Fri, 3 Sep 2021 16:14:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <1630588395-2804-7-git-send-email-fengchengwen@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: DB6PR0202CA0002.eurprd02.prod.outlook.com (2603:10a6:4:29::12) To SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) MIME-Version: 1.0 Received: from [192.168.1.15] (109.79.29.175) by DB6PR0202CA0002.eurprd02.prod.outlook.com (2603:10a6:4:29::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Fri, 3 Sep 2021 15:14:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc223f9d-4fe4-459a-98ad-08d96eed7d1f X-MS-TrafficTypeDiagnostic: BYAPR11MB2822: 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:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Toh2G4BHJ6BNIFx4IANb07ZLpEs7moG0LgnOvCIYsF9JDZ9ke+ouwm0nCHj+6FJrknOvUOIogBUCCPYEsp7v5kylehHLUQ0teQDAO9PeyYDKabB0Yp89d46JuU+i9lu80rZqlAY0PAY4VjV8+TgZWMb7hABs5Clo3h+JQ+fFvYwCC5WUB9AEPx4qsbpSI0gK0KtP9+idBkwhD02SB4MX/mzrUUGU/uQMl+tV6uh9iJFi/LgXGOw9AYF/2rJBjToke6SRxJ8sxwukY/T2JaRNrVU4p0UhF9FXql55v7vLyP5KiW1+3Koa3LA77uEegQZ/6qfaGQyYhC5p2QrP0Np16rmv6TjwPOuDaPHcPE44MvQSUThTuzSMWAYEf7epo3xvID9qkB9FmAgewhAo6KB5ySDIcmL07MyWnp15IZNsu7RzkGlAAWpuafFRBYfDWSErrl/mlHSDfgdqycp7r/oecPHcaMsxVLqnYBQpcjKY5utWWGcSdAsPtbyC9SIink/ovncw+lTedHLxnGZzePxUHOSGyO5SIwYhCR8EI+sarJMqDGhCf5KStnU6sjEYgzv/OpAYtOjet8F1EAYrY0Qzibe6hYfe49MdZztbHnlD9ISdOZkvKHJgFOfA1bnQYzezPEISu2J1SbunTbinCvzSG0bBrqa1JxnfXucNd77Ovscc/I++QcEn6q9rAQ8YpKiwsvAdthksjzw5nmZxv0UVh/0RtWcNUMrwoO2mxWNFDrQ= 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)(396003)(136003)(376002)(346002)(366004)(39860400002)(36756003)(107886003)(7416002)(6486002)(5660300002)(6666004)(16576012)(8936002)(26005)(86362001)(316002)(38100700002)(478600001)(31696002)(66476007)(66946007)(186003)(2616005)(31686004)(83380400001)(53546011)(8676002)(4326008)(44832011)(66556008)(2906002)(956004)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aGdFdTRHZ1hUN0JPTlhrYmQzdCtUdXAwMzdBOHRiRmdXSm9ORnBvRjNDZitm?= =?utf-8?B?a0QwZjVNN21iMGhiUXNpMHlaeWdUczFPR2MzekFDdUhFRUdyVTNnK2hGaEZt?= =?utf-8?B?c1czMXRYQ1NtdUpYTXRkV3IxVTVNUnpoU1dxUDdTOTdEcTlUcnNoelc0ckha?= =?utf-8?B?RVg1b1I4cnFjVTZ3R0w5L1dKRm1lTzQ5aHR1Tmk3YjVXU1pxVDVWc3hyVXF3?= =?utf-8?B?cmFUUTBtYnhlRUow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f-8?B?RGRWNnZGQkw0OVc3VWNMV20wOTA3V1VGS2hJRkpvZUFUR2tXUmcxODMrWXho?= =?utf-8?B?TGNmd2lNQ0ZaMkpsME9mVGcrd3o0alBkZjNnd1lFUFhXam5lenpEYWhGN3Zu?= =?utf-8?B?VngyNUhpVUlXU3krSkVaREZtamR6UzVWOVVzY1p1c3hYaG5Xc1lCdDdPcVJJ?= =?utf-8?B?bzlKSGxGS1ExYXl4ZFR0VEh0SFNPSWNzN3FzaVA5MXRUalRVZzlsUjZRVm5G?= =?utf-8?B?MC82SkZ4K2tFLytTbnpNM0p4QURtQ21JVk9XYnJ0dnUwVjk3TG9neU9qTHBw?= =?utf-8?B?TEU2VVhybjR1OE9mdDhTTVF0emdibkZ6QjhQWGF4cHh4ekhBV0V4VStnWG8x?= =?utf-8?B?ajhTRmhiQ1BsbG8vZ0d3SUpBMlFnclI0QXA4Q0VBNExjWitUaWE4c3Voc2xa?= =?utf-8?B?ejVYU1Rsak94ZXdKcmtXYlBQWnMyekJobDdod3kzT2kyTSszVDJNT2RwY0lq?= =?utf-8?B?R1lmaTNvNlZIa0hYL0pPcHJwaUJNZkF5S2NOd1IrZk1XWHp1aU85WGVSVDZj?= =?utf-8?B?Skt2SzhRWjFTcmd3Z0huYlFOOFI5Z0NZSFY5eGpQMUoxQTZMUzNCR1BVcTBW?= =?utf-8?Q?DL075MPBi10JVHQy3DdKCbdpbvaKTvToQBlx3g4?= X-MS-Exchange-CrossTenant-Network-Message-Id: cc223f9d-4fe4-459a-98ad-08d96eed7d1f X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5055.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2021 15:14:13.8359 (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: fKqqm87h6TxmfidKHMRcvLONzmuUh5KZAPzHtWvqUU1c40JIOTZP5GFa1RtBBBpb8PA6yAa1emNK4wv3QwFv0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2822 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v19 6/7] dma/skeleton: introduce skeleton dmadev driver 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 02/09/2021 14:13, Chengwen Feng wrote: > Skeleton dmadevice driver, on the lines of rawdev skeleton, is for > showcasing of the dmadev library. > > Design of skeleton involves a virtual device which is plugged into VDEV > bus on initialization. > > Also, enable compilation of dmadev skeleton drivers. > > Signed-off-by: Chengwen Feng > --- > MAINTAINERS | 1 + > drivers/dma/meson.build | 11 + > drivers/dma/skeleton/meson.build | 7 + > drivers/dma/skeleton/skeleton_dmadev.c | 601 +++++++++++++++++++++++++++++++++ > drivers/dma/skeleton/skeleton_dmadev.h | 59 ++++ > drivers/dma/skeleton/version.map | 3 + > drivers/meson.build | 1 + > 7 files changed, 683 insertions(+) > create mode 100644 drivers/dma/meson.build > create mode 100644 drivers/dma/skeleton/meson.build > create mode 100644 drivers/dma/skeleton/skeleton_dmadev.c > create mode 100644 drivers/dma/skeleton/skeleton_dmadev.h > create mode 100644 drivers/dma/skeleton/version.map > > diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c > new file mode 100644 > index 0000000..7033062 > --- /dev/null > +++ b/drivers/dma/skeleton/skeleton_dmadev.c > @@ -0,0 +1,601 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2021 HiSilicon Limited. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + This list of includes is very long, many of these are likely included via rte_common already, for example. Please check this and remove redundant includes. > +#include > + > +#include "skeleton_dmadev.h" > + > > + > +static int > +vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc) > +{ > + struct skeldma_desc *desc; > + struct rte_ring *empty; > + struct rte_ring *pending; > + struct rte_ring *running; > + struct rte_ring *completed; > + uint16_t i; > + > + desc = rte_zmalloc_socket("dma_skelteon_desc", > + nb_desc * sizeof(struct skeldma_desc), > + RTE_CACHE_LINE_SIZE, hw->socket_id); > + if (desc == NULL) { > + SKELDMA_LOG(ERR, "Malloc dma skeleton desc fail!"); > + return -ENOMEM; > + } > + > + empty = rte_ring_create("dma_skeleton_desc_empty", nb_desc, > + hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); > + pending = rte_ring_create("dma_skeleton_desc_pending", nb_desc, > + hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); > + running = rte_ring_create("dma_skeleton_desc_running", nb_desc, > + hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); > + completed = rte_ring_create("dma_skeleton_desc_completed", nb_desc, > + hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); > + if (empty == NULL || pending == NULL || running == NULL || > + completed == NULL) { > + SKELDMA_LOG(ERR, "Create dma skeleton desc ring fail!"); > + rte_ring_free(empty); > + rte_ring_free(pending); > + rte_ring_free(running); > + rte_ring_free(completed); > + rte_free(desc); These pointers should be set to NULL after free'ing, similar to what you have in "vchan_release()". > + return -ENOMEM; > + } > + > + /* The real usable ring size is *count-1* instead of *count* to > + * differentiate a free ring from an empty ring. > + * @see rte_ring_create > + */ > + for (i = 0; i < nb_desc - 1; i++) > + (void)rte_ring_enqueue(empty, (void *)(desc + i)); > + > + hw->desc_mem = desc; > + hw->desc_empty = empty; > + hw->desc_pending = pending; > + hw->desc_running = running; > + hw->desc_completed = completed; > + > + return 0; > +} > + > +static void > +vchan_release(struct skeldma_hw *hw) > +{ > + if (hw->desc_mem == NULL) > + return; > + > + rte_free(hw->desc_mem); > + hw->desc_mem = NULL; > + rte_ring_free(hw->desc_empty); > + hw->desc_empty = NULL; > + rte_ring_free(hw->desc_pending); > + hw->desc_pending = NULL; > + rte_ring_free(hw->desc_running); > + hw->desc_running = NULL; > + rte_ring_free(hw->desc_completed); > + hw->desc_completed = NULL; > +} > + > With the minor comments above addressed, Reviewed-by: Kevin Laatz