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 F01BCA0547; Thu, 9 Sep 2021 15:25:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 458DE40041; Thu, 9 Sep 2021 15:25:37 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id D03A04003E for ; Thu, 9 Sep 2021 15:25:34 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4H50922V65z1DGq6; Thu, 9 Sep 2021 21:24:38 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 9 Sep 2021 21:25:31 +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.2308.8; Thu, 9 Sep 2021 21:25:30 +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" , "Laatz, Kevin" References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <20210907125649.49794-1-fengchengwen@huawei.com> <20210907125649.49794-5-fengchengwen@huawei.com> From: fengchengwen Message-ID: Date: Thu, 9 Sep 2021 21:25:30 +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: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v21 4/7] 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" For the dmadev which only support one vchan, it's OK to ignore vchan parameters. I don't think that logic needs to be added. On 2021/9/8 17:54, Walsh, Conor wrote: > > > Hi Chengwen, > > While testing the IOAT driver I realised that we hadn't implemented the new RTE_DMADEV_ALL_VCHAN > flag for stats. Rather than every driver that only supports 1 vchan enabling support for this flag it would > probably be better to catch it in the library as shown below. > > Thanks, > Conor. > >> +int >> +rte_dmadev_stats_get(uint16_t dev_id, uint16_t vchan, >> + struct rte_dmadev_stats *stats) >> +{ >> + const struct rte_dmadev *dev = &rte_dmadevices[dev_id]; >> + >> + RTE_DMADEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL); >> + if (stats == NULL) >> + return -EINVAL; >> + if (vchan >= dev->data->dev_conf.nb_vchans && >> + vchan != RTE_DMADEV_ALL_VCHAN) { >> + RTE_DMADEV_LOG(ERR, >> + "Device %u vchan %u out of range", dev_id, vchan); >> + return -EINVAL; >> + } > if (vchan == RTE_DMADEV_ALL_VCHAN && dev->data->dev_conf.nb_vchans == 1) > vchan = 0; >> + >> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, - >> ENOTSUP); >> + memset(stats, 0, sizeof(struct rte_dmadev_stats)); >> + return (*dev->dev_ops->stats_get)(dev, vchan, stats, >> + sizeof(struct rte_dmadev_stats)); >> +} >> + >> +int >> +rte_dmadev_stats_reset(uint16_t dev_id, uint16_t vchan) >> +{ >> + struct rte_dmadev *dev = &rte_dmadevices[dev_id]; >> + >> + RTE_DMADEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL); >> + if (vchan >= dev->data->dev_conf.nb_vchans && >> + vchan != RTE_DMADEV_ALL_VCHAN) { >> + RTE_DMADEV_LOG(ERR, >> + "Device %u vchan %u out of range", dev_id, vchan); >> + return -EINVAL; >> + } > if (vchan == RTE_DMADEV_ALL_VCHAN && dev->data->dev_conf.nb_vchans == 1) > vchan = 0; >> + >> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, - >> ENOTSUP); >> + return (*dev->dev_ops->stats_reset)(dev, vchan); >> +} > > >