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 E455742660; Thu, 28 Sep 2023 12:38:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D210640E96; Thu, 28 Sep 2023 12:38:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 96FE34029E for ; Thu, 28 Sep 2023 12:38:02 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38SAAUIX022981; Thu, 28 Sep 2023 03:38:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=DweaABuhl1Ag1XPwKSVb2n8QHaXToUCMy4QbMb8cePk=; b=K+bIlHGGn/PPYkOjTNH0raRl+niK92YTeyMjsUT7COIUm9lz3gE+WoXcceiBAsSvgo2K edS6+DzhkAnD1Fp1BuZwbuda+TdEYoe3XQfuwlG821ISIXbcmcQVtv70JM1rJcmegdZx /blHNvFd4gGRsvcEybr9diieAj/ru93mRq2paXc2pDYs7an9TwWlVEc4YoGs1FvpQgK8 l3exYGXgGebdyr5z0TJGugm6P+5lvuird8yXrxjxFT0olhD/iVOSrwXL+Tbgu22xaTrg AIbOh0qOoFc/sSCexDbfTp6YqYO4G2VldIGS3P2rDvrdk077KikUIaJU+khslg8rp4UM 0A== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tcu1qthm3-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 03:37:59 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 28 Sep 2023 03:37:54 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 28 Sep 2023 03:37:54 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id 9F76C5C68EE; Thu, 28 Sep 2023 03:37:50 -0700 (PDT) From: Amit Prakash Shukla To: Amit Prakash Shukla , Jerin Jacob CC: , , , , , , , , , , , , Subject: [PATCH v5 08/12] eventdev/dma: support adapter runtime params Date: Thu, 28 Sep 2023 16:06:19 +0530 Message-ID: <20230928103623.216287-9-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230928103623.216287-1-amitprakashs@marvell.com> References: <20230926103233.3956431-1-amitprakashs@marvell.com> <20230928103623.216287-1-amitprakashs@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: RS4tFDD854K7UQ50-pWBCOvz04zpWjXe X-Proofpoint-ORIG-GUID: RS4tFDD854K7UQ50-pWBCOvz04zpWjXe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-28_08,2023-09-28_01,2023-05-22_02 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 Added support to set and get runtime params for DMA adapter. The parameters that can be set/get are defined in struct rte_event_dma_adapter_runtime_params. Signed-off-by: Amit Prakash Shukla --- lib/eventdev/rte_event_dma_adapter.c | 93 ++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/lib/eventdev/rte_event_dma_adapter.c b/lib/eventdev/rte_event_dma_adapter.c index 63b07cd14e..850b010712 100644 --- a/lib/eventdev/rte_event_dma_adapter.c +++ b/lib/eventdev/rte_event_dma_adapter.c @@ -1211,3 +1211,96 @@ rte_event_dma_adapter_stop(uint8_t id) { return edma_adapter_ctrl(id, 0); } + +#define DEFAULT_MAX_NB 128 + +int +rte_event_dma_adapter_runtime_params_init(struct rte_event_dma_adapter_runtime_params *params) +{ + if (params == NULL) + return -EINVAL; + + memset(params, 0, sizeof(*params)); + params->max_nb = DEFAULT_MAX_NB; + + return 0; +} + +static int +dma_adapter_cap_check(struct event_dma_adapter *adapter) +{ + uint32_t caps; + int ret; + + if (!adapter->nb_vchanq) + return -EINVAL; + + ret = rte_event_dma_adapter_caps_get(adapter->eventdev_id, adapter->next_dmadev_id, &caps); + if (ret) { + RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8 " cdev %" PRIu8, + adapter->eventdev_id, adapter->next_dmadev_id); + return ret; + } + + if ((caps & RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) || + (caps & RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) + return -ENOTSUP; + + return 0; +} + +int +rte_event_dma_adapter_runtime_params_set(uint8_t id, + struct rte_event_dma_adapter_runtime_params *params) +{ + struct event_dma_adapter *adapter; + int ret; + + EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); + + if (params == NULL) { + RTE_EDEV_LOG_ERR("params pointer is NULL\n"); + return -EINVAL; + } + + adapter = edma_id_to_adapter(id); + if (adapter == NULL) + return -EINVAL; + + ret = dma_adapter_cap_check(adapter); + if (ret) + return ret; + + rte_spinlock_lock(&adapter->lock); + adapter->max_nb = params->max_nb; + rte_spinlock_unlock(&adapter->lock); + + return 0; +} + +int +rte_event_dma_adapter_runtime_params_get(uint8_t id, + struct rte_event_dma_adapter_runtime_params *params) +{ + struct event_dma_adapter *adapter; + int ret; + + EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); + + if (params == NULL) { + RTE_EDEV_LOG_ERR("params pointer is NULL\n"); + return -EINVAL; + } + + adapter = edma_id_to_adapter(id); + if (adapter == NULL) + return -EINVAL; + + ret = dma_adapter_cap_check(adapter); + if (ret) + return ret; + + params->max_nb = adapter->max_nb; + + return 0; +} -- 2.25.1