DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <jerinj@marvell.com>
Cc: Shijith Thotton <sthotton@marvell.com>, <dev@dpdk.org>,
	Ray Kinsella <mdr@ashroe.eu>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH] eventdev: add weight and affinity attributes to queue conf
Date: Wed, 10 Aug 2022 13:06:52 +0530	[thread overview]
Message-ID: <dcd3cf0ec034632f97223bb9df389f9cedf9753c.1660116951.git.sthotton@marvell.com> (raw)

Added new fields to represent event queue weight and affinity in
rte_event_queue_conf structure. Internal op to get queue attribute is
removed as it is no longer needed. Updated driver to use the new field.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 doc/guides/rel_notes/deprecation.rst   |  3 --
 doc/guides/rel_notes/release_22_11.rst |  3 ++
 drivers/event/cnxk/cn10k_eventdev.c    |  1 -
 drivers/event/cnxk/cn9k_eventdev.c     |  1 -
 drivers/event/cnxk/cnxk_eventdev.c     | 42 ++++++--------------------
 drivers/event/cnxk/cnxk_eventdev.h     |  9 ------
 lib/eventdev/eventdev_pmd.h            | 22 --------------
 lib/eventdev/rte_eventdev.c            | 10 +++---
 lib/eventdev/rte_eventdev.h            | 16 ++++++++++
 9 files changed, 33 insertions(+), 74 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..13e7c6370e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -206,9 +206,6 @@ Deprecation Notices
   ``rte_event_vector::elem_offset`` gives the number of valid elements left
   to process from the ``rte_event_vector::elem_offset``.
 
-* eventdev: New fields to represent event queue weight and affinity
-  will be added to ``rte_event_queue_conf`` structure in DPDK 22.11.
-
 * metrics: The function ``rte_metrics_init`` will have a non-void return
   in order to notify errors instead of calling ``rte_exit``.
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..8ffd71e650 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,9 @@ API Changes
 ABI Changes
 -----------
 
+* eventdev: Added ``weight`` and ``affinity`` fields to ``rte_event_queue_conf``
+  structure.
+
 .. This section should contain ABI changes. Sample format:
 
    * sample: Add a short 1-2 sentence description of the ABI change
diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 5a0cab40a9..aa8ae394bc 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -922,7 +922,6 @@ static struct eventdev_ops cn10k_sso_dev_ops = {
 	.queue_def_conf = cnxk_sso_queue_def_conf,
 	.queue_setup = cnxk_sso_queue_setup,
 	.queue_release = cnxk_sso_queue_release,
-	.queue_attr_get = cnxk_sso_queue_attribute_get,
 	.queue_attr_set = cnxk_sso_queue_attribute_set,
 
 	.port_def_conf = cnxk_sso_port_def_conf,
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 2e27030049..58c72a580a 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -1153,7 +1153,6 @@ static struct eventdev_ops cn9k_sso_dev_ops = {
 	.queue_def_conf = cnxk_sso_queue_def_conf,
 	.queue_setup = cnxk_sso_queue_setup,
 	.queue_release = cnxk_sso_queue_release,
-	.queue_attr_get = cnxk_sso_queue_attribute_get,
 	.queue_attr_set = cnxk_sso_queue_attribute_set,
 
 	.port_def_conf = cnxk_sso_port_def_conf,
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index 97dcf7b66e..45c53ffb4e 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -321,6 +321,8 @@ cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
 	queue_conf->nb_atomic_order_sequences = (1ULL << 20);
 	queue_conf->event_queue_cfg = RTE_EVENT_QUEUE_CFG_ALL_TYPES;
 	queue_conf->priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
+	queue_conf->weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
+	queue_conf->affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
 }
 
 int
@@ -330,18 +332,12 @@ cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
 	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
 	uint8_t priority, weight, affinity;
 
-	/* Default weight and affinity */
-	dev->mlt_prio[queue_id].weight = RTE_EVENT_QUEUE_WEIGHT_LOWEST;
-	dev->mlt_prio[queue_id].affinity = RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
-
 	priority = CNXK_QOS_NORMALIZE(queue_conf->priority, 0,
 				      RTE_EVENT_DEV_PRIORITY_LOWEST,
 				      CNXK_SSO_PRIORITY_CNT);
-	weight = CNXK_QOS_NORMALIZE(
-		dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
-		RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
-	affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
-				      RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
+	weight = CNXK_QOS_NORMALIZE(queue_conf->weight, CNXK_SSO_WEIGHT_MIN,
+				    RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
+	affinity = CNXK_QOS_NORMALIZE(queue_conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
 				      CNXK_SSO_AFFINITY_CNT);
 
 	plt_sso_dbg("Queue=%u prio=%u weight=%u affinity=%u", queue_id,
@@ -358,22 +354,6 @@ cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id)
 	RTE_SET_USED(queue_id);
 }
 
-int
-cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev, uint8_t queue_id,
-			     uint32_t attr_id, uint32_t *attr_value)
-{
-	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
-
-	if (attr_id == RTE_EVENT_QUEUE_ATTR_WEIGHT)
-		*attr_value = dev->mlt_prio[queue_id].weight;
-	else if (attr_id == RTE_EVENT_QUEUE_ATTR_AFFINITY)
-		*attr_value = dev->mlt_prio[queue_id].affinity;
-	else
-		return -EINVAL;
-
-	return 0;
-}
-
 int
 cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
 			     uint32_t attr_id, uint64_t attr_value)
