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 602EAA0547; Wed, 20 Oct 2021 10:04:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2792F40150; Wed, 20 Oct 2021 10:04:55 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7F2F140142 for ; Wed, 20 Oct 2021 10:04:53 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HZ3545TWbzZcPb; Wed, 20 Oct 2021 16:03:04 +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.2308.15; Wed, 20 Oct 2021 16:04:50 +0800 Received: from [127.0.0.1] (10.67.100.224) 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.15; Wed, 20 Oct 2021 16:04:50 +0800 To: Kevin Laatz , CC: , , , References: <20210827172048.558704-1-kevin.laatz@intel.com> <20211019141041.1890983-1-kevin.laatz@intel.com> <20211019141041.1890983-9-kevin.laatz@intel.com> From: fengchengwen Message-ID: <96a95e9e-a5df-3814-72c8-92b7b88e1407@huawei.com> Date: Wed, 20 Oct 2021 16:04:50 +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: <20211019141041.1890983-9-kevin.laatz@intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] 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 v10 08/16] dma/idxd: add start and stop functions for pci devices 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/10/19 22:10, Kevin Laatz wrote: > Add device start/stop functions for DSA devices bound to vfio. For devices > bound to the IDXD kernel driver, these are not required since the IDXD > kernel driver takes care of this. > > Signed-off-by: Bruce Richardson > Signed-off-by: Kevin Laatz > Reviewed-by: Conor Walsh > --- [snip] > > +static int > +idxd_pci_dev_stop(struct rte_dma_dev *dev) > +{ > + struct idxd_dmadev *idxd = dev->fp_obj->dev_private; > + uint8_t err_code; > + > + if (!idxd_is_wq_enabled(idxd)) { > + IDXD_PMD_ERR("Work queue %d already disabled", idxd->qid); > + return -EALREADY; suggest return 0. > + } > + > + err_code = idxd_pci_dev_command(idxd, idxd_disable_wq); > + if (err_code || idxd_is_wq_enabled(idxd)) { > + IDXD_PMD_ERR("Failed disabling work queue %d, error code: %#x", > + idxd->qid, err_code); > + return err_code == 0 ? -1 : -err_code; > + } > + IDXD_PMD_DEBUG("Work queue %d disabled OK", idxd->qid); > + > + return 0; > +} > + > +static int > +idxd_pci_dev_start(struct rte_dma_dev *dev) > +{ > + struct idxd_dmadev *idxd = dev->fp_obj->dev_private; > + uint8_t err_code; > + > + if (idxd_is_wq_enabled(idxd)) { > + IDXD_PMD_WARN("WQ %d already enabled", idxd->qid); > + return 0; > + } > + > + if (idxd->desc_ring == NULL) { > + IDXD_PMD_ERR("WQ %d has not been fully configured", idxd->qid); > + return -EINVAL; > + } > + > + err_code = idxd_pci_dev_command(idxd, idxd_enable_wq); > + if (err_code || !idxd_is_wq_enabled(idxd)) { > + IDXD_PMD_ERR("Failed enabling work queue %d, error code: %#x", > + idxd->qid, err_code); > + return err_code == 0 ? -1 : -err_code; > + } > + IDXD_PMD_DEBUG("Work queue %d enabled OK", idxd->qid); > + > + return 0; > +} > + > static int > idxd_pci_dev_close(struct rte_dma_dev *dev) > { > @@ -87,6 +136,8 @@ static const struct rte_dma_dev_ops idxd_pci_ops = { > .dev_configure = idxd_configure, > .vchan_setup = idxd_vchan_setup, > .dev_info_get = idxd_info_get, > + .dev_start = idxd_pci_dev_start, > + .dev_stop = idxd_pci_dev_stop, > }; > > /* each portal uses 4 x 4k pages */ >