From patchwork Fri Sep 3 11:17:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Walsh X-Patchwork-Id: 97909 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9DF42A0C54; Fri, 3 Sep 2021 13:18:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2153F41157; Fri, 3 Sep 2021 13:17:58 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 6805B41151 for ; Fri, 3 Sep 2021 13:17:56 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10095"; a="217533971" X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="217533971" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2021 04:17:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="500322857" Received: from silpixa00401160.ir.intel.com ([10.55.128.248]) by fmsmga008.fm.intel.com with ESMTP; 03 Sep 2021 04:17:54 -0700 From: Conor Walsh To: bruce.richardson@intel.com, fengchengwen@huawei.com, jerinj@marvell.com, kevin.laatz@intel.com Cc: dev@dpdk.org, Conor Walsh Date: Fri, 3 Sep 2021 11:17:33 +0000 Message-Id: <20210903111734.2734545-10-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903111734.2734545-1-conor.walsh@intel.com> References: <20210827172550.1522362-1-conor.walsh@intel.com> <20210903111734.2734545-1-conor.walsh@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 09/10] dma/ioat: add support for vchan idle function 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" Add support for the rte_dmadev_vchan_idle API call. Signed-off-by: Conor Walsh Reviewed-by: Kevin Laatz --- drivers/dma/ioat/ioat_dmadev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index 743fb2f558..a09e60b27e 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -506,6 +506,19 @@ ioat_stats_reset(struct rte_dmadev *dev, uint16_t vchan __rte_unused) return 0; } +/* Check if the IOAT device is idle. */ +static int +ioat_vchan_idle(const struct rte_dmadev *dev, uint16_t vchan __rte_unused) +{ + int state = 0; + const struct ioat_dmadev *ioat = dev->dev_private; + const uint16_t mask = ioat->qcfg.nb_desc - 1; + const uint16_t last = __get_last_completed(ioat, &state); + + return (last == ((ioat->next_write - 1) & mask) || state == IOAT_CHANSTS_HALTED + || state == IOAT_CHANSTS_SUSPENDED); +} + /* Create a DMA device. */ static int ioat_dmadev_create(const char *name, struct rte_pci_device *dev) @@ -519,6 +532,7 @@ ioat_dmadev_create(const char *name, struct rte_pci_device *dev) .dev_stop = ioat_dev_stop, .stats_get = ioat_stats_get, .stats_reset = ioat_stats_reset, + .vchan_idle = ioat_vchan_idle, .vchan_setup = ioat_vchan_setup, };