From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>, <jerinj@marvell.com>
Cc: Shijith Thotton <sthotton@marvell.com>,
<pbhagavatula@marvell.com>, <harry.van.haaren@intel.com>,
<mattias.ronnblom@ericsson.com>, <mdr@ashroe.eu>
Subject: [PATCH v4 5/5] event/cnxk: support to set runtime queue attributes
Date: Mon, 16 May 2022 23:05:51 +0530 [thread overview]
Message-ID: <d7695195d64b5c2826cd00f33d258e7577ff2931.1652722314.git.sthotton@marvell.com> (raw)
In-Reply-To: <cover.1652722314.git.sthotton@marvell.com>
Added API to set queue attributes at runtime and API to get weight and
affinity.
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
doc/guides/eventdevs/features/cnxk.ini | 1 +
drivers/event/cnxk/cn10k_eventdev.c | 4 ++
drivers/event/cnxk/cn9k_eventdev.c | 4 ++
drivers/event/cnxk/cnxk_eventdev.c | 91 ++++++++++++++++++++++++--
drivers/event/cnxk/cnxk_eventdev.h | 19 ++++++
5 files changed, 113 insertions(+), 6 deletions(-)
diff --git a/doc/guides/eventdevs/features/cnxk.ini b/doc/guides/eventdevs/features/cnxk.ini
index 7633c6e3a2..bee69bf8f4 100644
--- a/doc/guides/eventdevs/features/cnxk.ini
+++ b/doc/guides/eventdevs/features/cnxk.ini
@@ -12,6 +12,7 @@ runtime_port_link = Y
multiple_queue_port = Y
carry_flow_id = Y
maintenance_free = Y
+runtime_queue_attr = y
[Eth Rx adapter Features]
internal_port = Y
diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 94829e789c..450e1bf50c 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -846,9 +846,13 @@ cn10k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev,
static struct eventdev_ops cn10k_sso_dev_ops = {
.dev_infos_get = cn10k_sso_info_get,
.dev_configure = cn10k_sso_dev_configure,
+
.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,
.port_setup = cn10k_sso_port_setup,
.port_release = cn10k_sso_port_release,
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 987888d3db..3de22d7f4e 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -1084,9 +1084,13 @@ cn9k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev,
static struct eventdev_ops cn9k_sso_dev_ops = {
.dev_infos_get = cn9k_sso_info_get,
.dev_configure = cn9k_sso_dev_configure,
+
.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,
.port_setup = cn9k_sso_port_setup,
.port_release = cn9k_sso_port_release,
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index be021d86c9..a2829b817e 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -120,7 +120,8 @@ cnxk_sso_info_get(struct cnxk_sso_evdev *dev,
RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT |
RTE_EVENT_DEV_CAP_NONSEQ_MODE |
RTE_EVENT_DEV_CAP_CARRY_FLOW_ID |
- RTE_EVENT_DEV_CAP_MAINTENANCE_FREE;
+ RTE_EVENT_DEV_CAP_MAINTENANCE_FREE |
+ RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR;
}
int
@@ -300,11 +301,27 @@ cnxk_sso_queue_setup(struct rte_eventdev *event_dev, uint8_t queue_id,
const struct rte_event_queue_conf *queue_conf)
{
struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
-
- plt_sso_dbg("Queue=%d prio=%d", queue_id, queue_conf->priority);
- /* Normalize <0-255> to <0-7> */
- return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, 0xFF, 0xFF,
- queue_conf->priority / 32);
+ 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,
+ CNXK_SSO_AFFINITY_CNT);
+
+ plt_sso_dbg("Queue=%u prio=%u weight=%u affinity=%u", queue_id,
+ priority, weight, affinity);
+
+ return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity,
+ priority);
}
void
@@ -314,6 +331,68 @@ 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)
+{
+ struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
+ uint8_t priority, weight, affinity;
+ struct rte_event_queue_conf *conf;
+
+ conf = &event_dev->data->queues_cfg[queue_id];
+
+ switch (attr_id) {
+ case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+ conf->priority = attr_value;
+ break;
+ case RTE_EVENT_QUEUE_ATTR_WEIGHT:
+ dev->mlt_prio[queue_id].weight = attr_value;
+ break;
+ case RTE_EVENT_QUEUE_ATTR_AFFINITY:
+ dev->mlt_prio[queue_id].affinity = attr_value;
+ break;
+ case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
+ case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
+ case RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG:
+ case RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE:
+ /* FALLTHROUGH */
+ plt_sso_dbg("Unsupported attribute id %u", attr_id);
+ return -ENOTSUP;
+ default:
+ plt_err("Invalid attribute id %u", attr_id);
+ return -EINVAL;
+ }
+
+ 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,
+ CNXK_SSO_AFFINITY_CNT);
+
+ return roc_sso_hwgrp_set_priority(&dev->sso, queue_id, weight, affinity,
+ priority);
+}
+
void
cnxk_sso_port_def_conf(struct rte_eventdev *event_dev, uint8_t port_id,
struct rte_event_port_conf *port_conf)
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index 5564746e6d..531f6d1a84 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -38,6 +38,11 @@
#define CNXK_SSO_XAQ_CACHE_CNT (0x7)
#define CNXK_SSO_XAQ_SLACK (8)
#define CNXK_SSO_WQE_SG_PTR (9)
+#define CNXK_SSO_PRIORITY_CNT (0x8)
+#define CNXK_SSO_WEIGHT_MAX (0x3f)
+#define CNXK_SSO_WEIGHT_MIN (0x3)
+#define CNXK_SSO_WEIGHT_CNT (CNXK_SSO_WEIGHT_MAX - CNXK_SSO_WEIGHT_MIN + 1)
+#define CNXK_SSO_AFFINITY_CNT (0x10)
#define CNXK_TT_FROM_TAG(x) (((x) >> 32) & SSO_TT_EMPTY)
#define CNXK_TT_FROM_EVENT(x) (((x) >> 38) & SSO_TT_EMPTY)
@@ -54,6 +59,8 @@
#define CN10K_GW_MODE_PREF 1
#define CN10K_GW_MODE_PREF_WFE 2
+#define CNXK_QOS_NORMALIZE(val, min, max, cnt) \
+ (min + val / ((max + cnt - 1) / cnt))
#define CNXK_VALID_DEV_OR_ERR_RET(dev, drv_name) \
do { \
if (strncmp(dev->driver->name, drv_name, strlen(drv_name))) \
@@ -79,6 +86,11 @@ 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;
@@ -108,6 +120,7 @@ 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;
@@ -234,6 +247,12 @@ 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);
void cnxk_sso_port_def_conf(struct rte_eventdev *event_dev, uint8_t port_id,
struct rte_event_port_conf *port_conf);
int cnxk_sso_port_setup(struct rte_eventdev *event_dev, uint8_t port_id,
--
2.25.1
prev parent reply other threads:[~2022-05-16 17:39 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 ` [PATCH 2/6] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-03-30 12:12 ` 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 ` Shijith Thotton [this message]
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=d7695195d64b5c2826cd00f33d258e7577ff2931.1652722314.git.sthotton@marvell.com \
--to=sthotton@marvell.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=jerinj@marvell.com \
--cc=mattias.ronnblom@ericsson.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).