@@ -389,10 +369,10 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
 		conf->priority = attr_value;
 		break;
 	case RTE_EVENT_QUEUE_ATTR_WEIGHT:
-		dev->mlt_prio[queue_id].weight = attr_value;
+		conf->weight = attr_value;
 		break;
 	case RTE_EVENT_QUEUE_ATTR_AFFINITY:
-		dev->mlt_prio[queue_id].affinity = attr_value;
+		conf->affinity = attr_value;
 		break;
 	case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
 	case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
@@ -409,11 +389,9 @@ cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t queue_id,
 	priority = CNXK_QOS_NORMALIZE(conf->priority, 0,
 				      RTE_EVENT_DEV_PRIORITY_LOWEST,
 				      CNXK_SSO_PRIORITY_CNT);
-	weight = CNXK_QOS_NORMALIZE(
-		dev->mlt_prio[queue_id].weight, CNXK_SSO_WEIGHT_MIN,
-		RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
-	affinity = CNXK_QOS_NORMALIZE(dev->mlt_prio[queue_id].affinity, 0,
-				      RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
+	weight = CNXK_QOS_NORMALIZE(conf->weight, CNXK_SSO_WEIGHT_MIN,
+				    RTE_EVENT_QUEUE_WEIGHT_HIGHEST, CNXK_SSO_WEIGHT_CNT);
+	affinity = CNXK_QOS_NORMALIZE(conf->affinity, 0, RTE_EVENT_QUEUE_AFFINITY_HIGHEST,
 				      CNXK_SSO_AFFINITY_CNT);
 
 	return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity,
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index bfd0c5627e..d78fb4ea2f 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -88,11 +88,6 @@ struct cnxk_sso_qos {
 	uint16_t iaq_prcnt;
 };
 
-struct cnxk_sso_mlt_prio {
-	uint8_t weight;
-	uint8_t affinity;
-};
-
 struct cnxk_sso_evdev {
 	struct roc_sso sso;
 	uint8_t max_event_queues;
@@ -123,7 +118,6 @@ struct cnxk_sso_evdev {
 	uint64_t *timer_adptr_sz;
 	uint16_t vec_pool_cnt;
 	uint64_t *vec_pools;
-	struct cnxk_sso_mlt_prio mlt_prio[RTE_EVENT_MAX_QUEUES_PER_DEV];
 	/* Dev args */
 	uint32_t xae_cnt;
 	uint8_t qos_queue_cnt;
@@ -250,9 +244,6 @@ void cnxk_sso_queue_def_conf(struct rte_eventdev *event_dev, uint8_t queue_id,
 int cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
 			 const struct rte_event_queue_conf *queue_conf);
 void cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id);
-int cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev,
-				 uint8_t queue_id, uint32_t attr_id,
-				 uint32_t *attr_value);
 int cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev,
 				 uint8_t queue_id, uint32_t attr_id,
 				 uint64_t attr_value);
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..8879e43feb 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -341,26 +341,6 @@ 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.
  *
@@ -1268,8 +1248,6 @@ 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 1dc4f966be..b96185b25d 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -859,15 +859,13 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		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);
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = conf->weight;
 		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);
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = conf->affinity;
 		break;
 	default:
 		return -EINVAL;
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 6a6f6ea4c1..f1908b82b2 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -640,6 +640,22 @@ struct rte_event_queue_conf {
 	 * event device supported priority value.
 	 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
 	 */
+	uint8_t weight;
+	/**< Weight of the event queue relative to other event queues.
+	 * The requested weight should be in the range of
+	 * [RTE_EVENT_DEV_WEIGHT_HIGHEST, RTE_EVENT_DEV_WEIGHT_LOWEST].
+	 * The implementation shall normalize the requested weight to event
+	 * device supported weight value.
+	 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
+	 */
+	uint8_t affinity;
+	/**< Affinity of the event queue relative to other event queues.
+	 * The requested affinity should be in the range of
+	 * [RTE_EVENT_DEV_AFFINITY_HIGHEST, RTE_EVENT_DEV_AFFINITY_LOWEST].
+	 * The implementation shall normalize the requested affinity to event
+	 * device supported affinity value.
+	 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
+	 */
 };
 
 /**
-- 
2.25.1


             reply	other threads:[~2022-08-10  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  7:36 Shijith Thotton [this message]
2022-09-14 12:34 ` Jerin Jacob
2022-09-15 16:53   ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcd3cf0ec034632f97223bb9df389f9cedf9753c.1660116951.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=mdr@ashroe.eu \
    --cc=pbhagavatula@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).