DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>, <jerinj@marvell.com>
Cc: Shijith Thotton <sthotton@marvell.com>, <pbhagavatula@marvell.com>
Subject: [PATCH 2/6] eventdev: add weight and affinity to queue attributes
Date: Tue, 29 Mar 2022 18:41:01 +0530	[thread overview]
Message-ID: <e2b3e29b78e4273fbad717d5095e431095beec31.1648549553.git.sthotton@marvell.com> (raw)
In-Reply-To: <cover.1648549553.git.sthotton@marvell.com>

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 <sthotton@marvell.com>
---
 lib/eventdev/eventdev_pmd.h | 22 ++++++++++++++++++++
 lib/eventdev/rte_eventdev.c | 12 +++++++++++
 lib/eventdev/rte_eventdev.h | 41 +++++++++++++++++++++++++++++++++----
 3 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 6182749503..f19df98a7a 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 13c8af877e..37f0e54bf3 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 19710cd0c5..fa16fc5dcb 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, a queue with highest
+ * weight is selected. Subsequent schedules from an event port could see events
+ * from the same event queue if the queue is configured with an affinity count.
+ * Affinity count of a queue indicates the number of times, the subsequent
+ * schedule calls from an event port should use the same 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,11 +710,18 @@ 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
 /**
  * Maximum supported attribute ID.
  */
-#define RTE_EVENT_QUEUE_ATTR_MAX RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE
+#define RTE_EVENT_QUEUE_ATTR_MAX RTE_EVENT_QUEUE_ATTR_AFFINITY
 
 /**
  * Get an attribute from a queue.
-- 
2.25.1


  parent reply	other threads:[~2022-03-29 13:12 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 13:10 [PATCH 0/6] Extend and set event queue attributes at runtime Shijith Thotton
2022-03-29 13:11 ` [PATCH 1/6] eventdev: support to set " Shijith Thotton
2022-03-30 10:58   ` Van Haaren, Harry
2022-04-04  9:35     ` Shijith Thotton
2022-04-04  9:45       ` Van Haaren, Harry
2022-03-30 12:14   ` Mattias Rönnblom
2022-04-04 11:45     ` Shijith Thotton
2022-03-29 13:11 ` Shijith Thotton [this message]
2022-03-30 12:12   ` [PATCH 2/6] eventdev: add weight and affinity to queue attributes Mattias Rönnblom
2022-04-04  9:33     ` Shijith Thotton
2022-03-29 13:11 ` [PATCH 3/6] doc: announce change in event queue conf structure Shijith Thotton
2022-03-29 13:11 ` [PATCH 4/6] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-03-29 13:11 ` [PATCH 5/6] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-03-30 11:05   ` Van Haaren, Harry
2022-04-04  7:59     ` Shijith Thotton
2022-03-29 13:11 ` [PATCH 6/6] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-03-29 18:49 ` [PATCH 0/6] Extend and set event queue attributes at runtime Jerin Jacob
2022-03-30 10:52   ` Van Haaren, Harry
2022-04-04  7:57     ` Shijith Thotton
2022-04-05  5:40 ` [PATCH v2 " Shijith Thotton
2022-04-05  5:40   ` [PATCH v2 1/6] eventdev: support to set " Shijith Thotton
2022-05-09 12:43     ` Jerin Jacob
2022-04-05  5:40   ` [PATCH v2 2/6] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-09 12:46     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 3/6] doc: announce change in event queue conf structure Shijith Thotton
2022-05-09 12:47     ` Jerin Jacob
2022-05-15 10:24     ` [PATCH v3] " Shijith Thotton
2022-07-12 14:05       ` Jerin Jacob
2022-07-13  6:52         ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-07-13  8:55         ` Mattias Rönnblom
2022-07-13  9:56           ` Pavan Nikhilesh Bhagavatula
2022-07-17 12:52       ` Thomas Monjalon
2022-04-05  5:41   ` [PATCH v2 4/6] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-05-09 12:55     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 5/6] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-05-09 12:57     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 6/6] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-04-11 11:07   ` [PATCH v2 0/6] Extend and set event queue attributes at runtime Shijith Thotton
2022-05-15  9:53   ` [PATCH v3 0/5] " Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 1/5] eventdev: support to set " Shijith Thotton
2022-05-15 13:11       ` Mattias Rönnblom
2022-05-16  3:57         ` Shijith Thotton
2022-05-16 10:23           ` Mattias Rönnblom
2022-05-16 12:12             ` Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 2/5] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 3/5] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 4/5] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 5/5] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-05-16 17:35     ` [PATCH v4 0/5] Extend and set event queue attributes at runtime Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 1/5] eventdev: support to set " Shijith Thotton
2022-05-16 18:02         ` Jerin Jacob
2022-05-17  8:55           ` Mattias Rönnblom
2022-05-17 13:35             ` Jerin Jacob
2022-05-19  8:49         ` Ray Kinsella
2022-05-16 17:35       ` [PATCH v4 2/5] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 3/5] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 4/5] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 5/5] event/cnxk: support to set runtime queue attributes Shijith Thotton

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=e2b3e29b78e4273fbad717d5095e431095beec31.1648549553.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --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).