From patchwork Tue Apr 5 05:40:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shijith Thotton X-Patchwork-Id: 109141 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 18B7AA0505; Tue, 5 Apr 2022 07:41:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F069410F6; Tue, 5 Apr 2022 07:41:48 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id CCC80410E5 for ; Tue, 5 Apr 2022 07:41:46 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2351QRvk018544; Mon, 4 Apr 2022 22:41:46 -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=hk/zi/sn0FSXRUm8tzQpQtDOuJUUYowQkuFJOuLHabw=; b=OzXFH6e3yEkxWFwo24VuBfyjsvb9WXBLh6OA55DtU90ZfkDD9FHWnXk8AZQWDnnjEzY7 0tTaLLIn+QOPgDbSYGAurnECgwdbLd/HvHOQbH4K/GSrZCRs0VJUI9QpXXVxy1eC1Dgz 25OYCSe/NRRehYrLakyOg1eHWjM3Rznr4fBS1wzuRWfaCb4FejFiFhWiTx44fA5xA0YE NIv2LMKyh6xXVwB2OLgt8diY27Qqb4BO2B3HObmylUBHIu9Pzk0wv7lPho79LzB1A71l vvEpPtT5312G0rZzFxDFqpdSt3M4Lk53f+lSEcOC42O9mE8egpua/IFu47uU42VJ7NVE Vg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3f6kupk7un-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 04 Apr 2022 22:41:45 -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.2; Mon, 4 Apr 2022 22:41:44 -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, 4 Apr 2022 22:41:44 -0700 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id 765F53F7040; Mon, 4 Apr 2022 22:41:42 -0700 (PDT) From: Shijith Thotton To: , CC: Shijith Thotton , , , Subject: [PATCH v2 2/6] eventdev: add weight and affinity to queue attributes Date: Tue, 5 Apr 2022 11:10:59 +0530 Message-ID: <3ca1a9399508dd7812cb9f36f8a2989a07e113e2.1649136534.git.sthotton@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: wDvRHagzxQY2M4xdUvkzwmPQNVUV3PRm X-Proofpoint-GUID: wDvRHagzxQY2M4xdUvkzwmPQNVUV3PRm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-04_09,2022-03-31_01,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 Extended eventdev queue QoS attributes to support weight and affinity. If queues are of same priority, events from the queue with highest weight will be scheduled first. Affinity indicates the number of times, the subsequent schedule calls from an event port will use the same event queue. Schedule call selects another queue if current queue goes empty or schedule count reaches affinity count. To avoid ABI break, weight and affinity attributes are not yet added to queue config structure and relies on PMD for managing it. New eventdev op queue_attr_get can be used to get it from the PMD. Signed-off-by: Shijith Thotton Acked-by: Jerin Jacob --- lib/eventdev/eventdev_pmd.h | 22 +++++++++++++++++++++ lib/eventdev/rte_eventdev.c | 12 ++++++++++++ lib/eventdev/rte_eventdev.h | 38 +++++++++++++++++++++++++++++++++++-- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index 3b85d9f7a5..5495aee4f6 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); +/** + * Get 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[out] attr_value + * Event queue attribute value + * + * @return + * - 0: Success. + * - <0: Error code on failure. + */ +typedef int (*eventdev_queue_attr_get_t)(struct rte_eventdev *dev, + uint8_t queue_id, uint32_t attr_id, + uint32_t *attr_value); + /** * Set an event queue attribute at runtime. * @@ -1231,6 +1251,8 @@ struct eventdev_ops { /**< Set up an event queue. */ eventdev_queue_release_t queue_release; /**< Release an event queue. */ + eventdev_queue_attr_get_t queue_attr_get; + /**< Get an event queue attribute. */ eventdev_queue_attr_set_t queue_attr_set; /**< Set an event queue attribute. */ diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index a31e99be02..12b261f923 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -838,6 +838,18 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, *attr_value = conf->schedule_type; break; + case RTE_EVENT_QUEUE_ATTR_WEIGHT: + *attr_value = RTE_EVENT_QUEUE_WEIGHT_LOWEST; + if (dev->dev_ops->queue_attr_get) + return (*dev->dev_ops->queue_attr_get)( + dev, queue_id, attr_id, attr_value); + break; + case RTE_EVENT_QUEUE_ATTR_AFFINITY: + *attr_value = RTE_EVENT_QUEUE_AFFINITY_LOWEST; + if (dev->dev_ops->queue_attr_get) + return (*dev->dev_ops->queue_attr_get)( + dev, queue_id, attr_id, attr_value); + break; default: return -EINVAL; }; diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index 16e9d5fb5b..a6fbaf1c11 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -222,8 +222,14 @@ struct rte_event; /* Event device capability bitmap flags */ #define RTE_EVENT_DEV_CAP_QUEUE_QOS (1ULL << 0) -/**< Event scheduling prioritization is based on the priority associated with - * each event queue. +/**< Event scheduling prioritization is based on the priority and weight + * associated with each event queue. Events from a queue with highest priority + * is scheduled first. If the queues are of same priority, weight of the queues + * are considered to select a queue in a weighted round robin fashion. + * Subsequent dequeue calls from an event port could see events from the same + * event queue, if the queue is configured with an affinity count. Affinity + * count is the number of subsequent dequeue calls, in which an event port + * should use the same event queue if the queue is non-empty * * @see rte_event_queue_setup(), rte_event_queue_attr_set() */ @@ -331,6 +337,26 @@ struct rte_event; * @see rte_event_port_link() */ +/* Event queue scheduling weights */ +#define RTE_EVENT_QUEUE_WEIGHT_HIGHEST 255 +/**< Highest weight of an event queue + * @see rte_event_queue_attr_get(), rte_event_queue_attr_set() + */ +#define RTE_EVENT_QUEUE_WEIGHT_LOWEST 0 +/**< Lowest weight of an event queue + * @see rte_event_queue_attr_get(), rte_event_queue_attr_set() + */ + +/* Event queue scheduling affinity */ +#define RTE_EVENT_QUEUE_AFFINITY_HIGHEST 255 +/**< Highest scheduling affinity of an event queue + * @see rte_event_queue_attr_get(), rte_event_queue_attr_set() + */ +#define RTE_EVENT_QUEUE_AFFINITY_LOWEST 0 +/**< Lowest scheduling affinity of an event queue + * @see rte_event_queue_attr_get(), rte_event_queue_attr_set() + */ + /** * Get the total number of event devices that have been successfully * initialised. @@ -684,6 +710,14 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id, * The schedule type of the queue. */ #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 +/** + * The weight of the queue. + */ +#define RTE_EVENT_QUEUE_ATTR_WEIGHT 5 +/** + * Affinity of the queue. + */ +#define RTE_EVENT_QUEUE_ATTR_AFFINITY 6 /** * Get an attribute from a queue.