From patchwork Mon May 16 17:35:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shijith Thotton X-Patchwork-Id: 111189 X-Patchwork-Delegate: jerinj@marvell.com 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 51474A00BE; Mon, 16 May 2022 19:39:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F0AD40A7A; Mon, 16 May 2022 19:39:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DD6D44068B for ; Mon, 16 May 2022 19:39:25 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24GB6vIw012720; Mon, 16 May 2022 10:37:23 -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=0wR4lBXb1r2DEULglOhQr95WATJSJ2FcEqaywGw+L0I=; b=J5yQuzEjrszAWXMK5jOmGux/XmCoFdqJYA28X5kTVXOjWQcQfR84iUPdZCfwHO7kdt28 JeWcn0EBdTEUexk86C/gKvxGeTCOQfQHhIyPh0CNHnmo0nyPKH+1joDy69zAqcvopFdx FF7IVC5A4A6o3kgLB6z8cJK4SDfFE/9JjtJbngBrBFExcMms3kxxaItjs0lm6ZXmEX5J Ii8kjEhEvWwHtyfamKjsp8Q2IIsvA0TwSGBEI4vUsPnTXohctiLvPIZbvRIiXRbfQjHx SWe4b3kapQAIFxss8xGeyqJwuq919XCjR2Sh6V8gfPsxAjHLW2tOlptvasloJX5fwTRn 5Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g2bxsqytr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 16 May 2022 10:37:22 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 16 May 2022 10:37:20 -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.2 via Frontend Transport; Mon, 16 May 2022 10:37:20 -0700 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id 65ED13F70CF; Mon, 16 May 2022 10:37:18 -0700 (PDT) From: Shijith Thotton To: , CC: Shijith Thotton , , , , Subject: [PATCH v4 1/5] eventdev: support to set queue attributes at runtime Date: Mon, 16 May 2022 23:05:47 +0530 Message-ID: <33fe903b38d712388230cfa58ee3a64987771918.1652722314.git.sthotton@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: i-cBrDFAMxiMq1QKFIdaxitZkVulfJzS X-Proofpoint-GUID: i-cBrDFAMxiMq1QKFIdaxitZkVulfJzS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-16_15,2022-05-16_02,2022-02-23_01 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 a new eventdev API rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization using rte_event_queue_setup(). PMD's supporting this feature should expose the capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR. Signed-off-by: Shijith Thotton Acked-by: Jerin Jacob Acked-by: Ray Kinsella --- doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 5 ++++ lib/eventdev/eventdev_pmd.h | 22 ++++++++++++++++ lib/eventdev/rte_eventdev.c | 26 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 32 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 88 insertions(+), 1 deletion(-) diff --git a/doc/guides/eventdevs/features/default.ini b/doc/guides/eventdevs/features/default.ini index 2ea233463a..00360f60c6 100644 --- a/doc/guides/eventdevs/features/default.ini +++ b/doc/guides/eventdevs/features/default.ini @@ -17,6 +17,7 @@ runtime_port_link = multiple_queue_port = carry_flow_id = maintenance_free = +runtime_queue_attr = ; ; Features of a default Ethernet Rx adapter. diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 88d6e96cc1..a7a912d665 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -65,6 +65,11 @@ New Features * Added support for promiscuous mode on Windows. * Added support for MTU on Windows. +* **Added support for setting queue attributes at runtime in eventdev.** + + Added new API ``rte_event_queue_attr_set()``, to set event queue attributes + at runtime. + Removed Items ------------- diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index ce469d47a6..3b85d9f7a5 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev, typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev, uint8_t queue_id); +/** + * Set an event queue attribute at runtime. + * + * @param dev + * Event device pointer + * @param queue_id + * Event queue index + * @param attr_id + * Event queue attribute id + * @param attr_value + * Event queue attribute value + * + * @return + * - 0: Success. + * - <0: Error code on failure. + */ +typedef int (*eventdev_queue_attr_set_t)(struct rte_eventdev *dev, + uint8_t queue_id, uint32_t attr_id, + uint64_t attr_value); + /** * Retrieve the default event port configuration. * @@ -1211,6 +1231,8 @@ struct eventdev_ops { /**< Set up an event queue. */ eventdev_queue_release_t queue_release; /**< Release an event queue. */ + eventdev_queue_attr_set_t queue_attr_set; + /**< Set an event queue attribute. */ eventdev_port_default_conf_get_t port_def_conf; /**< Get default port configuration. */ diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 532a253553..a31e99be02 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -844,6 +844,32 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, return 0; } +int +rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, + uint64_t attr_value) +{ + struct rte_eventdev *dev; + + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_eventdevs[dev_id]; + if (!is_valid_queue(dev, queue_id)) { + RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id); + return -EINVAL; + } + + if (!(dev->data->event_dev_cap & + RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR)) { + RTE_EDEV_LOG_ERR( + "Device %" PRIu8 "does not support changing queue attributes at runtime", + dev_id); + return -ENOTSUP; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP); + return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id, + attr_value); +} + int rte_event_port_link(uint8_t dev_id, uint8_t port_id, const uint8_t queues[], const uint8_t priorities[], diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index 42a5660169..a79b1397eb 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -225,7 +225,7 @@ struct rte_event; /**< Event scheduling prioritization is based on the priority associated with * each event queue. * - * @see rte_event_queue_setup() + * @see rte_event_queue_setup(), rte_event_queue_attr_set() */ #define RTE_EVENT_DEV_CAP_EVENT_QOS (1ULL << 1) /**< Event scheduling prioritization is based on the priority associated with @@ -307,6 +307,13 @@ struct rte_event; * global pool, or process signaling related to load balancing. */ +#define RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR (1ULL << 11) +/**< Event device is capable of changing the queue attributes at runtime i.e + * after rte_event_queue_setup() or rte_event_start() call sequence. If this + * flag is not set, eventdev queue attributes can only be configured during + * rte_event_queue_setup(). + */ + /* Event device priority levels */ #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 /**< Highest priority expressed across eventdev subsystem @@ -702,6 +709,29 @@ int rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, uint32_t *attr_value); +/** + * Set an event queue attribute. + * + * @param dev_id + * Eventdev id + * @param queue_id + * Eventdev queue id + * @param attr_id + * The attribute ID to set + * @param attr_value + * The attribute value to set + * + * @return + * - 0: Successfully set attribute. + * - -EINVAL: invalid device, queue or attr_id. + * - -ENOTSUP: device does not support setting the event attribute. + * - <0: failed to set event queue attribute + */ +__rte_experimental +int +rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, + uint64_t attr_value); + /* Event port specific APIs */ /* Event port configuration bitmap flags */ diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index cd5dada07f..c581b75c18 100644 --- a/lib/eventdev/version.map +++ b/lib/eventdev/version.map @@ -108,6 +108,9 @@ EXPERIMENTAL { # added in 22.03 rte_event_eth_rx_adapter_event_port_get; + + # added in 22.07 + rte_event_queue_attr_set; }; INTERNAL {