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 B87DAA0C40; Thu, 5 Aug 2021 15:44:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59FEE40143; Thu, 5 Aug 2021 15:44:39 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 65D8F40040 for ; Thu, 5 Aug 2021 15:44:37 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10067"; a="277906421" X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="277906421" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 06:44:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="569407954" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga004.jf.intel.com with ESMTP; 05 Aug 2021 06:44:36 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) 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.10; Thu, 5 Aug 2021 06:44:35 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Thu, 5 Aug 2021 06:44:35 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) 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.10; Thu, 5 Aug 2021 06:44:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hgeij3uYXIzXRVYhWqAz0KiiW4iKbztWMriTNFGs0IUxScuVBzIrNd/Pyypg4+o3xfobj4qNbW79vcexKiB6yEMikYhGyPvmMcZDKlHyZz/vqSQye/yILb6gKGYWU64zM4ooCnqkKGn2JolTY14/EndWHjNCCIapnP4XQ4IgVL4+t1kkmyYAcJVxB3ijZ46NxJpSl7rusxEGgcHJyy2938/U1t6E4bSdj4u346kro2xyN3ZGhVhQy6GNGKXz2FV5oMgRVNM2bGvI3Bb5w0GkQbtMRgP0lvuOvQ1uq+eSA3Q4eAkkDxA3YIJz131YniMUuxuuXIxaFOnsAehGYL+PTA== 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-SenderADCheck; bh=USpfLZNVboKO4hIPlyr2lAr1rA9kxYXbdrrMmvCYZKQ=; b=gkDjJ9dshEXlOssLyucywHwGQyZq5oD6z1zbAwicawCf3mbITthsWfcTiSEfTKT61B3gtS3eefe7et3+/kNZHDRuuMnntwxcxEj9ctFmX0p/n47fiUyfb34xC7J4XOrQx6TfVciPKZczmJdu0V1l1DAypxi9T87N97qszjs6YFixoa4okxDMYodcn0Fksup1nN5Xl7roKdCN8r75RwJBD2HvceRwlQEYzRnRnWc2zfxL+FzAe4YxjM8IYXEpwaC7EZDZL+jExiB9GP8YQJ6gtAILCYh+QCJkQ/G81gO8dsyccTJ1PfbG0jwrFo1MWP3OTFCVuqfb7PXVrPK6E3DOyA== 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=USpfLZNVboKO4hIPlyr2lAr1rA9kxYXbdrrMmvCYZKQ=; b=OEAT8pTxyR/diSjeqHBuS7Tf47QEK284VuckV5BjnBYlu4BshDT4RxL2U/BzPEisIbM3iu3LjJ1P1RP09GWiExtztKzuB3sySQQkV6iLziCeAu9J6KaRsdtJ7qCiP4nMHDhsuEDUu0xxqlLskLUTU8XMcb3I3Z8A+g3d+j6qH4U= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) by PH0PR11MB4904.namprd11.prod.outlook.com (2603:10b6:510:40::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Thu, 5 Aug 2021 13:44:31 +0000 Received: from PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::c42e:f6ab:d4d6:dc8a]) by PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::c42e:f6ab:d4d6:dc8a%5]) with mapi id 15.20.4373.026; Thu, 5 Aug 2021 13:44:31 +0000 To: fengchengwen , "thomas@monjalon.net" , "Yigit, Ferruh" , "Richardson, Bruce" , "jerinj@marvell.com" , "jerinjacobk@gmail.com" , "andrew.rybchenko@oktetlabs.ru" CC: "dev@dpdk.org" , "mb@smartsharesystems.com" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" , "maxime.coquelin@redhat.com" , "honnappa.nagarahalli@arm.com" , "david.marchand@redhat.com" , "sburla@marvell.com" , "pkapoor@marvell.com" , "Ananyev, Konstantin" References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <1627990189-36531-1-git-send-email-fengchengwen@huawei.com> <1627990189-36531-5-git-send-email-fengchengwen@huawei.com> <7659e1ae-2b84-9ab9-a2aa-c390fb055b11@huawei.com> From: Conor Walsh Message-ID: <03cf84cd-d336-f6df-c440-b96f1a1588b1@intel.com> Date: Thu, 5 Aug 2021 14:44:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: <7659e1ae-2b84-9ab9-a2aa-c390fb055b11@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-ClientProxiedBy: ZR0P278CA0049.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::18) To PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.20] (109.78.228.96) by ZR0P278CA0049.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16 via Frontend Transport; Thu, 5 Aug 2021 13:44:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52c810f3-c136-441a-2513-08d958172726 X-MS-TrafficTypeDiagnostic: PH0PR11MB4904: 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: 8+zT9kkQrEuPPrypUMI08Bg6BJJ7svV/wUxAaeN4pNTOlUhaJHTZlysMsn/XkTzbT451V3F5aZuKcsjuoeSkJrWLCk4qBRfgleFKSrCxvSHhfTqvqGMMfgeybX5wWMurXJhhPpuZzBsr3j4mrhU+DQeXSPm0Scbnvos7XL8auMrkNn1S20DkXUEoyxcrR3j8Fk0Ft6jGlQSelphgTYpQ6otQ6IKFYWES8yOdBMdgRYipv9ngvSwUmzIAIfZid4p/f++eT766EAWuagx7vAYdIPRFxok3A79PDFF1xdU3kuGQBmP3Ghb7Z61Dse7cRUDyNnMDBjRH/LRzgXywjDFagVNod87DRwA5aiUbS/A4bJPWW/sgvj7nmjZ16H+oF4rEDhydyYbaeSROnms8fO9fhU4N9AJd1bNjQmV5VbuQFa9euncUSef9QZdXk27usjlp/PtYizaL9m18fzY336Nyzo2ygol83uF9INcovvbsVcs29X8yFYsZlHTEQVgpqLgDEdLoiMUDMsULCle021l0+Clxoil/LTWJyZWuVrOO7MwrhL4UZsBHw3InwZvXbqKzlVwxI/cF6mvq8/8TGhygtzJ8rzSR+tmxPx+zQEVRFeB5NMKFevkICqIWKYMYd9SBPHulrEjIymqhPjpnE4f72og86wrNUoT+6CwTSIxsUeXFVkJZA8SSVljCYz9iZILUB1B2iAB7DFGuCptoQ6JGd0ZFp/GgucAfYUBJpoNaaw4= 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)(39860400002)(376002)(136003)(396003)(366004)(346002)(6666004)(186003)(86362001)(36756003)(4326008)(107886003)(2616005)(31696002)(956004)(2906002)(7416002)(83380400001)(6486002)(31686004)(66556008)(66946007)(8936002)(38100700002)(8676002)(54906003)(26005)(478600001)(53546011)(44832011)(5660300002)(16576012)(316002)(66476007)(110136005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YVFLUk1TVVRXMHdLbmtndHJIQVc4RFdPZldrdWhVUUFBN0JjYWhEeUFkNHZi?= =?utf-8?B?bzQ1RzFvQ1B6VC9ZM0w3cjFSM1pZVExRR3pSQkZpUmZNZjJlSXFWbWlMN25K?= =?utf-8?B?Z2JkWFFa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ktL?= =?utf-8?B?aHVLcmhzYm5vRkpMcXFUR1dhckFFVUZtUkhXNCs2UzY4ZG5vRXp3NER0aWo1?= =?utf-8?B?eTdnbTZ0aFZpVTVXblJTYWwyT1NaSHN0K3FDY2l2bExpdVZhMW9vb1VlYzBm?= =?utf-8?B?QWFoajBXZ0pWdHE1SjNGeGhxc2JNTUJyb0hoYXVuZTIyWGQrQW5LNlBORmRa?= =?utf-8?B?cmFpTGdKV0U3Yk5LN09oek4yUERVbllBM2FqTnorZ3BYR2IzRlhZdFl4UHVF?= =?utf-8?B?dWhmbzJZUFB2ckIrUmlVNDg2ckFNUytzOWlpajkrV1BINkg5NnRHU0E2aUt2?= =?utf-8?B?NW5nMkxDR254eU10VUU4R3Z5VTlLRnp5RkEzeEEwZDJ5WXBBYzVNZCtyL1cv?= =?utf-8?B?ZmtPMUU1MDcxVXRqZmlYRmxPT1ZGS1lCSWJtMjRpN01SMEdWYlY1WXcrOXhM?= =?utf-8?B?a052UytWeXU5WlVLZlM0aU85WWJnWGFEekIvSi9pMHd3VCs5UklScExBOVJK?= =?utf-8?B?Z3VuMlJWQm1VK3dObm9sOFdRZ0Qya1NBR0RGS2t2OHZjTlpHaG1NV0hOOXgw?= =?utf-8?B?WmlNUnp0N0lhckRRS2JEVnIzQ3lQcDdEV1JRZVVuWHRJUGZlQWtGSXFIc2pT?= =?utf-8?B?NjZpTi9SbVBENVh6RmhFckV1V3RVcFZQdmN5Wmd3SzlzRmdVUU0xK1J4QTZR?= =?utf-8?B?MVl6MStFTDBHRmdHcS9xOUcvbFpqYU15Q054bHlWcXVSWEsvR3ZTMmZWajZa?= =?utf-8?Q?hertyW9Pa74tt9nzz8unmDq2uroOuldqLXel8Ed?= X-MS-Exchange-CrossTenant-Network-Message-Id: 52c810f3-c136-441a-2513-08d958172726 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5207.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2021 13:44:31.5830 (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: U+H4rH9CSz5cz7PmrIdIvdWUbndT4LgpQtvNlk3yC8i8nSbaTK93gwU5bcw+g4y9qMQ47vKiiiLNjMbGvmPYcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4904 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v13 4/6] dmadev: introduce DMA device library implementation 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 05/08/2021 14:12, fengchengwen wrote: > On 2021/8/5 20:56, Walsh, Conor wrote: >>> This patch introduce DMA device library implementation which includes >>> configuration and I/O with the DMA devices. > [snip] > >>> /** >>> * @warning >>> @@ -952,10 +1029,27 @@ rte_dmadev_completed(uint16_t dev_id, >>> uint16_t vchan, const uint16_t nb_cpls, >>> * status array are also set. >>> */ >> Hi Chenwen, >> >> When completed status is called with status set to NULL the drivers will segfault. >> Users may have a valid use case where they pass NULL as status so it needs to be >> checked and handled appropriately. >> Could you handle this within dmadev similar to what I've added below? >> If added the doxygen comment will also need to be updated to specify NULL as a valid input. > Hi Conor, > > The status must be an array pointer, so below status_tmp will not work well. > > This API is slow path (vs completed API), and is designed to obtain detailed > status information, so application should pass valid status parameters. Thanks for your quick reply. That is true that it is designed to be slower and return detailed status info but should we not handle it more gracefully than segfaulting. I don't have too strong of an opinion either way so it's ok to ignore. /Conor. > >> Thanks, >> Conor. >> >>> __rte_experimental >>> -uint16_t >>> +static inline uint16_t >>> rte_dmadev_completed_status(uint16_t dev_id, uint16_t vchan, >>> const uint16_t nb_cpls, uint16_t *last_idx, >>> - enum rte_dma_status_code *status); >>> + enum rte_dma_status_code *status) >>> +{ >>> + struct rte_dmadev *dev = &rte_dmadevices[dev_id]; >>> + uint16_t idx; >> enum rte_dma_status_code *status_tmp; >>> + >>> +#ifdef RTE_DMADEV_DEBUG >>> + if (!rte_dmadev_is_valid_dev(dev_id) || >>> + vchan >= dev->data->dev_conf.max_vchans || >>> + nb_cpls == 0 || status == NULL) >>> + return 0; >>> + RTE_FUNC_PTR_OR_ERR_RET(*dev->completed_status, 0); >>> +#endif >>> + >>> + if (last_idx == NULL) >>> + last_idx = &idx; >> if (status == NULL) >> status = &status_tmp; >>> + >>> + return (*dev->completed_status)(dev, vchan, nb_cpls, last_idx, >>> status); >>> +} >>> >>> #ifdef __cplusplus >>> } >>> diff --git a/lib/dmadev/rte_dmadev_core.h >>> b/lib/dmadev/rte_dmadev_core.h >>> index 599ab15..9272725 100644 >>> --- a/lib/dmadev/rte_dmadev_core.h >>> +++ b/lib/dmadev/rte_dmadev_core.h >>> @@ -177,4 +177,6 @@ struct rte_dmadev { >>> uint64_t reserved[2]; /**< Reserved for future fields. */ >>> } __rte_cache_aligned; >>> >>> +extern struct rte_dmadev rte_dmadevices[]; >>> + >>> #endif /* _RTE_DMADEV_CORE_H_ */ >>> diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map >>> index 408b93c..86c5e75 100644 >>> --- a/lib/dmadev/version.map >>> +++ b/lib/dmadev/version.map >>> @@ -27,6 +27,7 @@ EXPERIMENTAL { >>> INTERNAL { >>> global: >>> >>> + rte_dmadevices; >>> rte_dmadev_get_device_by_name; >>> rte_dmadev_pmd_allocate; >>> rte_dmadev_pmd_release; >>> -- >>> 2.8.1