Extend and set event queue attributes at runtime
cover Extend and set event queue attributes at runtime
This series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR is added to expose the capability to set attributes at runtime and rte_event_queue_attr_set() API is used to set the attributes.
Attributes weight and affinity are not yet added to rte_event_queue_conf structure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Test application changes and example implementation are added as last three patches.
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSO
Shijith Thotton (5):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes
doc: announce change in event queue conf structure test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributes
app/test/test_eventdev.c | 146 ++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/deprecation.rst | 3 + drivers/common/cnxk/roc_sso.c | 174 ++++++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 +++++++++++------ drivers/event/cnxk/cn10k_eventdev.c | 4 + drivers/event/cnxk/cn9k_eventdev.c | 4 + drivers/event/cnxk/cnxk_eventdev.c | 81 +++++++++- drivers/event/cnxk/cnxk_eventdev.h | 16 ++ lib/eventdev/eventdev_pmd.h | 44 ++++++ lib/eventdev/rte_eventdev.c | 43 ++++++ lib/eventdev/rte_eventdev.h | 75 +++++++++- lib/eventdev/version.map | 3 + 15 files changed, 627 insertions(+), 103 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/6 eventdev: support to set queue attributes at runtime
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.
--- doc/guides/eventdevs/features/default.ini | 1 + lib/eventdev/eventdev_pmd.h | 22 +++++++++++++ lib/eventdev/rte_eventdev.c | 31 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 38 ++++++++++++++++++++++- lib/eventdev/version.map | 3 ++ 5 files changed, 94 insertions(+), 1 deletion(-)
doc/guides/eventdevs/features/default.ini +1 -0
@@ -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.
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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, +uint32_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. */
lib/eventdev/rte_eventdev.c +31 -0
@@ -844,6 +844,37 @@ 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, +uint32_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 (attr_id >RTE_EVENT_QUEUE_ATTR_MAX ) { +RTE_EDEV_LOG_ERR ("Invalid attribute ID %" PRIu8, attr_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[],
lib/eventdev/rte_eventdev.h +37 -1
@@ -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
@@ -678,6 +685,11 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,*/ #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 +/** +* Maximum supported attribute ID. +*/ +#define RTE_EVENT_QUEUE_ATTR_MAX RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE +/** * Get an attribute from a queue. *
@@ -702,6 +714,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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, +uint32_t attr_value); +/* Event port specific APIs */ /* Event port configuration bitmap flags */
lib/eventdev/version.map +3 -0
@@ -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 {
Signature · 1 line
2.25.1
RE: [PATCH 1/6] eventdev: support to set queue attributes at runtime
Quoted 7 lines
-----Original Message-----
From: Shijith Thotton <[email protected]>
Sent: Tuesday, March 29, 2022 2:11 PM
To: [email protected]; [email protected]
Cc: Shijith Thotton <[email protected]>; [email protected]; Ray Kinsella <[email protected]>
Subject: [PATCH 1/6] eventdev: support to set queue attributes at runtime
<snip>
Quoted 9 lines
lib/eventdev/eventdev_pmd.h +9
-0+/** +* 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
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev, · line 362
Quoted 10 lines
lib/eventdev/eventdev_pmd.h +10
-0+* @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, +uint32_t attr_value);
Is using a uint64_t a better type for attr_value? Given there might be more in future, limiting to 32-bits now may cause headaches later, and uint64_t doesn't cost extra?
I think 32-bits of attr_id is enough :)
Same comment on the _get() API in patch 2/6, a uint64_t * would be a better fit there in my opinion.
<snip>
RE: [PATCH 1/6] eventdev: support to set queue attributes at runtime
Quoted 27 lines
<snip>
Quoted 9 lines
lib/eventdev/eventdev_pmd.h +9
-0+/** +* 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 lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev, · line 362
Quoted 10 lines
lib/eventdev/eventdev_pmd.h +10
-0+* @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, +uint32_t attr_value);Is using a
uint64_ta better type forattr_value? Given there might be more in future,
limiting to 32-bits now may cause headaches later, anduint64_tdoesn't cost extra?
Quoted 6 lines
I think 32-bits of
attr_idis enough :)Same comment on the
_get()API in patch 2/6, auint64_t* would be a better fit there in my opinion.<snip>
Changing size of attr_value will an ABI break. Can we wait till a need arises ?
RE: [PATCH 1/6] eventdev: support to set queue attributes at runtime
Quoted 36 lines
-----Original Message-----
From: Shijith Thotton <[email protected]>
Sent: Monday, April 4, 2022 10:36 AM
To: Van Haaren, Harry <[email protected]>; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>
Cc: Pavan Nikhilesh Bhagavatula <[email protected]>; Ray Kinsella <[email protected]>
Subject: RE: [PATCH 1/6] eventdev: support to set queue attributes at runtimeQuoted 27 lines
<snip>
Quoted 9 lines
lib/eventdev/eventdev_pmd.h +9
-0+/** +* 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 lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev, · line 362
Quoted 10 lines
lib/eventdev/eventdev_pmd.h +10
-0+* @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, +uint32_t attr_value);Is using a
uint64_ta better type forattr_value? Given there might be more in future,
limiting to 32-bits now may cause headaches later, anduint64_tdoesn't cost extra?
Quoted 8 lines
Quoted 6 lines
I think 32-bits of
attr_idis enough :)Same comment on the
_get()API in patch 2/6, auint64_t* would be a better fit there in my opinion.<snip>
Changing size of
attr_valuewill an ABI break. Can we wait till a need arises ?
Ah, I forgot that the _get() function is already upstream in DPDK today.
Its actually an API *and* ABI break, which is worse, as user code would have to change (not just a re-compile against the newer DPDK version...). Any application attempting source-compatibility with 21.11 and 22.11 would have to #ifdef the parameter, switching uint32_t* and uint64_t*... or use some magic void* hacks.
Yes I suppose that waiting until a u64 is required for a real-world use-case is probably better than breaking existing users code today (or in next ABI breaking release) with the intent of getting to "perfect" API/ABIs...
Suggest to use a u64 for _set() to avoid getting into this same situation again, but leave _get() as is, until it is required to change for a real use-case?
Re: [PATCH 1/6] eventdev: support to set queue attributes at runtime
In reply to Shijith ThottonQuoted 136 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>--- doc/guides/eventdevs/features/default.ini | 1 + lib/eventdev/eventdev_pmd.h | 22 +++++++++++++ lib/eventdev/rte_eventdev.c | 31 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 38 ++++++++++++++++++++++- lib/eventdev/version.map | 3 ++ 5 files changed, 94 insertions(+), 1 deletion(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.lib/eventdev/eventdev_pmd.h +22
-0@@ -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, +uint32_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. */ lib/eventdev/rte_eventdev.c +31
-0@@ -844,6 +844,37 @@ 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, +uint32_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 (attr_id >RTE_EVENT_QUEUE_ATTR_MAX ) { +RTE_EDEV_LOG_ERR ("Invalid attribute ID %" PRIu8, attr_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[],lib/eventdev/rte_eventdev.h +8
-1@@ -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
lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id, · line 692
Quoted 8 lines
lib/eventdev/rte_eventdev.h +5
-0@@ -678,6 +685,11 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,*/ #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 +/** +* Maximum supported attribute ID. +*/ +#define RTE_EVENT_QUEUE_ATTR_MAX RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE +
This #define will assure that every new attribute breaks the ABI. Is that intentional?
Quoted 48 lines
lib/eventdev/rte_eventdev.h +24
-0/** * Get an attribute from a queue. * @@ -702,6 +714,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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, +uint32_t attr_value); +/* Event port specific APIs */ /* Event port configuration bitmap flags */ lib/eventdev/version.map +3
-0@@ -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 {
RE: [PATCH 1/6] eventdev: support to set queue attributes at runtime
Quoted 151 lines
Quoted 14 lines
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>--- doc/guides/eventdevs/features/default.ini | 1 + lib/eventdev/eventdev_pmd.h | 22 +++++++++++++ lib/eventdev/rte_eventdev.c | 31 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 38 ++++++++++++++++++++++- lib/eventdev/version.map | 3 ++ 5 files changed, 94 insertions(+), 1 deletion(-)Review
Quoted 1 line
(quoted diff) +0
-0b/doc/guides/eventdevs/features/default.ini
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct
Quoted 16 lines
index
2ea233463a..00360f60c6100644doc/guides/eventdevs/features/default.ini +1
-0@@ -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.lib/eventdev/eventdev_pmd.h +0
-0@@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct
rte_eventdev*dev,lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 40 lines
lib/eventdev/eventdev_pmd.h +22
-0typedef 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, +uint32_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. */ lib/eventdev/rte_eventdev.c +0
-0@@ -844,6 +844,37 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,Quoted 15 lines
lib/eventdev/rte_eventdev.c +12
-0return 0 ; } +int +rte_event_queue_attr_set (uint8_t dev_id,uint8_t queue_id,uint32_t attr_id, +uint32_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 ; + }lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 10 lines
lib/eventdev/rte_eventdev.c +10
-0+ +if (attr_id >RTE_EVENT_QUEUE_ATTR_MAX ) { +RTE_EDEV_LOG_ERR ("Invalid attribute ID %" PRIu8, attr_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 queueattributes at runtime",
lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 5 lines
lib/eventdev/rte_eventdev.c +5
-0+ dev_id); +return -ENOTSUP ; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
Quoted 21 lines
lib/eventdev/rte_eventdev.c +4
-0+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[],lib/eventdev/rte_eventdev.h +1
-1@@ -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 lib/eventdev/rte_eventdev.h struct rte_event; · line 311
Quoted 5 lines
lib/eventdev/rte_eventdev.h +2
-0@@ -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
lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t
Quoted 9 lines
lib/eventdev/rte_eventdev.h +5
-0+* 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 @@ -678,6 +685,11 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t
queue_id,lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
Quoted 7 lines
lib/eventdev/rte_eventdev.h +4
-0*/ #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 +/** +* Maximum supported attribute ID. +*/ +#define RTE_EVENT_QUEUE_ATTR_MAX
RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE
Quoted 5 lines
lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t · line 692
Quoted 1 line
lib/eventdev/rte_eventdev.h +1
-0+This #define will assure that every new attribute breaks the ABI. Is that intentional?
Will remove .
Quoted 48 lines
Quoted 48 lines
lib/eventdev/rte_eventdev.h +24
-0/** * Get an attribute from a queue. * @@ -702,6 +714,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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, +uint32_t attr_value); +/* Event port specific APIs */ /* Event port configuration bitmap flags */ lib/eventdev/version.map +3
-0@@ -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 {
PATCH 2/6 eventdev: add weight and affinity to queue attributes
In reply to Shijith ThottonExtended 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.
--- 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(-)
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +12 -0
@@ -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 ; };
lib/eventdev/rte_eventdev.h +37 -4
62 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 2/6] eventdev: add weight and affinity to queue attributes
Quoted 10 lines · Shijith Thotton
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_getcan be used to get it from the PMD.
Have you considered using a PMD-specific command line parameter as a stop-gap until you can extend the config struct?
Quoted 78 lines
Signed-off-by Shijith Thotton <[email protected]>--- 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(-)lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +12
-0@@ -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 ; };lib/eventdev/rte_eventdev.h +0
-0@@ -222,8 +222,14 @@ struct rte_event;/* Event device capability bitmap flags */ #define RTE_EVENT_DEV_CAP_QUEUE_QOS (1ULL << 0)
lib/eventdev/rte_eventdev.h struct rte_event; · line 232
Quoted 10 lines
lib/eventdev/rte_eventdev.h +8
-2-/**< 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.
Is this specifying something else than WRR scheduling for equal-priority queues?
What is a schedule call? I must say I don't understand this description. Is affinity the per-port batch size from the queue that is "next in line" for an opportunity to be scheduled to a port?
Quoted 52 lines
lib/eventdev/rte_eventdev.h +29
-2* * @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.
RE: [PATCH 2/6] eventdev: add weight and affinity to queue attributes
Quoted 102 lines
Quoted 10 lines
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_getcan be used to get it from the PMD.Have you considered using a PMD-specific command line parameter as a stop-gap until you can extend the config struct?
Quoted 5 lines
Signed-off-by Shijith Thotton <[email protected]>--- lib/eventdev/eventdev_pmd.h | 22 ++++++++++++++++++++ lib/eventdev/rte_eventdev.c | 12 +++++++++++ lib/eventdev/rte_eventdev.h | 41 +++++++++++++++++++++++++++++++++----
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct
Quoted 7 lines
3 files changed, 71 insertions(+), 4 deletions(-)lib/eventdev/eventdev_pmd.h +0
-0@@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct
rte_eventdev*dev,lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 40 lines
lib/eventdev/eventdev_pmd.h +22
-0typedef 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. */ lib/eventdev/rte_eventdev.c +0
-0@@ -838,6 +838,18 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,Quoted 23 lines
lib/eventdev/rte_eventdev.c +12
-0*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 ; };lib/eventdev/rte_eventdev.h +0
-0lib/eventdev/rte_eventdev.h struct rte_event; · line 228
Quoted 9 lines
lib/eventdev/rte_eventdev.h +4
-2@@ -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
Quoted 8 lines
lib/eventdev/rte_eventdev.h struct rte_event; · line 232
Quoted 4 lines
lib/eventdev/rte_eventdev.h +4
-0+* 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. Is this specifying something else than WRR scheduling for equal-priority queues?
It is WRR for equal-priority queues. I will update the text as follows. Please check.
/**< 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 used 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 of a queue
* indicates the number of subsequent dequeue calls from an event port which
* should use the same queue if the queue is non-empty.
Quoted 1 line
What is a schedule call? I must say I don't understand this description.
Schedule call indicates a dequeue call. I have updated the text to avoid confusion.
Quoted 3 lines
Is affinity the per-port batch size from the queue that is "next in line" for an opportunity to be scheduled to a port?
Not exactly batch size. It is the number of subsequent dequeue calls which should use the same queue. So the subsequent dequeue calls could return a max of affinity * batch_size number of events from the same queue.
Quoted 54 lines
lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t
Quoted 31 lines
lib/eventdev/rte_eventdev.h +20
-0* * @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,Quoted 6 lines
lib/eventdev/rte_eventdev.h +2
-1* The schedule type of the queue. */ #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 - +/** +* The weight of the queue. lib/eventdev/rte_eventdev.h rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
Quoted 10 lines
lib/eventdev/rte_eventdev.h +6
-1+*/ +#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_TYPEQuoted 5 lines
lib/eventdev/rte_eventdev.h +1
-0+#define RTE_EVENT_QUEUE_ATTR_MAX RTE_EVENT_QUEUE_ATTR_AFFINITY/** * Get an attribute from a queue.
PATCH 3/6 doc: announce change in event queue conf structure
In reply to Shijith ThottonStructure rte_event_queue_conf will be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op, queue_attr_get can be removed.
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11.
Signature · 1 line
2.25.1
PATCH 4/6 test/event: test cases to test runtime queue attribute
In reply to Shijith ThottonAdded test cases to test changing of queue QoS attributes priority, weight and affinity at runtime.
--- app/test/test_eventdev.c | 146 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+)
app/test/test_eventdev.c +146 -0
@@ -385,6 +385,146 @@ test_eventdev_queue_attr_priority(void)return TEST_SUCCESS ; } +static int +test_eventdev_queue_attr_priority_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t attr_val, tmp; + + attr_val = i %RTE_EVENT_DEV_PRIORITY_LOWEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + attr_val), +"Queue priority set failed" ); +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_get (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + &tmp), +"Queue priority get failed" ); +TEST_ASSERT_EQUAL (tmp, attr_val, +"Wrong priority value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_weight_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t attr_val, tmp; + + attr_val = i %RTE_EVENT_QUEUE_WEIGHT_HIGHEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , + attr_val), +"Queue weight set failed" ); +TEST_ASSERT_SUCCESS (rte_event_queue_attr_get ( +TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , &tmp), +"Queue weight get failed" ); +TEST_ASSERT_EQUAL (tmp, attr_val, +"Wrong weight value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_affinity_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t attr_val, tmp; + + attr_val = i %RTE_EVENT_QUEUE_AFFINITY_HIGHEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_AFFINITY , + attr_val), +"Queue affinity set failed" ); +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_get (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_AFFINITY , + &tmp), +"Queue affinity get failed" ); +TEST_ASSERT_EQUAL (tmp, attr_val, +"Wrong affinity value for queue%d" , i); + } + +return TEST_SUCCESS ; +} +static int test_eventdev_queue_attr_nb_atomic_flows (void ) {
@@ -964,6 +1104,12 @@ static struct unit_test_suite eventdev_common_testsuite = { test_eventdev_queue_count),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_priority), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_priority_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_weight_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_affinity_runtime),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_nb_atomic_flows), TEST_CASE_ST(eventdev_configure_setup, NULL,
Signature · 1 line
2.25.1
PATCH 5/6 event/cnxk: support to set runtime queue attributes
In reply to Shijith ThottonAdded API to set queue attributes at runtime and API to get weight and affinity.
--- 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 | 81 ++++++++++++++++++++++++-- drivers/event/cnxk/cnxk_eventdev.h | 16 +++++ 5 files changed, 100 insertions(+), 6 deletions(-)
doc/guides/eventdevs/features/cnxk.ini +1 -0
@@ -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
drivers/event/cnxk/cn10k_eventdev.c +4 -0
@@ -845,9 +845,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,
drivers/event/cnxk/cn9k_eventdev.c +4 -0
@@ -1079,9 +1079,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,
drivers/event/cnxk/cnxk_eventdev.c +75 -6
99 lines not on this page · raw message
drivers/event/cnxk/cnxk_eventdev.h +16 -0
@@ -38,6 +38,9 @@#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 (8) +#define CNXK_SSO_WEIGHT_CNT (64) +#define CNXK_SSO_AFFINITY_CNT (16)#define CNXK_TT_FROM_TAG (x) (((x) >> 32) & SSO_TT_EMPTY)#define CNXK_TT_FROM_EVENT (x) (((x) >> 38) & SSO_TT_EMPTY)
@@ -54,6 +57,7 @@#define CN10K_GW_MODE_PREF 1#define CN10K_GW_MODE_PREF_WFE 2 +#define CNXK_QOS_NORMALIZE (val, max, cnt) (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 +83,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 +117,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 +244,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, +uint32_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,
Signature · 1 line
2.25.1
RE: [PATCH 5/6] event/cnxk: support to set runtime queue attributes
Quoted 6 lines
-----Original Message-----
From: Shijith Thotton <[email protected]>
Sent: Tuesday, March 29, 2022 2:11 PM
To: [email protected]; [email protected]
Cc: Shijith Thotton <[email protected]>; [email protected]
Subject: [PATCH 5/6] event/cnxk: support to set runtime queue attributes
<snip>
drivers/event/cnxk/cnxk_eventdev.c cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id) · line 342
Quoted 10 lines
(quoted diff) +2
-0+int +cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev, uint8_t
queue_id,drivers/event/cnxk/cnxk_eventdev.c +7
-0+ uint32_t attr_id, uint32_t *attr_value) +{ + struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev); + + *attr_value = attr_id ==RTE_EVENT_QUEUE_ATTR_WEIGHT ? + dev->mlt_prio[queue_id].weight : + dev->mlt_prio[queue_id].affinity;
This is future-bug prone, as adding a new Eventdev attr will return .affinity silently, instead of the attr that is being requested.
Prefer a switch(attr_id), and explicitly handle each attr_id, with a default case to return -1, showing the PMD refusing to handle the attr requested to the caller.
On reviewing the below, the set() below does this perfectly... except the return?
Quoted 19 lines
drivers/event/cnxk/cnxk_eventdev.c +6
-0+ +return 0 ; +} + +int +cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t
queue_id,drivers/event/cnxk/cnxk_eventdev.c +12
-0+ uint32_t attr_id, uint32_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 ;
drivers/event/cnxk/cnxk_eventdev.c cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id) · line 370
Quoted 10 lines
drivers/event/cnxk/cnxk_eventdev.c +10
-0+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 ; +default : +plt_sso_dbg ("Ignored setting attribute id %u" , attr_id); +return 0 ; + }
Why return 0 here? This is a failure, the PMD did *not* set the attribute ID. Make the user aware of that fact, return -1; or -EINVAL or something.
Document the explicit return values at Eventdev header level, so all PMDs can align on the return values, providing consistency to the application.
<snip>
RE: [PATCH 5/6] event/cnxk: support to set runtime queue attributes
Quoted 16 lines
<snip>
drivers/event/cnxk/cnxk_eventdev.c cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id) · line 342
Quoted 10 lines
(quoted diff) +2
-0+int +cnxk_sso_queue_attribute_get(struct rte_eventdev *event_dev, uint8_t
queue_id,drivers/event/cnxk/cnxk_eventdev.c +7
-0+ uint32_t attr_id, uint32_t *attr_value) +{ + struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev); + + *attr_value = attr_id ==RTE_EVENT_QUEUE_ATTR_WEIGHT ? + dev->mlt_prio[queue_id].weight : + dev->mlt_prio[queue_id].affinity;This is future-bug prone, as adding a new Eventdev attr will return .affinity silently, instead of the attr that is being requested.
Quoted 3 lines
Prefer a
switch(attr_id), and explicitly handle eachattr_id, with a default case to return -1, showing the PMD refusing to handle the attr requested to the caller.
Will change it similar to set().
Quoted 35 lines
On reviewing the below, the
set()below does this perfectly... except the return?Quoted 19 lines
drivers/event/cnxk/cnxk_eventdev.c +6
-0+ +return 0 ; +} + +int +cnxk_sso_queue_attribute_set(struct rte_eventdev *event_dev, uint8_t
queue_id,drivers/event/cnxk/cnxk_eventdev.c +12
-0+ uint32_t attr_id, uint32_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 ;drivers/event/cnxk/cnxk_eventdev.c cnxk_sso_queue_release(struct rte_eventdev *event_dev, uint8_t queue_id) · line 370
Quoted 10 lines
drivers/event/cnxk/cnxk_eventdev.c +10
-0+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 ; +default : +plt_sso_dbg ("Ignored setting attribute id %u" , attr_id); +return 0 ; + }Why return 0 here? This is a failure, the PMD did *not* set the attribute ID. Make the user aware of that fact, return -1; or
-EINVALor something.
Quoted 3 lines
Document the explicit return values at Eventdev header level, so all PMDs can align on the return values, providing consistency to the application.
Will update PMD and library with error number.
Quoted 1 line
<snip>
PATCH 6/6 common/cnxk: use lock when accessing mbox of SSO
In reply to Shijith ThottonFrom: Pavan Nikhilesh <[email protected]>
Since mbox is now accessed from multiple threads, use lock to synchronize access.
--- drivers/common/cnxk/roc_sso.c | 174 +++++++++++++++++++++-------- drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++++++-------- 3 files changed, 215 insertions(+), 94 deletions(-)
drivers/common/cnxk/roc_sso.c +125 -49
@@ -36,8 +36,8 @@ sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf, } rc =mbox_process_msg (dev->mbox, rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -69,8 +69,8 @@ sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf) } rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -98,7 +98,7 @@ sso_rsrc_attach(struct roc_sso *roc_sso, enum sso_lf_type lf_type, } req->modify = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -126,7 +126,7 @@ sso_rsrc_detach(struct roc_sso *roc_sso, enum sso_lf_type lf_type) } req->partial = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -141,9 +141,9 @@ sso_rsrc_get(struct roc_sso *roc_sso)mbox_alloc_msg_free_rsrc_cnt (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsrc_cnt); -if (rc <0 ) { +if (rc) {plt_err ("Failed to get free resource count\n" ); -return rc; +return -EIO ; } roc_sso->max_hwgrp = rsrc_cnt->sso;
@@ -197,8 +197,8 @@ sso_msix_fill(struct roc_sso *roc_sso, uint16_t nb_hws, uint16_t nb_hwgrp)mbox_alloc_msg_msix_offset (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;for (i =0 ; i < nb_hws; i++) sso->hws_msix_offset[i] = rsp->ssow_msixoff[i];
@@ -285,53 +285,71 @@ int roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws, struct roc_sso_hws_stats *stats) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso);struct sso_hws_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->hws = hws; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->arbitration = req_rsp->arbitration; -return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_stats_get (struct roc_sso *roc_sso,uint8_t hwgrp,struct roc_sso_hwgrp_stats *stats) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso);struct sso_grp_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->grp = hwgrp; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->aw_status = req_rsp->aw_status; stats->dq_pc = req_rsp->dq_pc;
@@ -341,7 +359,10 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp, stats->ts_pc = req_rsp->ts_pc; stats->wa_pc = req_rsp->wa_pc; stats->ws_pc = req_rsp->ws_pc; -return 0 ; + +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -358,10 +379,12 @@ int roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, uint8_t nb_qos, uint32_t nb_xaq) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_qos_cfg *req;int i, rc; +plt_spinlock_lock (&sso->mbox_lock);for (i =0 ; i < nb_qos; i++) {uint8_t xaq_prcnt = qos[i].xaq_prcnt;uint8_t iaq_prcnt = qos[i].iaq_prcnt;
@@ -370,11 +393,16 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox);if (req ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); -if (req ==NULL ) -return -ENOSPC ; +if (req ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req->grp = qos[i].hwgrp; req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt :100 )) /100 ;
@@ -386,7 +414,12 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,100 ; } -return mbox_process (dev->mbox); + rc =mbox_process (dev->mbox); +if (rc) + rc = -EIO ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -482,11 +515,16 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_init_xaq_aura (struct roc_sso *roc_sso,uint32_t nb_xae) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, - roc_sso->xae_waes, roc_sso->xaq_buf_size, - roc_sso->nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, + roc_sso->xae_waes, roc_sso->xaq_buf_size, + roc_sso->nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -515,9 +553,14 @@ sso_hwgrp_free_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_free_xaq_aura (struct roc_sso *roc_sso,uint16_t nb_hwgrp) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -533,16 +576,24 @@ sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps) req->npa_aura_id = npa_aura_id; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_alloc_xaq (struct roc_sso *roc_sso,uint32_t npa_aura_id,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -555,40 +606,56 @@ sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)return -EINVAL ; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_release_xaq (struct roc_sso *roc_sso,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_set_priority (struct roc_sso *roc_sso,uint16_t hwgrp,uint8_t weight,uint8_t affinity,uint8_t priority) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_priority *req;int rc = -ENOSPC ; +plt_spinlock_lock (&sso->mbox_lock); req =mbox_alloc_msg_sso_grp_set_priority (dev->mbox);if (req ==NULL ) -return rc; + goto fail; req->grp = hwgrp; req->weight = weight; req->affinity = affinity; req->priority = priority; rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } +plt_spinlock_unlock (&sso->mbox_lock);plt_sso_dbg ("HWGRP %d weight %d affinity %d priority %d" , hwgrp, weight, affinity, priority);return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -603,10 +670,11 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)if (roc_sso->max_hws < nb_hws)return -ENOENT ; +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWS , nb_hws);if (rc <0 ) {plt_err ("Unable to attach SSO HWS LFs" ); -return rc; + goto fail; } rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWGRP , nb_hwgrp);
@@ -645,6 +713,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } +plt_spinlock_unlock (&sso->mbox_lock); roc_sso->nb_hwgrp = nb_hwgrp; roc_sso->nb_hws = nb_hws;
@@ -657,6 +726,8 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWGRP ); hwgrp_atch_fail:sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWS ); +fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
@@ -678,6 +749,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso) roc_sso->nb_hwgrp =0 ; roc_sso->nb_hws =0 ; +plt_spinlock_unlock (&sso->mbox_lock); }int
@@ -696,6 +768,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso =roc_sso_to_sso_priv (roc_sso);memset (sso,0 ,sizeof (*sso)); pci_dev = roc_sso->pci_dev; +plt_spinlock_init (&sso->mbox_lock); rc =dev_init (&sso->dev, pci_dev);if (rc <0 ) {
@@ -703,6 +776,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) goto fail; } +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_get (roc_sso);if (rc <0 ) {plt_err ("Failed to get SSO resources" );
@@ -739,6 +813,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso->pci_dev = pci_dev; sso->dev.drv_inited = true; roc_sso->lmt_base = sso->dev.lmt_base; +plt_spinlock_unlock (&sso->mbox_lock);return 0 ; link_mem_free:
@@ -746,6 +821,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) rsrc_fail: rc |=dev_fini (&sso->dev, pci_dev); fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
drivers/common/cnxk/roc_sso_priv.h +1 -0
@@ -22,6 +22,7 @@ struct sso {/* SSO link mapping. */ struct plt_bitmap **link_map;void *link_map_mem; +plt_spinlock_t mbox_lock; } __plt_cache_aligned;enum sso_err_status {
drivers/common/cnxk/roc_tim.c +89 -45
318 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 7 lines · Shijith Thotton
This series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability
RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTRis added to expose the capability to set attributes at runtime andrte_event_queue_attr_set()API is used to set the attributes.
Quoted 6 lines
Attributes weight and affinity are not yet added to
rte_event_queue_confstructure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.Test application changes and example implementation are added as last three patches.
+ @Van Haaren, Harry @Jayatheerthan, Jay @Erik Gabriel Carrillo @Gujjar, Abhinandan S @McDaniel, Timothy @Hemant Agrawal @Nipun Gupta @Mattias Rönnblom @lingma @Ray Kinsella
Quoted 30 lines
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSOShijith Thotton (5):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes
doc: announce change in event queue conf structure test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributesapp/test/test_eventdev.c | 146 ++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/deprecation.rst | 3 + drivers/common/cnxk/roc_sso.c | 174 ++++++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 +++++++++++------ drivers/event/cnxk/cn10k_eventdev.c | 4 + drivers/event/cnxk/cn9k_eventdev.c | 4 + drivers/event/cnxk/cnxk_eventdev.c | 81 +++++++++- drivers/event/cnxk/cnxk_eventdev.h | 16 ++ lib/eventdev/eventdev_pmd.h | 44 ++++++ lib/eventdev/rte_eventdev.c | 43 ++++++ lib/eventdev/rte_eventdev.h | 75 +++++++++- lib/eventdev/version.map | 3 + 15 files changed, 627 insertions(+), 103 deletions(-)--
2.25.1
Quoted 14 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, March 29, 2022 7:50 PM
To: Shijith Thotton <[email protected]>; Van Haaren, Harry <[email protected]>; Jayatheerthan, Jay <[email protected]>; Carrillo, Erik G <[email protected]>; Gujjar, Abhinandan S <[email protected]>; McDaniel, Timothy <[email protected]>; Hemant Agrawal <[email protected]>; Nipun Gupta <[email protected]>; mattias.ronnblom <[email protected]>; Ray Kinsella <[email protected]>
Cc: dpdk-dev <[email protected]>; Jerin Jacob <[email protected]>; Pavan Nikhilesh <[email protected]>; Liang Ma <[email protected]>
Subject: Re: [PATCH 0/6] Extend and set event queue attributes at runtime
Quoted 12 lines
Quoted 4 lines · Shijith Thotton
This series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability
RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTRis added to exposethe
Quoted 6 lines
capability to set attributes at runtime and
rte_event_queue_attr_set()API is used to set the attributes.Attributes weight and affinity are not yet added to
rte_event_queue_confstructure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
When the new attributes are added to queue_conf structure in 22.11, will the attr_get() function have any real use?
If the attr_get() function is not useful post 22.11 (aka, returns const-integers?), we should consider if waiting for ABI-break in 22.11 is a better solution as it doesn't add public API/ABI functions that only have limited time value..?
<snip>
Quoted 3 lines
+ @Van Haaren, Harry @Jayatheerthan, Jay @Erik Gabriel Carrillo @Gujjar, Abhinandan S @McDaniel, Timothy @Hemant Agrawal @Nipun Gupta @Mattias Rönnblom @lingma @Ray Kinsella
Thanks for flagging Jerin, indeed I hadn't looked at this patchset yet.
From event/sw point of view, the new runtime queue attribute capability is not available, so the feature flag will not be set.
<snip>
Some code comments inline on the impl patches comping up. Regards, -Harry
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
This series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability
RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTRis added to exposethe
Quoted 6 lines
capability to set attributes at runtime and
rte_event_queue_attr_set()API is used to set the attributes.Attributes weight and affinity are not yet added to
rte_event_queue_confstructure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Quoted 8 lines
When the new attributes are added to
queue_confstructure in 22.11, will theattr_get()function have any real use?If the
attr_get()function is not useful post 22.11 (aka, returns const-integers?), we should consider if waiting
for ABI-break in 22.11 is a better solution as it doesn't add public API/ABI functions that only have limited time value..?
queue_attr_get is an internal op and is not called if the op is not set by the PMD. So no changes are needed from other PMDs to incorporate this. It is useful to the PMDs needing the new attributes before they are added to rte_event_queue_conf struct in 22.11.
Quoted 14 lines
<snip>
Quoted 3 lines
+ @Van Haaren, Harry @Jayatheerthan, Jay @Erik Gabriel Carrillo @Gujjar, Abhinandan S @McDaniel, Timothy @Hemant Agrawal @Nipun Gupta @Mattias Rönnblom @lingma @Ray Kinsella
Thanks for flagging Jerin, indeed I hadn't looked at this patchset yet.
From event/sw point of view, the new runtime queue attribute capability is not available, so the feature flag will not be set.
<snip>
Some code comments inline on the impl patches comping up. Regards, -Harry
v2 cover Extend and set event queue attributes at runtime
In reply to Shijith ThottonThis series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR is added to expose the capability to set attributes at runtime and rte_event_queue_attr_set() API is used to set the attributes.
Attributes weight and affinity are not yet added to rte_event_queue_conf structure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Test application changes and example implementation are added as last three patches.
v2:
* Modified attr_value type from u32 to u64 for set().
* Removed RTE_EVENT_QUEUE_ATTR_MAX macro.
* Fixed return value in implementation.
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSO
Shijith Thotton (5):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes
doc: announce change in event queue conf structure test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributes
app/test/test_eventdev.c | 149 ++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/deprecation.rst | 3 + drivers/common/cnxk/roc_sso.c | 174 ++++++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 +++++++++++------ 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 | 16 ++ lib/eventdev/eventdev_pmd.h | 44 ++++++ lib/eventdev/rte_eventdev.c | 38 +++++ lib/eventdev/rte_eventdev.h | 71 ++++++++- lib/eventdev/version.map | 3 + 15 files changed, 631 insertions(+), 103 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/6 eventdev: support to set queue attributes at runtime
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.
--- doc/guides/eventdevs/features/default.ini | 1 + lib/eventdev/eventdev_pmd.h | 22 +++++++++++++++ lib/eventdev/rte_eventdev.c | 26 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 5 files changed, 84 insertions(+), 1 deletion(-)
doc/guides/eventdevs/features/default.ini +1 -0
@@ -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.
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +26 -0
@@ -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[],
lib/eventdev/rte_eventdev.h +32 -1
@@ -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,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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 */
lib/eventdev/version.map +3 -0
@@ -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 {
Signature · 1 line
2.25.1
Re: [PATCH v2 1/6] eventdev: support to set queue attributes at runtime
Quoted 7 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>
Please update release notes.
With the above change,
Quoted 172 lines
--- doc/guides/eventdevs/features/default.ini | 1 + lib/eventdev/eventdev_pmd.h | 22 +++++++++++++++ lib/eventdev/rte_eventdev.c | 26 ++++++++++++++++++ lib/eventdev/rte_eventdev.h | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 5 files changed, 84 insertions(+), 1 deletion(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +26
-0@@ -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[],lib/eventdev/rte_eventdev.h +32
-1@@ -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,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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 */ lib/eventdev/version.map +3
-1@@ -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 { --2.25.1
PATCH v2 2/6 eventdev: add weight and affinity to queue attributes
In reply to Shijith ThottonExtended 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.
--- 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(-)
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +12 -0
@@ -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 ; };
lib/eventdev/rte_eventdev.h +36 -2
@@ -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.
Signature · 1 line
2.25.1
Re: [PATCH v2 2/6] eventdev: add weight and affinity to queue attributes
Quoted 3 lines · Shijith Thotton
Extended eventdev queue QoS attributes to support weight and affinity. If queues are of same priority, events from the queue with highest
the same priority
Quoted 7 lines
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
rely on
Quoted 3 lines
op
queue_attr_getcan be used to get it from the PMD.Signed-off-by Shijith Thotton <[email protected]>
Please update the release notes.
With above change,
Quoted 135 lines
--- 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(-)lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +12
-0@@ -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 ; };lib/eventdev/rte_eventdev.h +36
-3@@ -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. -- 2.25.1
PATCH v2 3/6 doc: announce change in event queue conf structure
In reply to Shijith ThottonStructure rte_event_queue_conf will be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op, queue_attr_get can be removed.
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11.
Signature · 1 line
2.25.1
Re: [PATCH v2 3/6] doc: announce change in event queue conf structure
Quoted 6 lines · Shijith Thotton
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.Signed-off-by Shijith Thotton <[email protected]>
Please remove the deprecation notice patch from this series and send it as a separate patch.
Quoted 18 lines
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)doc/guides/rel_notes/deprecation.rst +3
-1@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11. --2.25.1
PATCH v3 1/1 doc: announce change in event queue conf structure
In reply to Shijith ThottonStructure rte_event_queue_conf will be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op, queue_attr_get can be removed.
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11.
Signature · 1 line
2.25.1
Re: [PATCH v3] doc: announce change in event queue conf structure
Quoted 6 lines · Shijith Thotton
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.Signed-off-by Shijith Thotton <[email protected]>
@Van Haaren, Harry @Mattias Rönnblom @Ray Kinsella @Pavan Nikhilesh Please Ack if you are OK.
Quoted 18 lines
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)doc/guides/rel_notes/deprecation.rst +3
-1@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11. --2.25.1
Pavan Nikhilesh Bhagavatula
Acked-byRE: [EXT] Re: [PATCH v3] doc: announce change in event queue conf structure
+Cc
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
[email protected];
Quoted 18 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, July 12, 2022 7:35 PM
To: Shijith Thotton <[email protected]>
Cc: dpdk-dev <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Van Haaren, Harry <[email protected]>; Mattias Rönnblom <[email protected]>; Ray Kinsella <[email protected]>
Subject: [EXT] Re: [PATCH v3] doc: announce change in event queue conf structureExternal Email
----------------------------------------------------------------------
Quoted 1 line · Shijith Thotton
Quoted 8 lines
Quoted 5 lines
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>
Quoted 23 lines
@Van Haaren, Harry @Mattias Rönnblom @Ray Kinsella @Pavan Nikhilesh Please Ack if you are OK.
Review
Quoted 5 lines
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/doc/guides/rel_notes/deprecation.rstdoc/guides/rel_notes/deprecation.rst Deprecation Notices · line 129
Quoted 9 lines
index
4e5b23c53d..04125db681100644doc/guides/rel_notes/deprecation.rst +2
-0@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity willbe
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +1
-1+ added to ``rte_event_queue_conf`` structure in DPDK 22.11. --2.25.1
Mattias Rönnblom
Acked-byRe: [PATCH v3] doc: announce change in event queue conf structure
In reply to Jerin JacobQuoted 6 lines · Jerin Jacob
Quoted 5 lines · Shijith Thotton
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.
Quoted 8 lines
Quoted 1 line
Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>@Van Haaren, Harry @Mattias Rönnblom @Ray Kinsella @Pavan Nikhilesh Please Ack if you are OK.
Will there be new capabilities to go with those new fields? To let the application know if they will be honored, or not.
Quoted 18 lines
Quoted 18 lines
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)doc/guides/rel_notes/deprecation.rst +3
-1@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinity will be + added to ``rte_event_queue_conf`` structure in DPDK 22.11. --2.25.1
RE: [PATCH v3] doc: announce change in event queue conf structure
Quoted 13 lines · Jerin Jacob
Quoted 1 line
On Sun, May 15, 2022 at 3:56 PM Shijith Thotton <[email protected]>
Quoted 10 lines · wrote:
Quoted 6 lines
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>
Quoted 8 lines
Quoted 1 line
@Van Haaren, Harry @Mattias Rönnblom @Ray Kinsella @Pavan
Nikhilesh
Quoted 2 lines
Please Ack if you are OK.
Will there be new capabilities to go with those new fields? To let the application know if they will be honored, or not.
I think this capability got covered underRTE_EVENT_DEV_CAP_QUEUE_QOS.
Quoted 22 lines
Acked-by Mattias Rönnblom <[email protected]>Quoted 5 lines
Review
Quoted 5 lines
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/doc/guides/rel_notes/deprecation.rstQuoted 9 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 129
Quoted 9 lines
index
4e5b23c53d..04125db681100644doc/guides/rel_notes/deprecation.rst +2
-0@@ -125,3 +125,6 @@ Deprecation Notices applications should be updated to use the ``dmadev`` library instead, with the underlying HW-functionality being provided by the ``ioat`` or ``idxd`` dma drivers + +* eventdev: New fields to represent event queue weight and affinitywill be
Quoted 4 lines
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +1
-1+ added to ``rte_event_queue_conf`` structure in DPDK 22.11. --2.25.1
Re: [PATCH v3] doc: announce change in event queue conf structure
In reply to Shijith Thotton15/05/2022 12:24, Shijith Thotton:
Quoted 5 lines
Structure
rte_event_queue_confwill be extended to include fields to support weight and affinity attribute. Once it gets added in DPDK 22.11, eventdev internal op,queue_attr_getcan be removed.Signed-off-by Shijith Thotton <[email protected]>
There's not enough non-Marvell interested parties. But I judge it non-controversial, so Applied, thanks.
PATCH v2 4/6 test/event: test cases to test runtime queue attribute
In reply to Shijith ThottonAdded test cases to test changing of queue QoS attributes priority, weight and affinity at runtime.
--- app/test/test_eventdev.c | 149 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+)
app/test/test_eventdev.c +149 -0
@@ -385,6 +385,149 @@ test_eventdev_queue_attr_priority(void)return TEST_SUCCESS ; } +static int +test_eventdev_queue_attr_priority_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_DEV_PRIORITY_LOWEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + set_val), +"Queue priority set failed" ); +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_get (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + &get_val), +"Queue priority get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong priority value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_weight_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_WEIGHT_HIGHEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , + set_val), +"Queue weight set failed" ); +TEST_ASSERT_SUCCESS (rte_event_queue_attr_get ( +TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , &get_val), +"Queue weight get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong weight value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_affinity_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_AFFINITY_HIGHEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_AFFINITY , + set_val), +"Queue affinity set failed" ); +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_get (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_AFFINITY , + &get_val), +"Queue affinity get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong affinity value for queue%d" , i); + } + +return TEST_SUCCESS ; +} +static int test_eventdev_queue_attr_nb_atomic_flows (void ) {
@@ -964,6 +1107,12 @@ static struct unit_test_suite eventdev_common_testsuite = { test_eventdev_queue_count),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_priority), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_priority_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_weight_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_affinity_runtime),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_nb_atomic_flows), TEST_CASE_ST(eventdev_configure_setup, NULL,
Signature · 1 line
2.25.1
Re: [PATCH v2 4/6] test/event: test cases to test runtime queue attribute
Quoted 27 lines · Shijith Thotton
Added test cases to test changing of queue QoS attributes priority, weight and affinity at runtime.
Signed-off-by Shijith Thotton <[email protected]>--- app/test/test_eventdev.c | 149 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+)app/test/test_eventdev.c +10
-0@@ -385,6 +385,149 @@ test_eventdev_queue_attr_priority(void)return TEST_SUCCESS ; } +static int +test_eventdev_queue_attr_priority_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" );
app/test/test_eventdev.c test_eventdev_queue_attr_priority(void) · line 407
Quoted 10 lines
app/test/test_eventdev.c +10
-0+ +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + + set_val = i %RTE_EVENT_DEV_PRIORITY_LOWEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + set_val), +"Queue priority set failed" );
If the return code is -ENOSUP, Please mark the test as TEST_SKIPPED
Quoted 38 lines
app/test/test_eventdev.c +38
-0+TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_get (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + &get_val), +"Queue priority get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong priority value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_weight_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } +
app/test/test_eventdev.c test_eventdev_queue_attr_priority(void) · line 471
Quoted 10 lines
app/test/test_eventdev.c +10
-0+for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_WEIGHT_HIGHEST ; +TEST_ASSERT_SUCCESS ( +rte_event_queue_attr_set (TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , + set_val), +"Queue weight set failed" );
If the return code is -ENOSUP, Please mark the test as TEST_SKIPPED
Quoted 4 lines
app/test/test_eventdev.c +4
-0+TEST_ASSERT_SUCCESS (rte_event_queue_attr_get ( +TEST_DEV_ID , i, +RTE_EVENT_QUEUE_ATTR_WEIGHT , &get_val), +"Queue weight get failed" );
app/test/test_eventdev.c test_eventdev_queue_attr_priority(void) · line 485
Quoted 10 lines
app/test/test_eventdev.c +10
-0+TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong weight value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_affinity_runtime (void ) +{
Please use rte_event_dequeue_burst() to get APIs to test the full functionality to validate the
feature for both priority and affinity test cases.
PATCH v2 5/6 event/cnxk: support to set runtime queue attributes
In reply to Shijith ThottonAdded API to set queue attributes at runtime and API to get weight and affinity.
--- 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 | 16 +++++ 5 files changed, 110 insertions(+), 6 deletions(-)
doc/guides/eventdevs/features/cnxk.ini +1 -0
@@ -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
drivers/event/cnxk/cn10k_eventdev.c +4 -0
@@ -845,9 +845,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,
drivers/event/cnxk/cn9k_eventdev.c +4 -0
@@ -1079,9 +1079,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,
drivers/event/cnxk/cnxk_eventdev.c +85 -6
109 lines not on this page · raw message
drivers/event/cnxk/cnxk_eventdev.h +16 -0
@@ -38,6 +38,9 @@#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 (8) +#define CNXK_SSO_WEIGHT_CNT (64) +#define CNXK_SSO_AFFINITY_CNT (16)#define CNXK_TT_FROM_TAG (x) (((x) >> 32) & SSO_TT_EMPTY)#define CNXK_TT_FROM_EVENT (x) (((x) >> 38) & SSO_TT_EMPTY)
@@ -54,6 +57,7 @@#define CN10K_GW_MODE_PREF 1#define CN10K_GW_MODE_PREF_WFE 2 +#define CNXK_QOS_NORMALIZE (val, max, cnt) (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 +83,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 +117,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 +244,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,
Signature · 1 line
2.25.1
Re: [PATCH v2 5/6] event/cnxk: support to set runtime queue attributes
Quoted 31 lines · Shijith Thotton
Added API to set queue attributes at runtime and API to get weight and affinity.
Signed-off-by Shijith Thotton <[email protected]>--- 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 | 16 +++++ 5 files changed, 110 insertions(+), 6 deletions(-)doc/guides/eventdevs/features/cnxk.ini +2
-0@@ -12,6 +12,7 @@ runtime_port_link = Y multiple_queue_port = Y carry_flow_id = Y maintenance_free = Y +runtime_queue_attr = y + .port_def_conf = cnxk_sso_port_def_conf, .port_setup = cn9k_sso_port_setup, .port_release = cn9k_sso_port_release,drivers/event/cnxk/cnxk_eventdev.c +0
-0
drivers/event/cnxk/cnxk_eventdev.c cnxk_sso_info_get(struct cnxk_sso_evdev *dev, · line 124
Quoted 6 lines
drivers/event/cnxk/cnxk_eventdev.c +2
-1@@ -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 ;
Please swap 6/6 and 5/6 as to avoid the runtime failure at this point.
PATCH v2 6/6 common/cnxk: use lock when accessing mbox of SSO
In reply to Shijith ThottonFrom: Pavan Nikhilesh <[email protected]>
Since mbox is now accessed from multiple threads, use lock to synchronize access.
--- drivers/common/cnxk/roc_sso.c | 174 +++++++++++++++++++++-------- drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++++++-------- 3 files changed, 215 insertions(+), 94 deletions(-)
drivers/common/cnxk/roc_sso.c +125 -49
@@ -36,8 +36,8 @@ sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf, } rc =mbox_process_msg (dev->mbox, rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -69,8 +69,8 @@ sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf) } rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -98,7 +98,7 @@ sso_rsrc_attach(struct roc_sso *roc_sso, enum sso_lf_type lf_type, } req->modify = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -126,7 +126,7 @@ sso_rsrc_detach(struct roc_sso *roc_sso, enum sso_lf_type lf_type) } req->partial = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -141,9 +141,9 @@ sso_rsrc_get(struct roc_sso *roc_sso)mbox_alloc_msg_free_rsrc_cnt (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsrc_cnt); -if (rc <0 ) { +if (rc) {plt_err ("Failed to get free resource count\n" ); -return rc; +return -EIO ; } roc_sso->max_hwgrp = rsrc_cnt->sso;
@@ -197,8 +197,8 @@ sso_msix_fill(struct roc_sso *roc_sso, uint16_t nb_hws, uint16_t nb_hwgrp)mbox_alloc_msg_msix_offset (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;for (i =0 ; i < nb_hws; i++) sso->hws_msix_offset[i] = rsp->ssow_msixoff[i];
@@ -285,53 +285,71 @@ int roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws, struct roc_sso_hws_stats *stats) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso);struct sso_hws_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->hws = hws; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->arbitration = req_rsp->arbitration; -return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_stats_get (struct roc_sso *roc_sso,uint8_t hwgrp,struct roc_sso_hwgrp_stats *stats) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso);struct sso_grp_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->grp = hwgrp; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->aw_status = req_rsp->aw_status; stats->dq_pc = req_rsp->dq_pc;
@@ -341,7 +359,10 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp, stats->ts_pc = req_rsp->ts_pc; stats->wa_pc = req_rsp->wa_pc; stats->ws_pc = req_rsp->ws_pc; -return 0 ; + +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -358,10 +379,12 @@ int roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, uint8_t nb_qos, uint32_t nb_xaq) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_qos_cfg *req;int i, rc; +plt_spinlock_lock (&sso->mbox_lock);for (i =0 ; i < nb_qos; i++) {uint8_t xaq_prcnt = qos[i].xaq_prcnt;uint8_t iaq_prcnt = qos[i].iaq_prcnt;
@@ -370,11 +393,16 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox);if (req ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); -if (req ==NULL ) -return -ENOSPC ; +if (req ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req->grp = qos[i].hwgrp; req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt :100 )) /100 ;
@@ -386,7 +414,12 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,100 ; } -return mbox_process (dev->mbox); + rc =mbox_process (dev->mbox); +if (rc) + rc = -EIO ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -482,11 +515,16 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_init_xaq_aura (struct roc_sso *roc_sso,uint32_t nb_xae) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, - roc_sso->xae_waes, roc_sso->xaq_buf_size, - roc_sso->nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, + roc_sso->xae_waes, roc_sso->xaq_buf_size, + roc_sso->nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -515,9 +553,14 @@ sso_hwgrp_free_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_free_xaq_aura (struct roc_sso *roc_sso,uint16_t nb_hwgrp) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -533,16 +576,24 @@ sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps) req->npa_aura_id = npa_aura_id; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_alloc_xaq (struct roc_sso *roc_sso,uint32_t npa_aura_id,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -555,40 +606,56 @@ sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)return -EINVAL ; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_release_xaq (struct roc_sso *roc_sso,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_set_priority (struct roc_sso *roc_sso,uint16_t hwgrp,uint8_t weight,uint8_t affinity,uint8_t priority) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_priority *req;int rc = -ENOSPC ; +plt_spinlock_lock (&sso->mbox_lock); req =mbox_alloc_msg_sso_grp_set_priority (dev->mbox);if (req ==NULL ) -return rc; + goto fail; req->grp = hwgrp; req->weight = weight; req->affinity = affinity; req->priority = priority; rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } +plt_spinlock_unlock (&sso->mbox_lock);plt_sso_dbg ("HWGRP %d weight %d affinity %d priority %d" , hwgrp, weight, affinity, priority);return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -603,10 +670,11 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)if (roc_sso->max_hws < nb_hws)return -ENOENT ; +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWS , nb_hws);if (rc <0 ) {plt_err ("Unable to attach SSO HWS LFs" ); -return rc; + goto fail; } rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWGRP , nb_hwgrp);
@@ -645,6 +713,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } +plt_spinlock_unlock (&sso->mbox_lock); roc_sso->nb_hwgrp = nb_hwgrp; roc_sso->nb_hws = nb_hws;
@@ -657,6 +726,8 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWGRP ); hwgrp_atch_fail:sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWS ); +fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
@@ -678,6 +749,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso) roc_sso->nb_hwgrp =0 ; roc_sso->nb_hws =0 ; +plt_spinlock_unlock (&sso->mbox_lock); }int
@@ -696,6 +768,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso =roc_sso_to_sso_priv (roc_sso);memset (sso,0 ,sizeof (*sso)); pci_dev = roc_sso->pci_dev; +plt_spinlock_init (&sso->mbox_lock); rc =dev_init (&sso->dev, pci_dev);if (rc <0 ) {
@@ -703,6 +776,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) goto fail; } +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_get (roc_sso);if (rc <0 ) {plt_err ("Failed to get SSO resources" );
@@ -739,6 +813,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso->pci_dev = pci_dev; sso->dev.drv_inited = true; roc_sso->lmt_base = sso->dev.lmt_base; +plt_spinlock_unlock (&sso->mbox_lock);return 0 ; link_mem_free:
@@ -746,6 +821,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) rsrc_fail: rc |=dev_fini (&sso->dev, pci_dev); fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
drivers/common/cnxk/roc_sso_priv.h +1 -0
@@ -22,6 +22,7 @@ struct sso {/* SSO link mapping. */ struct plt_bitmap **link_map;void *link_map_mem; +plt_spinlock_t mbox_lock; } __plt_cache_aligned;enum sso_err_status {
drivers/common/cnxk/roc_tim.c +89 -45
318 lines not on this page · raw message
Signature · 1 line
2.25.1
Please review and let me know if any comments.
________________________________
From: Shijith Thotton <[email protected]>
Sent: Tuesday, April 5, 2022 11:10 AM
To: [email protected] <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>
Cc: Shijith Thotton <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH v2 0/6] Extend and set event queue attributes at runtime
This series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR is added to expose the capability to set attributes at runtime and rte_event_queue_attr_set() API is used to set the attributes.
Attributes weight and affinity are not yet added to rte_event_queue_conf structure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Test application changes and example implementation are added as last three patches.
v2:
* Modified attr_value type from u32 to u64 for set().
* Removed RTE_EVENT_QUEUE_ATTR_MAX macro.
* Fixed return value in implementation.
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSO
Shijith Thotton (5):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes
doc: announce change in event queue conf structure test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributes
app/test/test_eventdev.c | 149 ++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/deprecation.rst | 3 + drivers/common/cnxk/roc_sso.c | 174 ++++++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 +++++++++++------ 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 | 16 ++ lib/eventdev/eventdev_pmd.h | 44 ++++++ lib/eventdev/rte_eventdev.c | 38 +++++ lib/eventdev/rte_eventdev.h | 71 ++++++++- lib/eventdev/version.map | 3 + 15 files changed, 631 insertions(+), 103 deletions(-)
--
2.25.1
v3 cover Extend and set event queue attributes at runtime
In reply to Shijith ThottonThis series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR is added to expose the capability to set attributes at runtime and rte_event_queue_attr_set() API is used to set the attributes.
Attributes weight and affinity are not yet added to rte_event_queue_conf structure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Test application changes and example implementation are added as last three patches.
v3:
* Updated release notes.
* Removed deprecation patch from series.
* Used event enq/deq to test queue priority.
v2:
* Modified attr_value type from u32 to u64 for set().
* Removed RTE_EVENT_QUEUE_ATTR_MAX macro.
* Fixed return value in implementation.
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSO
Shijith Thotton (4):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributes
app/test/test_eventdev.c | 201 ++++++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 12 ++ drivers/common/cnxk/roc_sso.c | 174 +++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++----- 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 ++ lib/eventdev/eventdev_pmd.h | 44 +++++ lib/eventdev/rte_eventdev.c | 38 ++++ lib/eventdev/rte_eventdev.h | 71 +++++++- lib/eventdev/version.map | 3 + 15 files changed, 695 insertions(+), 103 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/5 eventdev: support to set queue attributes at runtime
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.
--- 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 | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 89 insertions(+), 1 deletion(-)
doc/guides/eventdevs/features/default.ini +1 -0
@@ -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.
doc/guides/rel_notes/release_22_07.rst +5 -0
@@ -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 -------------
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +26 -0
@@ -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[],
lib/eventdev/rte_eventdev.h +32 -1
@@ -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,30 @@ 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 event attribute. +* - -EBUSY: device is in running state +* - <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 */
lib/eventdev/version.map +3 -0
@@ -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 {
Signature · 1 line
2.25.1
Re: [PATCH v3 1/5] eventdev: support to set queue attributes at runtime
Quoted 159 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>--- 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 | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 89 insertions(+), 1 deletion(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.doc/guides/rel_notes/release_22_07.rst +5
-0@@ -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 -------------lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +26
-0@@ -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[],lib/eventdev/rte_eventdev.h +15
-1@@ -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,30 @@ 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
lib/eventdev/rte_eventdev.h int · line 728
Quoted 10 lines
lib/eventdev/rte_eventdev.h +10
-0+* @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 event attribute. +* - -EBUSY: device is in running state
I thought the point of this new interface was to allow setting queue attributes when the event device was running?
It would be useful for the caller to be able to distinguish between "busy, but please try again later", and "busy, forever". Maybe the latter is what's meant here? In that case, what is the difference with EBUSY and ENOTSUP?
Quoted 24 lines
lib/eventdev/rte_eventdev.h +7
-0+* - <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 */ lib/eventdev/version.map +3
-0@@ -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 {
RE: [PATCH v3 1/5] eventdev: support to set queue attributes at runtime
Quoted 180 lines
Quoted 16 lines
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>--- 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 | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 89 insertions(+), 1 deletion(-)Review
Quoted 1 line
(quoted diff) +0
-0b/doc/guides/eventdevs/features/default.ini
Review
Quoted 12 lines
index
2ea233463a..00360f60c6100644doc/guides/eventdevs/features/default.ini +1
-0@@ -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.(quoted diff) +0
-0
b/doc/guides/rel_notes/release_22_07.rstdoc/guides/rel_notes/release_22_07.rst New Features · line 70
Quoted 10 lines
index
88d6e96cc1..a7a912d665100644doc/guides/rel_notes/release_22_07.rst +3
-0@@ -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 queueattributes
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct
Quoted 10 lines
doc/guides/rel_notes/release_22_07.rst +2
-0+ at runtime. + Removed Items -------------lib/eventdev/eventdev_pmd.h +0
-0@@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct
rte_eventdev*dev,lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 40 lines
lib/eventdev/eventdev_pmd.h +22
-0typedef 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. */ lib/eventdev/rte_eventdev.c +0
-0@@ -844,6 +844,32 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,Quoted 10 lines
lib/eventdev/rte_eventdev.c +7
-0return 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 );lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 10 lines
lib/eventdev/rte_eventdev.c +10
-0+ 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 queueattributes at runtime",
lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 5 lines
lib/eventdev/rte_eventdev.c +5
-0+ dev_id); +return -ENOTSUP ; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
Quoted 45 lines
lib/eventdev/rte_eventdev.c +4
-0+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[],lib/eventdev/rte_eventdev.h +15
-1@@ -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,30 @@ 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 lib/eventdev/rte_eventdev.h int · line 728
Quoted 10 lines
lib/eventdev/rte_eventdev.h +10
-0+* @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 event attribute. +* - -EBUSY: device is in running state I thought the point of this new interface was to allow setting queue attributes when the event device was running?
Quoted 5 lines
It would be useful for the caller to be able to distinguish between "busy, but please try again later", and "busy, forever". Maybe the latter is what's meant here? In that case, what is the difference with EBUSY and ENOTSUP?
As there are multiple queue attributes, not all attributes could be supported by all PMDs. ENOTSUP can be returned for unsupported attributes.
Quoted 24 lines
Quoted 24 lines
lib/eventdev/rte_eventdev.h +7
-0+* - <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 */ lib/eventdev/version.map +3
-0@@ -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 {
Re: [PATCH v3 1/5] eventdev: support to set queue attributes at runtime
Quoted 159 lines · Shijith Thotton
Quoted 159 lines
Quoted 16 lines
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>--- 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 | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 89 insertions(+), 1 deletion(-)Review
Quoted 1 line
(quoted diff) +0
-0b/doc/guides/eventdevs/features/default.ini
Review
Quoted 12 lines
index
2ea233463a..00360f60c6100644doc/guides/eventdevs/features/default.ini +1
-0@@ -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.(quoted diff) +0
-0
b/doc/guides/rel_notes/release_22_07.rstdoc/guides/rel_notes/release_22_07.rst New Features · line 70
Quoted 10 lines
index
88d6e96cc1..a7a912d665100644doc/guides/rel_notes/release_22_07.rst +3
-0@@ -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 queueattributes
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct
Quoted 10 lines
doc/guides/rel_notes/release_22_07.rst +2
-0+ at runtime. + Removed Items -------------lib/eventdev/eventdev_pmd.h +0
-0@@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct
rte_eventdev*dev,lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 40 lines
lib/eventdev/eventdev_pmd.h +22
-0typedef 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. */ lib/eventdev/rte_eventdev.c +0
-0@@ -844,6 +844,32 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,Quoted 10 lines
lib/eventdev/rte_eventdev.c +7
-0return 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 );lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 10 lines
lib/eventdev/rte_eventdev.c +10
-0+ 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 queueattributes at runtime",
lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 5 lines
lib/eventdev/rte_eventdev.c +5
-0+ dev_id); +return -ENOTSUP ; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
Quoted 38 lines
lib/eventdev/rte_eventdev.c +4
-0+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[],lib/eventdev/rte_eventdev.h +8
-1@@ -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,30 @@ int rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, uint32_t *attr_value);
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
lib/eventdev/rte_eventdev.h +7
-0+/** +* Set an event queue attribute. +* +* @param dev_id +* Eventdev id +* @param queue_id +* Eventdev queue id Quoted 8 lines
lib/eventdev/rte_eventdev.h int · line 726
Quoted 8 lines
lib/eventdev/rte_eventdev.h +8
-0+* @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.
Can "invalid" here be something else than "non-existent"?
Quoted 6 lines
Quoted 6 lines
lib/eventdev/rte_eventdev.h int · line 728
Quoted 2 lines
lib/eventdev/rte_eventdev.h +2
-0+* - -ENOTSUP: device does not support setting event attribute. +* - -EBUSY: device is in running state I thought the point of this new interface was to allow setting queue attributes when the event device was running?
Quoted 9 lines
Quoted 5 lines
It would be useful for the caller to be able to distinguish between "busy, but please try again later", and "busy, forever". Maybe the latter is what's meant here? In that case, what is the difference with EBUSY and ENOTSUP?
As there are multiple queue attributes, not all attributes could be supported by all PMDs. ENOTSUP can be returned for unsupported attributes.
So ENOTSUP means this particular attribute exists, but can't be change in runtime? Is ENOTSUP returned also if no attributes can be modified (i.e., the event device does not have the appropriate capability)?
How is the application supposed to behaved in case -EBUSY is returned? What does -EBUSY mean? The event device being in a running state doesn't sound like an error to me.
Quoted 25 lines
Quoted 24 lines
Quoted 24 lines
lib/eventdev/rte_eventdev.h +7
-0+* - <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 */ lib/eventdev/version.map +3
-0@@ -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 {
RE: [PATCH v3 1/5] eventdev: support to set queue attributes at runtime
Quoted 177 lines
Quoted 94 lines
Quoted 94 lines
Quoted 16 lines
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>--- 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 | 33 ++++++++++++++++++++++- lib/eventdev/version.map | 3 +++ 6 files changed, 89 insertions(+), 1 deletion(-)Review
Quoted 1 line
(quoted diff) +0
-0b/doc/guides/eventdevs/features/default.ini
Review
Quoted 12 lines
index
2ea233463a..00360f60c6100644doc/guides/eventdevs/features/default.ini +1
-0@@ -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.(quoted diff) +0
-0
b/doc/guides/rel_notes/release_22_07.rstdoc/guides/rel_notes/release_22_07.rst New Features · line 70
Quoted 10 lines
index
88d6e96cc1..a7a912d665100644doc/guides/rel_notes/release_22_07.rst +3
-0@@ -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 queueattributes
lib/eventdev/eventdev_pmd.h typedef int (*eventdev_queue_setup_t)(struct
Quoted 10 lines
doc/guides/rel_notes/release_22_07.rst +2
-0+ at runtime. + Removed Items -------------lib/eventdev/eventdev_pmd.h +0
-0@@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct
rte_eventdev*dev,lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 40 lines
lib/eventdev/eventdev_pmd.h +22
-0typedef 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. */ lib/eventdev/rte_eventdev.c +0
-0@@ -844,6 +844,32 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,Quoted 5 lines
Quoted 5 lines
lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 5 lines
lib/eventdev/rte_eventdev.c +2
-0return 0 ; } +int +rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t
attr_id,Quoted 46 lines
Quoted 46 lines
Quoted 5 lines
lib/eventdev/rte_eventdev.c +5
-0+ uint64_t attr_value) +{ +struct rte_eventdev *dev; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL );lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 10 lines
lib/eventdev/rte_eventdev.c +10
-0+ 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 queueattributes at runtime",
lib/eventdev/rte_eventdev.c rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
Quoted 5 lines
lib/eventdev/rte_eventdev.c +5
-0+ dev_id); +return -ENOTSUP ; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
Quoted 24 lines
lib/eventdev/rte_eventdev.c +4
-0+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[],lib/eventdev/rte_eventdev.h +1
-1@@ -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. */ Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
lib/eventdev/rte_eventdev.h +4
-0+#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 Quoted 8 lines
lib/eventdev/rte_eventdev.h int · line 709
Quoted 8 lines
lib/eventdev/rte_eventdev.h +3
-0+* rte_event_queue_setup(). +*/ +/* Event device priority levels */ #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0/**< Highest priority expressed across eventdev subsystem @@ -702,6 +709,30 @@ int rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t
attr_id,Quoted 17 lines
Quoted 17 lines
Quoted 7 lines
lib/eventdev/rte_eventdev.h +5
-0uint32_t *attr_value); +/** +* Set an event queue attribute. +* +* @param dev_id +* Eventdev id lib/eventdev/rte_eventdev.h int · line 726
Quoted 10 lines
lib/eventdev/rte_eventdev.h +10
-0+* @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.
Quoted 2 lines
Can "invalid" here be something else than "non-existent"?
No.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
lib/eventdev/rte_eventdev.h int · line 728
Quoted 2 lines
lib/eventdev/rte_eventdev.h +2
-0+* - -ENOTSUP: device does not support setting event attribute. +* - -EBUSY: device is in running state I thought the point of this new interface was to allow setting queue attributes when the event device was running?
It would be useful for the caller to be able to distinguish between "busy, but please try again later", and "busy, forever". Maybe the latter is what's meant here? In that case, what is the difference with EBUSY and ENOTSUP?
Quoted 6 lines
Quoted 3 lines
As there are multiple queue attributes, not all attributes could be supported by all PMDs. ENOTSUP can be returned for unsupported attributes.
So ENOTSUP means this particular attribute exists, but can't be change in runtime?
Yes. If the attribute doesn’t exist, EINVAL is returned.
Quoted 3 lines
Is ENOTSUP returned also if no attributes can be modified (i.e., the event device does not have the appropriate capability)?
Yes. Application should also be checking the eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR before calling this API.
Quoted 4 lines
How is the application supposed to behaved in case
-EBUSYis returned? What does-EBUSYmean? The event device being in a running state doesn't sound like an error to me.
EBUSY was added to indicate the device was busy and was unable to set the attribute at that time. I think, it can be removed as it is causing confusion. Please let me know if it make sense, I will send v4.
Quoted 27 lines
Quoted 6 lines
Quoted 6 lines
lib/eventdev/rte_eventdev.h int
Quoted 6 lines
lib/eventdev/rte_eventdev.h +5
-0+* - <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,Quoted 20 lines
Quoted 19 lines
Quoted 19 lines
lib/eventdev/rte_eventdev.h +2
-0+ uint64_t attr_value); +/* Event port specific APIs */ /* Event port configuration bitmap flags */ lib/eventdev/version.map +3
-0@@ -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 {
PATCH v3 2/5 eventdev: add weight and affinity to queue attributes
In reply to Shijith ThottonExtended eventdev queue QoS attributes to support weight and affinity. If queues are of the 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 rely on PMD for managing it. New eventdev op queue_attr_get can be used to get it from the PMD.
--- doc/guides/rel_notes/release_22_07.rst | 7 +++++ lib/eventdev/eventdev_pmd.h | 22 +++++++++++++++ lib/eventdev/rte_eventdev.c | 12 ++++++++ lib/eventdev/rte_eventdev.h | 38 ++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_22_07.rst +7 -0
@@ -70,6 +70,13 @@ New Features Added new API ``rte_event_queue_attr_set()``, to set event queue attributes at runtime. +* **Added new queues attributes weight and affinity in eventdev.** + + Defined new event queue attributes weight and affinity as below: + + * ``RTE_EVENT_QUEUE_ATTR_WEIGHT`` + * ``RTE_EVENT_QUEUE_ATTR_AFFINITY`` + Removed Items -------------
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +12 -0
@@ -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 ; };
lib/eventdev/rte_eventdev.h +36 -2
@@ -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.
Signature · 1 line
2.25.1
PATCH v3 3/5 test/event: test cases to test runtime queue attribute
In reply to Shijith ThottonAdded test cases to test changing of queue QoS attributes priority, weight and affinity at runtime.
--- app/test/test_eventdev.c | 201 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+)
app/test/test_eventdev.c +201 -0
@@ -385,6 +385,201 @@ test_eventdev_queue_attr_priority(void)return TEST_SUCCESS ; } +static int +test_eventdev_queue_attr_priority_runtime (void ) +{ +uint32_t queue_count, queue_req, prio, deq_cnt; +struct rte_event_queue_conf qconf; +struct rte_event_port_conf pconf; +struct rte_event_dev_info info; +struct rte_event event = { + .op =RTE_EVENT_OP_NEW , + .event_type =RTE_EVENT_TYPE_CPU , + .sched_type =RTE_SCHED_TYPE_ATOMIC , + .u64 =0xbadbadba , + }; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +/* Need at least 2 queues to test LOW and HIGH priority. */ +TEST_ASSERT (queue_count >1 ,"Not enough event queues, needed 2" ); + queue_req =2 ; + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + + ret =rte_event_queue_attr_set (TEST_DEV_ID ,0 , +RTE_EVENT_QUEUE_ATTR_PRIORITY , +RTE_EVENT_DEV_PRIORITY_LOWEST ); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; +TEST_ASSERT_SUCCESS (ret,"Queue0 priority set failed" ); + + ret =rte_event_queue_attr_set (TEST_DEV_ID ,1 , +RTE_EVENT_QUEUE_ATTR_PRIORITY , +RTE_EVENT_DEV_PRIORITY_HIGHEST ); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; +TEST_ASSERT_SUCCESS (ret,"Queue1 priority set failed" ); + +/* Setup event port 0 */ + ret =rte_event_port_default_conf_get (TEST_DEV_ID ,0 , &pconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get port0 info" ); + ret =rte_event_port_setup (TEST_DEV_ID ,0 , &pconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup port0" ); + ret =rte_event_port_link (TEST_DEV_ID ,0 ,NULL ,NULL ,0 ); +TEST_ASSERT (ret == (int )queue_count,"Failed to link port, device %d" , +TEST_DEV_ID ); + + ret =rte_event_dev_start (TEST_DEV_ID ); +TEST_ASSERT_SUCCESS (ret,"Failed to start device%d" ,TEST_DEV_ID ); + +for (i =0 ; i < (int )queue_req; i++) { + event.queue_id = i; +while (rte_event_enqueue_burst (TEST_DEV_ID ,0 , &event,1 ) !=1 ) +rte_pause (); + } + + prio =RTE_EVENT_DEV_PRIORITY_HIGHEST ; + deq_cnt =0 ; +while (deq_cnt < queue_req) { +uint32_t queue_prio; + +if (rte_event_dequeue_burst (TEST_DEV_ID ,0 , &event,1 ,0 ) ==0 ) +continue ; + + ret =rte_event_queue_attr_get (TEST_DEV_ID , event.queue_id, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + &queue_prio); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue priority get failed" ); +TEST_ASSERT (queue_prio >= prio, +"Received event from a lower priority queue first" ); + prio = queue_prio; + deq_cnt++; + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_weight_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_WEIGHT_HIGHEST ; + ret =rte_event_queue_attr_set ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_WEIGHT , set_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue weight set failed" ); + + ret =rte_event_queue_attr_get ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_WEIGHT , &get_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue weight get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong weight value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_affinity_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_AFFINITY_HIGHEST ; + ret =rte_event_queue_attr_set ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_AFFINITY , set_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue affinity set failed" ); + + ret =rte_event_queue_attr_get ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_AFFINITY , &get_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue affinity get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong affinity value for queue%d" , i); + } + +return TEST_SUCCESS ; +} +static int test_eventdev_queue_attr_nb_atomic_flows (void ) {
@@ -964,6 +1159,12 @@ static struct unit_test_suite eventdev_common_testsuite = { test_eventdev_queue_count),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_priority), +TEST_CASE_ST (eventdev_configure_setup, eventdev_stop_device, + test_eventdev_queue_attr_priority_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_weight_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_affinity_runtime),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_nb_atomic_flows), TEST_CASE_ST(eventdev_configure_setup, NULL,
Signature · 1 line
2.25.1
PATCH v3 4/5 common/cnxk: use lock when accessing mbox of SSO
In reply to Shijith ThottonFrom: Pavan Nikhilesh <[email protected]>
Since mbox is now accessed from multiple threads, use lock to synchronize access.
--- drivers/common/cnxk/roc_sso.c | 174 +++++++++++++++++++++-------- drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++++++-------- 3 files changed, 215 insertions(+), 94 deletions(-)
drivers/common/cnxk/roc_sso.c +125 -49
@@ -36,8 +36,8 @@ sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf, } rc =mbox_process_msg (dev->mbox, rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -69,8 +69,8 @@ sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf) } rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -98,7 +98,7 @@ sso_rsrc_attach(struct roc_sso *roc_sso, enum sso_lf_type lf_type, } req->modify = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -126,7 +126,7 @@ sso_rsrc_detach(struct roc_sso *roc_sso, enum sso_lf_type lf_type) } req->partial = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -141,9 +141,9 @@ sso_rsrc_get(struct roc_sso *roc_sso)mbox_alloc_msg_free_rsrc_cnt (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsrc_cnt); -if (rc <0 ) { +if (rc) {plt_err ("Failed to get free resource count\n" ); -return rc; +return -EIO ; } roc_sso->max_hwgrp = rsrc_cnt->sso;
@@ -197,8 +197,8 @@ sso_msix_fill(struct roc_sso *roc_sso, uint16_t nb_hws, uint16_t nb_hwgrp)mbox_alloc_msg_msix_offset (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;for (i =0 ; i < nb_hws; i++) sso->hws_msix_offset[i] = rsp->ssow_msixoff[i];
@@ -285,53 +285,71 @@ int roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws, struct roc_sso_hws_stats *stats) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso);struct sso_hws_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->hws = hws; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->arbitration = req_rsp->arbitration; -return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_stats_get (struct roc_sso *roc_sso,uint8_t hwgrp,struct roc_sso_hwgrp_stats *stats) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso);struct sso_grp_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->grp = hwgrp; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->aw_status = req_rsp->aw_status; stats->dq_pc = req_rsp->dq_pc;
@@ -341,7 +359,10 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp, stats->ts_pc = req_rsp->ts_pc; stats->wa_pc = req_rsp->wa_pc; stats->ws_pc = req_rsp->ws_pc; -return 0 ; + +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -358,10 +379,12 @@ int roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, uint8_t nb_qos, uint32_t nb_xaq) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_qos_cfg *req;int i, rc; +plt_spinlock_lock (&sso->mbox_lock);for (i =0 ; i < nb_qos; i++) {uint8_t xaq_prcnt = qos[i].xaq_prcnt;uint8_t iaq_prcnt = qos[i].iaq_prcnt;
@@ -370,11 +393,16 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox);if (req ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); -if (req ==NULL ) -return -ENOSPC ; +if (req ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req->grp = qos[i].hwgrp; req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt :100 )) /100 ;
@@ -386,7 +414,12 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,100 ; } -return mbox_process (dev->mbox); + rc =mbox_process (dev->mbox); +if (rc) + rc = -EIO ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -482,11 +515,16 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_init_xaq_aura (struct roc_sso *roc_sso,uint32_t nb_xae) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, - roc_sso->xae_waes, roc_sso->xaq_buf_size, - roc_sso->nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, + roc_sso->xae_waes, roc_sso->xaq_buf_size, + roc_sso->nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -515,9 +553,14 @@ sso_hwgrp_free_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_free_xaq_aura (struct roc_sso *roc_sso,uint16_t nb_hwgrp) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -533,16 +576,24 @@ sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps) req->npa_aura_id = npa_aura_id; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_alloc_xaq (struct roc_sso *roc_sso,uint32_t npa_aura_id,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -555,40 +606,56 @@ sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)return -EINVAL ; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_release_xaq (struct roc_sso *roc_sso,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_set_priority (struct roc_sso *roc_sso,uint16_t hwgrp,uint8_t weight,uint8_t affinity,uint8_t priority) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_priority *req;int rc = -ENOSPC ; +plt_spinlock_lock (&sso->mbox_lock); req =mbox_alloc_msg_sso_grp_set_priority (dev->mbox);if (req ==NULL ) -return rc; + goto fail; req->grp = hwgrp; req->weight = weight; req->affinity = affinity; req->priority = priority; rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } +plt_spinlock_unlock (&sso->mbox_lock);plt_sso_dbg ("HWGRP %d weight %d affinity %d priority %d" , hwgrp, weight, affinity, priority);return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -603,10 +670,11 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)if (roc_sso->max_hws < nb_hws)return -ENOENT ; +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWS , nb_hws);if (rc <0 ) {plt_err ("Unable to attach SSO HWS LFs" ); -return rc; + goto fail; } rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWGRP , nb_hwgrp);
@@ -645,6 +713,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } +plt_spinlock_unlock (&sso->mbox_lock); roc_sso->nb_hwgrp = nb_hwgrp; roc_sso->nb_hws = nb_hws;
@@ -657,6 +726,8 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWGRP ); hwgrp_atch_fail:sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWS ); +fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
@@ -678,6 +749,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso) roc_sso->nb_hwgrp =0 ; roc_sso->nb_hws =0 ; +plt_spinlock_unlock (&sso->mbox_lock); }int
@@ -696,6 +768,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso =roc_sso_to_sso_priv (roc_sso);memset (sso,0 ,sizeof (*sso)); pci_dev = roc_sso->pci_dev; +plt_spinlock_init (&sso->mbox_lock); rc =dev_init (&sso->dev, pci_dev);if (rc <0 ) {
@@ -703,6 +776,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) goto fail; } +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_get (roc_sso);if (rc <0 ) {plt_err ("Failed to get SSO resources" );
@@ -739,6 +813,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso->pci_dev = pci_dev; sso->dev.drv_inited = true; roc_sso->lmt_base = sso->dev.lmt_base; +plt_spinlock_unlock (&sso->mbox_lock);return 0 ; link_mem_free:
@@ -746,6 +821,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) rsrc_fail: rc |=dev_fini (&sso->dev, pci_dev); fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
drivers/common/cnxk/roc_sso_priv.h +1 -0
@@ -22,6 +22,7 @@ struct sso {/* SSO link mapping. */ struct plt_bitmap **link_map;void *link_map_mem; +plt_spinlock_t mbox_lock; } __plt_cache_aligned;enum sso_err_status {
drivers/common/cnxk/roc_tim.c +89 -45
318 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 5/5 event/cnxk: support to set runtime queue attributes
In reply to Shijith ThottonAdded API to set queue attributes at runtime and API to get weight and affinity.
--- 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(-)
doc/guides/eventdevs/features/cnxk.ini +1 -0
@@ -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
drivers/event/cnxk/cn10k_eventdev.c +4 -0
@@ -845,9 +845,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,
drivers/event/cnxk/cn9k_eventdev.c +4 -0
@@ -1079,9 +1079,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,
drivers/event/cnxk/cnxk_eventdev.c +85 -6
109 lines not on this page · raw message
drivers/event/cnxk/cnxk_eventdev.h +19 -0
@@ -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,
Signature · 1 line
2.25.1
v4 cover Extend and set event queue attributes at runtime
In reply to Shijith ThottonThis series adds support for setting event queue attributes at runtime and adds two new event queue attributes weight and affinity. Eventdev capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR is added to expose the capability to set attributes at runtime and rte_event_queue_attr_set() API is used to set the attributes.
Attributes weight and affinity are not yet added to rte_event_queue_conf structure to avoid ABI break and will be added in 22.11. Till then, PMDs using the new attributes are expected to manage them.
Test application changes and example implementation are added as last three patches.
v4:
* Removed EBUSY from rte_event_queue_attr_set() return vals.
v3:
* Updated release notes.
* Removed deprecation patch from series.
* Used event enq/deq to test queue priority.
v2:
* Modified attr_value type from u32 to u64 for set().
* Removed RTE_EVENT_QUEUE_ATTR_MAX macro.
* Fixed return value in implementation.
Pavan Nikhilesh (1):
common/cnxk: use lock when accessing mbox of SSO
Shijith Thotton (4):
eventdev: support to set queue attributes at runtime
eventdev: add weight and affinity to queue attributes test/event: test cases to test runtime queue attribute event/cnxk: support to set runtime queue attributes
app/test/test_eventdev.c | 201 ++++++++++++++++++++++ doc/guides/eventdevs/features/cnxk.ini | 1 + doc/guides/eventdevs/features/default.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 12 ++ drivers/common/cnxk/roc_sso.c | 174 +++++++++++++------ drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++----- 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 ++ lib/eventdev/eventdev_pmd.h | 44 +++++ lib/eventdev/rte_eventdev.c | 38 ++++ lib/eventdev/rte_eventdev.h | 70 +++++++- lib/eventdev/version.map | 3 + 15 files changed, 694 insertions(+), 103 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/5 eventdev: support to set queue attributes at runtime
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.
--- 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(-)
doc/guides/eventdevs/features/default.ini +1 -0
@@ -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.
doc/guides/rel_notes/release_22_07.rst +5 -0
@@ -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 -------------
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +26 -0
@@ -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[],
lib/eventdev/rte_eventdev.h +31 -1
@@ -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 */
lib/eventdev/version.map +3 -0
@@ -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 {
Signature · 1 line
2.25.1
Re: [PATCH v4 1/5] eventdev: support to set queue attributes at runtime
Quoted 8 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>
Hi @Mattias Rönnblom
Planning to merge this version for -rc1. Do you have any more comments for this series?
Quoted 188 lines
--- 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(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.doc/guides/rel_notes/release_22_07.rst +5
-0@@ -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 -------------lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +26
-0@@ -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[],lib/eventdev/rte_eventdev.h +31
-1@@ -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 */ lib/eventdev/version.map +3
-1@@ -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 { --2.25.1
Re: [PATCH v4 1/5] eventdev: support to set queue attributes at runtime
Quoted 7 lines · Jerin Jacob
Quoted 6 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>Hi @Mattias Rönnblom
Planning to merge this version for -rc1. Do you have any more comments for this series?
No.
Quoted 189 lines
Quoted 189 lines
--- 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(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.doc/guides/rel_notes/release_22_07.rst +5
-0@@ -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 -------------lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +26
-0@@ -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[],lib/eventdev/rte_eventdev.h +31
-1@@ -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 */ lib/eventdev/version.map +3
-1@@ -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 { --2.25.1
Re: [PATCH v4 1/5] eventdev: support to set queue attributes at runtime
Quoted 12 lines · Mattias Rönnblom
Quoted 10 lines · Jerin Jacob
Quoted 8 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>
Quoted 7 lines
Quoted 5 lines
Hi @Mattias Rönnblom
Planning to merge this version for -rc1. Do you have any more comments for this series?
No.
Series applied to dpdk-next-net-eventdev/for-main. Thanks
Quoted 191 lines
Quoted 190 lines
Quoted 190 lines
--- 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(-)doc/guides/eventdevs/features/default.ini +1
-0@@ -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.doc/guides/rel_notes/release_22_07.rst +5
-0@@ -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 -------------lib/eventdev/eventdev_pmd.h +22
-0@@ -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. */ lib/eventdev/rte_eventdev.c +26
-0@@ -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[],lib/eventdev/rte_eventdev.h +31
-1@@ -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 */ lib/eventdev/version.map +3
-1@@ -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 { --2.25.1
Re: [PATCH v4 1/5] eventdev: support to set queue attributes at runtime
In reply to Shijith ThottonQuoted 7 lines · Shijith Thotton
Added a new eventdev API
rte_event_queue_attr_set(), to set event queue attributes at runtime from the values set during initialization usingrte_event_queue_setup(). PMD's supporting this feature should expose the capabilityRTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.Signed-off-by Shijith Thotton <[email protected]>Acked-by Jerin Jacob <[email protected]>
Quoted 9 lines
--- 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(-)
PATCH v4 2/5 eventdev: add weight and affinity to queue attributes
In reply to Shijith ThottonExtended eventdev queue QoS attributes to support weight and affinity. If queues are of the 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 rely on PMD for managing it. New eventdev op queue_attr_get can be used to get it from the PMD.
--- doc/guides/rel_notes/release_22_07.rst | 7 +++++ lib/eventdev/eventdev_pmd.h | 22 +++++++++++++++ lib/eventdev/rte_eventdev.c | 12 ++++++++ lib/eventdev/rte_eventdev.h | 38 ++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_22_07.rst +7 -0
@@ -70,6 +70,13 @@ New Features Added new API ``rte_event_queue_attr_set()``, to set event queue attributes at runtime. +* **Added new queues attributes weight and affinity in eventdev.** + + Defined new event queue attributes weight and affinity as below: + + * ``RTE_EVENT_QUEUE_ATTR_WEIGHT`` + * ``RTE_EVENT_QUEUE_ATTR_AFFINITY`` + Removed Items -------------
lib/eventdev/eventdev_pmd.h +22 -0
@@ -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. */
lib/eventdev/rte_eventdev.c +12 -0
@@ -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 ; };
lib/eventdev/rte_eventdev.h +36 -2
@@ -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.
Signature · 1 line
2.25.1
PATCH v4 3/5 test/event: test cases to test runtime queue attribute
In reply to Shijith ThottonAdded test cases to test changing of queue QoS attributes priority, weight and affinity at runtime.
--- app/test/test_eventdev.c | 201 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+)
app/test/test_eventdev.c +201 -0
@@ -385,6 +385,201 @@ test_eventdev_queue_attr_priority(void)return TEST_SUCCESS ; } +static int +test_eventdev_queue_attr_priority_runtime (void ) +{ +uint32_t queue_count, queue_req, prio, deq_cnt; +struct rte_event_queue_conf qconf; +struct rte_event_port_conf pconf; +struct rte_event_dev_info info; +struct rte_event event = { + .op =RTE_EVENT_OP_NEW , + .event_type =RTE_EVENT_TYPE_CPU , + .sched_type =RTE_SCHED_TYPE_ATOMIC , + .u64 =0xbadbadba , + }; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +/* Need at least 2 queues to test LOW and HIGH priority. */ +TEST_ASSERT (queue_count >1 ,"Not enough event queues, needed 2" ); + queue_req =2 ; + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + + ret =rte_event_queue_attr_set (TEST_DEV_ID ,0 , +RTE_EVENT_QUEUE_ATTR_PRIORITY , +RTE_EVENT_DEV_PRIORITY_LOWEST ); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; +TEST_ASSERT_SUCCESS (ret,"Queue0 priority set failed" ); + + ret =rte_event_queue_attr_set (TEST_DEV_ID ,1 , +RTE_EVENT_QUEUE_ATTR_PRIORITY , +RTE_EVENT_DEV_PRIORITY_HIGHEST ); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; +TEST_ASSERT_SUCCESS (ret,"Queue1 priority set failed" ); + +/* Setup event port 0 */ + ret =rte_event_port_default_conf_get (TEST_DEV_ID ,0 , &pconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get port0 info" ); + ret =rte_event_port_setup (TEST_DEV_ID ,0 , &pconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup port0" ); + ret =rte_event_port_link (TEST_DEV_ID ,0 ,NULL ,NULL ,0 ); +TEST_ASSERT (ret == (int )queue_count,"Failed to link port, device %d" , +TEST_DEV_ID ); + + ret =rte_event_dev_start (TEST_DEV_ID ); +TEST_ASSERT_SUCCESS (ret,"Failed to start device%d" ,TEST_DEV_ID ); + +for (i =0 ; i < (int )queue_req; i++) { + event.queue_id = i; +while (rte_event_enqueue_burst (TEST_DEV_ID ,0 , &event,1 ) !=1 ) +rte_pause (); + } + + prio =RTE_EVENT_DEV_PRIORITY_HIGHEST ; + deq_cnt =0 ; +while (deq_cnt < queue_req) { +uint32_t queue_prio; + +if (rte_event_dequeue_burst (TEST_DEV_ID ,0 , &event,1 ,0 ) ==0 ) +continue ; + + ret =rte_event_queue_attr_get (TEST_DEV_ID , event.queue_id, +RTE_EVENT_QUEUE_ATTR_PRIORITY , + &queue_prio); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue priority get failed" ); +TEST_ASSERT (queue_prio >= prio, +"Received event from a lower priority queue first" ); + prio = queue_prio; + deq_cnt++; + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_weight_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_WEIGHT_HIGHEST ; + ret =rte_event_queue_attr_set ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_WEIGHT , set_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue weight set failed" ); + + ret =rte_event_queue_attr_get ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_WEIGHT , &get_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue weight get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong weight value for queue%d" , i); + } + +return TEST_SUCCESS ; +} + +static int +test_eventdev_queue_attr_affinity_runtime (void ) +{ +struct rte_event_queue_conf qconf; +struct rte_event_dev_info info; +uint32_t queue_count; +int i, ret; + + ret =rte_event_dev_info_get (TEST_DEV_ID , &info); +TEST_ASSERT_SUCCESS (ret,"Failed to get event dev info" ); + +if (!(info.event_dev_cap &RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR )) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (rte_event_dev_attr_get ( +TEST_DEV_ID ,RTE_EVENT_DEV_ATTR_QUEUE_COUNT , + &queue_count), +"Queue count get failed" ); + +for (i =0 ; i < (int )queue_count; i++) { + ret =rte_event_queue_default_conf_get (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to get queue%d def conf" , i); + ret =rte_event_queue_setup (TEST_DEV_ID , i, &qconf); +TEST_ASSERT_SUCCESS (ret,"Failed to setup queue%d" , i); + } + +for (i =0 ; i < (int )queue_count; i++) { +uint32_t get_val; +uint64_t set_val; + + set_val = i %RTE_EVENT_QUEUE_AFFINITY_HIGHEST ; + ret =rte_event_queue_attr_set ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_AFFINITY , set_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue affinity set failed" ); + + ret =rte_event_queue_attr_get ( +TEST_DEV_ID , i,RTE_EVENT_QUEUE_ATTR_AFFINITY , &get_val); +if (ret == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_SUCCESS (ret,"Queue affinity get failed" ); +TEST_ASSERT_EQUAL (get_val, set_val, +"Wrong affinity value for queue%d" , i); + } + +return TEST_SUCCESS ; +} +static int test_eventdev_queue_attr_nb_atomic_flows (void ) {
@@ -964,6 +1159,12 @@ static struct unit_test_suite eventdev_common_testsuite = { test_eventdev_queue_count),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_priority), +TEST_CASE_ST (eventdev_configure_setup, eventdev_stop_device, + test_eventdev_queue_attr_priority_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_weight_runtime), +TEST_CASE_ST (eventdev_configure_setup,NULL , + test_eventdev_queue_attr_affinity_runtime),TEST_CASE_ST (eventdev_configure_setup,NULL , test_eventdev_queue_attr_nb_atomic_flows), TEST_CASE_ST(eventdev_configure_setup, NULL,
Signature · 1 line
2.25.1
PATCH v4 4/5 common/cnxk: use lock when accessing mbox of SSO
In reply to Shijith ThottonFrom: Pavan Nikhilesh <[email protected]>
Since mbox is now accessed from multiple threads, use lock to synchronize access.
--- drivers/common/cnxk/roc_sso.c | 174 +++++++++++++++++++++-------- drivers/common/cnxk/roc_sso_priv.h | 1 + drivers/common/cnxk/roc_tim.c | 134 ++++++++++++++-------- 3 files changed, 215 insertions(+), 94 deletions(-)
drivers/common/cnxk/roc_sso.c +125 -49
@@ -36,8 +36,8 @@ sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf, } rc =mbox_process_msg (dev->mbox, rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -69,8 +69,8 @@ sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf) } rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;return 0 ; }
@@ -98,7 +98,7 @@ sso_rsrc_attach(struct roc_sso *roc_sso, enum sso_lf_type lf_type, } req->modify = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -126,7 +126,7 @@ sso_rsrc_detach(struct roc_sso *roc_sso, enum sso_lf_type lf_type) } req->partial = true; -if (mbox_process (dev->mbox) <0 ) +if (mbox_process (dev->mbox))return -EIO ;return 0 ;
@@ -141,9 +141,9 @@ sso_rsrc_get(struct roc_sso *roc_sso)mbox_alloc_msg_free_rsrc_cnt (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsrc_cnt); -if (rc <0 ) { +if (rc) {plt_err ("Failed to get free resource count\n" ); -return rc; +return -EIO ; } roc_sso->max_hwgrp = rsrc_cnt->sso;
@@ -197,8 +197,8 @@ sso_msix_fill(struct roc_sso *roc_sso, uint16_t nb_hws, uint16_t nb_hwgrp)mbox_alloc_msg_msix_offset (dev->mbox); rc =mbox_process_msg (dev->mbox, (void **)&rsp); -if (rc <0 ) -return rc; +if (rc) +return -EIO ;for (i =0 ; i < nb_hws; i++) sso->hws_msix_offset[i] = rsp->ssow_msixoff[i];
@@ -285,53 +285,71 @@ int roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws, struct roc_sso_hws_stats *stats) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso);struct sso_hws_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_hws_stats *)mbox_alloc_msg_sso_hws_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->hws = hws; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->arbitration = req_rsp->arbitration; -return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_stats_get (struct roc_sso *roc_sso,uint8_t hwgrp,struct roc_sso_hwgrp_stats *stats) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso);struct sso_grp_stats *req_rsp; +struct dev *dev = &sso->dev;int rc; +plt_spinlock_lock (&sso->mbox_lock); req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats ( dev->mbox);if (req_rsp ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } req_rsp = (struct sso_grp_stats *)mbox_alloc_msg_sso_grp_get_stats (dev->mbox); -if (req_rsp ==NULL ) -return -ENOSPC ; +if (req_rsp ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req_rsp->grp = hwgrp; rc =mbox_process_msg (dev->mbox, (void **)&req_rsp); -if (rc) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } stats->aw_status = req_rsp->aw_status; stats->dq_pc = req_rsp->dq_pc;
@@ -341,7 +359,10 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp, stats->ts_pc = req_rsp->ts_pc; stats->wa_pc = req_rsp->wa_pc; stats->ws_pc = req_rsp->ws_pc; -return 0 ; + +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -358,10 +379,12 @@ int roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, uint8_t nb_qos, uint32_t nb_xaq) { - struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso *sso = roc_sso_to_sso_priv(roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_qos_cfg *req;int i, rc; +plt_spinlock_lock (&sso->mbox_lock);for (i =0 ; i < nb_qos; i++) {uint8_t xaq_prcnt = qos[i].xaq_prcnt;uint8_t iaq_prcnt = qos[i].iaq_prcnt;
@@ -370,11 +393,16 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox);if (req ==NULL ) { rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); -if (req ==NULL ) -return -ENOSPC ; +if (req ==NULL ) { + rc = -ENOSPC ; + goto fail; + } } req->grp = qos[i].hwgrp; req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt :100 )) /100 ;
@@ -386,7 +414,12 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,100 ; } -return mbox_process (dev->mbox); + rc =mbox_process (dev->mbox); +if (rc) + rc = -EIO ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -482,11 +515,16 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_init_xaq_aura (struct roc_sso *roc_sso,uint32_t nb_xae) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, - roc_sso->xae_waes, roc_sso->xaq_buf_size, - roc_sso->nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_init_xaq_aura (dev, &roc_sso->xaq, nb_xae, + roc_sso->xae_waes, roc_sso->xaq_buf_size, + roc_sso->nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -515,9 +553,14 @@ sso_hwgrp_free_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,int roc_sso_hwgrp_free_xaq_aura (struct roc_sso *roc_sso,uint16_t nb_hwgrp) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_free_xaq_aura (dev, &roc_sso->xaq, nb_hwgrp); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -533,16 +576,24 @@ sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps) req->npa_aura_id = npa_aura_id; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_alloc_xaq (struct roc_sso *roc_sso,uint32_t npa_aura_id,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_alloc_xaq (dev, npa_aura_id, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -555,40 +606,56 @@ sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)return -EINVAL ; req->hwgrps = hwgrps; -return mbox_process (dev->mbox); +if (mbox_process (dev->mbox)) +return -EIO ; + +return 0 ; }int roc_sso_hwgrp_release_xaq (struct roc_sso *roc_sso,uint16_t hwgrps) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev; +int rc; -return sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_lock (&sso->mbox_lock); + rc =sso_hwgrp_release_xaq (dev, hwgrps); +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int roc_sso_hwgrp_set_priority (struct roc_sso *roc_sso,uint16_t hwgrp,uint8_t weight,uint8_t affinity,uint8_t priority) { -struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso =roc_sso_to_sso_priv (roc_sso); +struct dev *dev = &sso->dev;struct sso_grp_priority *req;int rc = -ENOSPC ; +plt_spinlock_lock (&sso->mbox_lock); req =mbox_alloc_msg_sso_grp_set_priority (dev->mbox);if (req ==NULL ) -return rc; + goto fail; req->grp = hwgrp; req->weight = weight; req->affinity = affinity; req->priority = priority; rc =mbox_process (dev->mbox); -if (rc <0 ) -return rc; +if (rc) { + rc = -EIO ; + goto fail; + } +plt_spinlock_unlock (&sso->mbox_lock);plt_sso_dbg ("HWGRP %d weight %d affinity %d priority %d" , hwgrp, weight, affinity, priority);return 0 ; +fail: +plt_spinlock_unlock (&sso->mbox_lock); +return rc; }int
@@ -603,10 +670,11 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)if (roc_sso->max_hws < nb_hws)return -ENOENT ; +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWS , nb_hws);if (rc <0 ) {plt_err ("Unable to attach SSO HWS LFs" ); -return rc; + goto fail; } rc =sso_rsrc_attach (roc_sso,SSO_LF_TYPE_HWGRP , nb_hwgrp);
@@ -645,6 +713,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } +plt_spinlock_unlock (&sso->mbox_lock); roc_sso->nb_hwgrp = nb_hwgrp; roc_sso->nb_hws = nb_hws;
@@ -657,6 +726,8 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWGRP ); hwgrp_atch_fail:sso_rsrc_detach (roc_sso,SSO_LF_TYPE_HWS ); +fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
@@ -678,6 +749,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso) roc_sso->nb_hwgrp =0 ; roc_sso->nb_hws =0 ; +plt_spinlock_unlock (&sso->mbox_lock); }int
@@ -696,6 +768,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso =roc_sso_to_sso_priv (roc_sso);memset (sso,0 ,sizeof (*sso)); pci_dev = roc_sso->pci_dev; +plt_spinlock_init (&sso->mbox_lock); rc =dev_init (&sso->dev, pci_dev);if (rc <0 ) {
@@ -703,6 +776,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) goto fail; } +plt_spinlock_lock (&sso->mbox_lock); rc =sso_rsrc_get (roc_sso);if (rc <0 ) {plt_err ("Failed to get SSO resources" );
@@ -739,6 +813,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) sso->pci_dev = pci_dev; sso->dev.drv_inited = true; roc_sso->lmt_base = sso->dev.lmt_base; +plt_spinlock_unlock (&sso->mbox_lock);return 0 ; link_mem_free:
@@ -746,6 +821,7 @@ roc_sso_dev_init(struct roc_sso *roc_sso) rsrc_fail: rc |=dev_fini (&sso->dev, pci_dev); fail: +plt_spinlock_unlock (&sso->mbox_lock);return rc; }
drivers/common/cnxk/roc_sso_priv.h +1 -0
@@ -22,6 +22,7 @@ struct sso {/* SSO link mapping. */ struct plt_bitmap **link_map;void *link_map_mem; +plt_spinlock_t mbox_lock; } __plt_cache_aligned;enum sso_err_status {
drivers/common/cnxk/roc_tim.c +89 -45
318 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 5/5 event/cnxk: support to set runtime queue attributes
In reply to Shijith ThottonAdded API to set queue attributes at runtime and API to get weight and affinity.
--- 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(-)
doc/guides/eventdevs/features/cnxk.ini +1 -0
@@ -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
drivers/event/cnxk/cn10k_eventdev.c +4 -0
@@ -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,
drivers/event/cnxk/cn9k_eventdev.c +4 -0
@@ -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,
drivers/event/cnxk/cnxk_eventdev.c +85 -6
109 lines not on this page · raw message
drivers/event/cnxk/cnxk_eventdev.h +19 -0
@@ -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,
Signature · 1 line
2.25.1