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 9C11CA0C40; Thu, 5 Aug 2021 15:12:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C81040143; Thu, 5 Aug 2021 15:12:25 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2FFA540040 for ; Thu, 5 Aug 2021 15:12:22 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GgTXs0hTZzYlJg; Thu, 5 Aug 2021 21:12:13 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 5 Aug 2021 21:12:20 +0800 Received: from [10.40.190.165] (10.40.190.165) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 5 Aug 2021 21:12:20 +0800 To: "Walsh, Conor" , "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> From: fengchengwen Message-ID: <7659e1ae-2b84-9ab9-a2aa-c390fb055b11@huawei.com> Date: Thu, 5 Aug 2021 21:12:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.40.190.165] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 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, > 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 >