eventdev: add port usage hints
cover eventdev: add port usage hints
These 2 patches are a suggestion to add a hint to the struct rte_event_port_conf.event_port_cfg.
The usage of these hints is to allow an application to identify/communicate to the PMD what ports will primarily serve what purpose.
E.g, some ports are "mainly producers" in that they are usually polling Ethdev RXQs (or other event sources..) and enqueue the resulting events to the eventdev instance. Similarly there are usages for "worker" (mainly forwards events) and "consumer" (mainly consumes events without re-enq).
Note that these flags are *hints* only, and *functionally* any combination of (NEW/FWD/RELEASE) is still allowed by any port. The reason to add these is to allow a PMD to allocate internal resource more efficiently.
Note that this implementation does not change the ABI, as it gives a purpose to existing bits in an existing field.
Regards, -Harry
Harry van Haaren (2):
lib/eventdev: add usage hints to port configure API examples/eventdev_pipeline: use port config hints
.../pipeline_worker_generic.c | 2 ++ .../eventdev_pipeline/pipeline_worker_tx.c | 2 ++ lib/eventdev/rte_eventdev.h | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+)
Signature · 1 line
2.30.2
PATCH 1/2 lib/eventdev: add usage hints to port configure API
This commit introduces 3 flags to the port configuration flags. These flags allow the application to indicate what type of work is expected to be performed by an eventdev port.
The three new flags are
- RTE_EVENT_PORT_CFG_HINT_PRODUCER (mostly RTE_EVENT_OP_NEW events)
- RTE_EVENT_PORT_CFG_HINT_CONSUMER (mostly RTE_EVENT_OP_RELEASE events)
- RTE_EVENT_PORT_CFG_HINT_WORKER (mostly RTE_EVENT_OP_FORWARD events)
These flags are only hints, and the PMDs must operate under the assumption that any port can enqueue an event with any type of op.
--- lib/eventdev/rte_eventdev.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
lib/eventdev/rte_eventdev.h +23 -0
@@ -709,6 +709,29 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,* * @see rte_event_port_setup(), rte_event_port_link() */ +#define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2) +/**< Hint that this event port will primarily enqueue events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to enqueue NEW events. Note that this flag is only a hint. +* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_CONSUMER (1ULL << 3) +/**< Hint that this event port will primarily dequeue events from the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to consume events, and not enqueue FORWARD or RELEASE events. +* Note that this flag is only a hint. +* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_WORKER (1ULL << 4) +/**< Hint that this event port will primarily events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to FORWARD events, and not enqueue NEW or RELEASE events +* often. Note that this flag is only a hint. +* +* @see rte_event_port_setup() +*/ /** Event port configuration structure */ struct rte_event_port_conf {
Signature · 1 line
2.30.2
Re: [dpdk-dev] [PATCH 1/2] lib/eventdev: add usage hints to port configure API
Quoted 5 lines · Harry van Haaren
This commit introduces 3 flags to the port configuration flags. These flags allow the application to indicate what type of work is expected to be performed by an eventdev port.
Quoted 7 lines
The three new flags are
-RTE_EVENT_PORT_CFG_HINT_PRODUCER(mostlyRTE_EVENT_OP_NEWevents)
-RTE_EVENT_PORT_CFG_HINT_CONSUMER(mostlyRTE_EVENT_OP_RELEASEevents)
-RTE_EVENT_PORT_CFG_HINT_WORKER(mostlyRTE_EVENT_OP_FORWARDevents)These flags are only hints, and the PMDs must operate under the assumption that any port can enqueue an event with any type of op.
This change looks good to me.
+ @Mattias Rönnblom @Erik Gabriel Carrillo @Gujjar, Abhinandan S @Pavan Nikhilesh @Hemant Agrawal @Nipun Gupta @Liang Ma @McDaniel, Timothy
# Please change subject to evendev: ....
# Please submit the driver changes as well and updated performance gain with the scheme.
# Please find below one comment
Quoted 11 lines
Signed-off-by Harry van Haaren <[email protected]>--- lib/eventdev/rte_eventdev.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)lib/eventdev/rte_eventdev.h +0
-0
lib/eventdev/rte_eventdev.h rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, · line 715
Quoted 7 lines
lib/eventdev/rte_eventdev.h +4
-0@@ -709,6 +709,29 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,* * @see rte_event_port_setup(), rte_event_port_link() */ +#define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2) +/**< Hint that this event port will primarily enqueue events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to enqueue NEW events. Note that this flag is only a hint.
IMO, We can explicitly add the following line in each comment.
PMDs must operate under the assumption that any port can enqueue an event with any type of op.
Quoted 25 lines
lib/eventdev/rte_eventdev.h +19
-1+* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_CONSUMER (1ULL << 3) +/**< Hint that this event port will primarily dequeue events from the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to consume events, and not enqueue FORWARD or RELEASE events. +* Note that this flag is only a hint. +* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_WORKER (1ULL << 4) +/**< Hint that this event port will primarily events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to FORWARD events, and not enqueue NEW or RELEASE events +* often. Note that this flag is only a hint. +* +* @see rte_event_port_setup() +*/ /** Event port configuration structure */ struct rte_event_port_conf { --2.30.2
Re: [dpdk-dev] [PATCH 1/2] lib/eventdev: add usage hints to port configure API
Quoted 24 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Thursday, September 16, 2021 5:59 AM
To: Van Haaren, Harry <[email protected]>
Cc: dpdk-dev <[email protected]>; Pathak, Pravin <[email protected]>; McDaniel, Timothy <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/2] lib/eventdev: add usage hints to port configure APIQuoted 7 lines · Harry van Haaren
This commit introduces 3 flags to the port configuration flags. These flags allow the application to indicate what type of work is expected to be performed by an eventdev port.
The three new flags are
-RTE_EVENT_PORT_CFG_HINT_PRODUCER(mostlyRTE_EVENT_OP_NEWevents)
Quoted 1 line
-
RTE_EVENT_PORT_CFG_HINT_CONSUMER(mostlyRTE_EVENT_OP_RELEASEevents)
Quoted 1 line
-
RTE_EVENT_PORT_CFG_HINT_WORKER(mostlyRTE_EVENT_OP_FORWARDevents)
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
These flags are only hints, and the PMDs must operate under the assumption that any port can enqueue an event with any type of op.
This change looks good to me.
+ @Mattias Rönnblom @Erik Gabriel Carrillo @Gujjar, Abhinandan S @Pavan Nikhilesh @Hemant Agrawal @Nipun Gupta @Liang Ma @McDaniel, Timothy
Thanks for review Jerin. I didn't see some these folks on CC, so +CC a few. Any concerns folks about adding hints for producer/worker/consumer?
Quoted 1 line
# Please change subject to evendev: ....
Yes, will do.
Quoted 2 lines
# Please submit the driver changes as well and updated performance gain with the scheme.
Yes, that makes sense. I'll work with DLB driver maintainers to get these changes up ASAP.
Quoted 1 line
# Please find below one comment
<snip details>
Quoted 21 lines
lib/eventdev/rte_eventdev.h rte_event_queue_attr_get(uint8_t dev_id, uint8_t
Quoted 10 lines
Signed-off-by Harry van Haaren <[email protected]>--- lib/eventdev/rte_eventdev.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)lib/eventdev/rte_eventdev.h +0
-0@@ -709,6 +709,29 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t
queue_id,uint32_tattr_id,lib/eventdev/rte_eventdev.h rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, · line 715
Quoted 7 lines
lib/eventdev/rte_eventdev.h +4
-0* * @see rte_event_port_setup(), rte_event_port_link() */ +#define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2) +/**< Hint that this event port will primarily enqueue events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to enqueue NEW events. Note that this flag is only a hint. IMO, We can explicitly add the following line in each comment.
Quoted 2 lines
PMDs must operate under the assumption that any port can enqueue an event with any type of op.
Yes - good clarification to make it very clear each time.
<snip remaining patch>
PATCH v2 1/4 eventdev: add usage hints to port configure API
In reply to Harry van HaarenThis commit introduces 3 flags to the port configuration flags. These flags allow the application to indicate what type of work is expected to be performed by an eventdev port.
The three new flags are
- RTE_EVENT_PORT_CFG_HINT_PRODUCER (mostly RTE_EVENT_OP_NEW events)
- RTE_EVENT_PORT_CFG_HINT_CONSUMER (mostly RTE_EVENT_OP_RELEASE events)
- RTE_EVENT_PORT_CFG_HINT_WORKER (mostly RTE_EVENT_OP_FORWARD events)
These flags are only hints, and the PMDs must operate under the assumption that any port can enqueue an event with any type of op.
---
v2:
- Add note about PMD assumptions to all hints (Jerin)
- Fixup title to eventdev: (Jerin)
- Improve wording/readability of worker hint description.
--- lib/eventdev/rte_eventdev.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
lib/eventdev/rte_eventdev.h +32 -0
@@ -709,6 +709,38 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,* * @see rte_event_port_setup(), rte_event_port_link() */ +#define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2) +/**< Hint that this event port will primarily enqueue events to the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to enqueue NEW events. +* +* Note that this flag is only a hint, so PMDs must operate under the +* assumption that any port can enqueue an event with any type of op. +* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_CONSUMER (1ULL << 3) +/**< Hint that this event port will primarily dequeue events from the system. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to consume events, and not enqueue FORWARD or RELEASE +* events. +* +* Note that this flag is only a hint, so PMDs must operate under the +* assumption that any port can enqueue an event with any type of op. +* +* @see rte_event_port_setup() +*/ +#define RTE_EVENT_PORT_CFG_HINT_WORKER (1ULL << 4) +/**< Hint that this event port will primarily pass existing events through. +* A PMD can optimize its internal workings by assuming that this port is +* primarily going to FORWARD events, and not enqueue NEW or RELEASE events +* often. +* +* Note that this flag is only a hint, so PMDs must operate under the +* assumption that any port can enqueue an event with any type of op. +* +* @see rte_event_port_setup() +*/ /** Event port configuration structure */ struct rte_event_port_conf {
Signature · 1 line
2.30.2
PATCH v2 2/4 examples/eventdev_pipeline: use port config hints
This commit adds the per-port hints added to the eventdev API, indicating which eventdev ports will be used for producing, forwarding, or consuming events from the system.
--- examples/eventdev_pipeline/pipeline_worker_generic.c | 2 ++ examples/eventdev_pipeline/pipeline_worker_tx.c | 2 ++ 2 files changed, 4 insertions(+)
examples/eventdev_pipeline/pipeline_worker_generic.c +2 -0
@@ -139,6 +139,7 @@ setup_eventdev_generic(struct worker_data *worker_data) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_WORKER, };struct rte_event_queue_conf wkr_q_conf = { .schedule_type = cdata.queue_type,
@@ -416,6 +417,7 @@ init_adapters(uint16_t nb_ports) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_PRODUCER, };if (adptr_p_conf.new_event_threshold > dev_info.max_num_events)
examples/eventdev_pipeline/pipeline_worker_tx.c +2 -0
@@ -446,6 +446,7 @@ setup_eventdev_worker_tx_enq(struct worker_data *worker_data) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_WORKER, };struct rte_event_queue_conf wkr_q_conf = { .schedule_type = cdata.queue_type,
@@ -744,6 +745,7 @@ init_adapters(uint16_t nb_ports) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_PRODUCER, };init_ports (nb_ports);
Signature · 1 line
2.30.2
PATCH v2 3/4 test-eventdev: add event port hints for perf mode
In reply to Harry van HaarenThis commit adds producer, worker and consumer port hints for the test-eventdev application performance tests.
--- app/test-eventdev/test_perf_common.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
app/test-eventdev/test_perf_common.c +14 -4
@@ -480,7 +480,10 @@ perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, w->processed_pkts =0 ; w->latency =0 ; - ret =rte_event_port_setup (opt->dev_id, port, port_conf); +struct rte_event_port_conf conf = *port_conf; + conf.event_port_cfg |=RTE_EVENT_PORT_CFG_HINT_WORKER ; + + ret =rte_event_port_setup (opt->dev_id, port, &conf);if (ret) {evt_err ("failed to setup port %d" , port);return ret;
@@ -500,7 +503,10 @@ perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, p->t = t; } - ret =perf_event_rx_adapter_setup (opt, stride, *port_conf); +struct rte_event_port_conf conf = *port_conf; + conf.event_port_cfg |=RTE_EVENT_PORT_CFG_HINT_PRODUCER ; + + ret =perf_event_rx_adapter_setup (opt, stride, conf);if (ret)return ret; }else if (opt->prod_type ==EVT_PROD_TYPE_EVENT_TIMER_ADPTR ) {
@@ -525,8 +531,12 @@ perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, p->queue_id = prod * stride; p->t = t; - ret =rte_event_port_setup (opt->dev_id, port, - port_conf); +struct rte_event_port_conf conf = *port_conf; + conf.event_port_cfg |= +RTE_EVENT_PORT_CFG_HINT_PRODUCER | +RTE_EVENT_PORT_CFG_HINT_CONSUMER ; + + ret =rte_event_port_setup (opt->dev_id, port, &conf);if (ret) {evt_err ("failed to setup port %d" , port);return ret;
Signature · 1 line
2.30.2
PATCH v2 4/4 event/dlb2: optimize credit allocations using port hint flags
In reply to Harry van HaarenFrom: "Pathak, Pravin" <[email protected]>
This commit implements the changes required for using suggested port type hint feature. Each port uses different credit quanta based on port type specified using port configuration flags.
Each port has separate quanta defined in dlb2_priv.h
Producer and consumer ports will need larger quanta value to reduce number of credit calls they make. Workers can use small quanta as they mostly work out of locally cached credits and don't request/return credits often.
--- drivers/event/dlb2/dlb2.c | 61 ++++++++++++++++++++++++++++++--- drivers/event/dlb2/dlb2_priv.h | 12 +++++-- drivers/event/dlb2/pf/dlb2_pf.c | 1 + 3 files changed, 67 insertions(+), 7 deletions(-)
drivers/event/dlb2/dlb2.c +56 -5
@@ -355,6 +355,26 @@ set_sw_credit_quanta(const char *key __rte_unused,return 0 ; } +static int +set_hw_credit_quanta(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *hw_credit_quanta = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (hw_credit_quanta, value); +if (ret <0 ) +return ret; + +return 0 ; +} + static int set_default_depth_thresh(const char *key __rte_unused, const char *value,
@@ -769,7 +789,7 @@ dlb2_eventdev_configure(const struct rte_eventdev *dev)if (rsrcs->num_ldb_queues) rsrcs->num_ldb_credits = config->nb_events_limit;if (rsrcs->num_dir_ports) - rsrcs->num_dir_credits = config->nb_events_limit /4 ; + rsrcs->num_dir_credits = config->nb_events_limit /2 ;if (dlb2->num_dir_credits_override !=-1 ) rsrcs->num_dir_credits = dlb2->num_dir_credits_override; }
@@ -1693,6 +1713,7 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2;struct dlb2_eventdev_port *ev_port;int ret; +uint32_t hw_credit_quanta, sw_credit_quanta;if (dev ==NULL || port_conf ==NULL ) {DLB2_LOG_ERR ("Null parameter\n" );
@@ -1753,9 +1774,25 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev, RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL); ev_port->outstanding_releases =0 ; ev_port->inflight_credits =0 ; - ev_port->credit_update_quanta = dlb2->sw_credit_quanta; ev_port->dlb2 = dlb2;/* reverse link */ +/* Default for worker ports */ + sw_credit_quanta = dlb2->sw_credit_quanta; + hw_credit_quanta = dlb2->hw_credit_quanta; + +if (port_conf->event_port_cfg &RTE_EVENT_PORT_CFG_HINT_PRODUCER ) { +/* Producer type ports. Mostly enqueue */ + sw_credit_quanta =DLB2_SW_CREDIT_P_QUANTA_DEFAULT ; + hw_credit_quanta =DLB2_SW_CREDIT_P_BATCH_SZ ; + } +if (port_conf->event_port_cfg &RTE_EVENT_PORT_CFG_HINT_CONSUMER ) { +/* Consumer type ports. Mostly dequeue */ + sw_credit_quanta =DLB2_SW_CREDIT_C_QUANTA_DEFAULT ; + hw_credit_quanta =DLB2_SW_CREDIT_C_BATCH_SZ ; + } + ev_port->credit_update_quanta = sw_credit_quanta; + ev_port->qm_port.hw_credit_quanta = hw_credit_quanta; +/* Tear down pre-existing port->queue links */ if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED )dlb2_port_link_teardown (dlb2, &dlb2->ev_ports[ev_port_id]);
@@ -2378,7 +2415,8 @@ dlb2_port_credits_get(struct dlb2_port *qm_port, enum dlb2_hw_queue_types type) {uint32_t credits = *qm_port->credit_pool[type]; -uint32_t batch_size =DLB2_SW_CREDIT_BATCH_SZ ; +/* By default hw_credit_quanta is DLB2_SW_CREDIT_BATCH_SZ */ +uint32_t batch_size = qm_port->hw_credit_quanta;if (unlikely (credits < batch_size)) batch_size = credits;
@@ -3112,7 +3150,7 @@ dlb2_event_release(struct dlb2_eventdev *dlb2,static inline void dlb2_port_credits_inc (struct dlb2_port *qm_port,int num) { -uint32_t batch_size =DLB2_SW_CREDIT_BATCH_SZ ; +uint32_t batch_size = qm_port->hw_credit_quanta;/* increment port credits, and return to pool if exceeds threshold */ if (!qm_port->is_directed) {
@@ -4446,6 +4484,7 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev, dlb2->qm_instance.cos_id = dlb2_args->cos_id; dlb2->poll_interval = dlb2_args->poll_interval; dlb2->sw_credit_quanta = dlb2_args->sw_credit_quanta; + dlb2->hw_credit_quanta = dlb2_args->hw_credit_quanta; dlb2->default_depth_thresh = dlb2_args->default_depth_thresh; dlb2->vector_opts_enabled = dlb2_args->vector_opts_enabled;
@@ -4550,6 +4589,7 @@ dlb2_parse_params(const char *params,DLB2_COS_ARG ,DLB2_POLL_INTERVAL_ARG ,DLB2_SW_CREDIT_QUANTA_ARG , +DLB2_HW_CREDIT_QUANTA_ARG ,DLB2_DEPTH_THRESH_ARG ,DLB2_VECTOR_OPTS_ENAB_ARG , NULL };
@@ -4649,7 +4689,18 @@ dlb2_parse_params(const char *params, set_sw_credit_quanta, &dlb2_args->sw_credit_quanta);if (ret !=0 ) { -DLB2_LOG_ERR ("%s: Error parsing sw xredit quanta parameter" , +DLB2_LOG_ERR ("%s: Error parsing sw credit quanta parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist, +DLB2_HW_CREDIT_QUANTA_ARG , + set_hw_credit_quanta, + &dlb2_args->hw_credit_quanta); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hw credit quanta parameter" , name);rte_kvargs_free (kvlist);return ret;
drivers/event/dlb2/dlb2_priv.h +10 -2
@@ -24,7 +24,9 @@/* Default values for command line devargs */ #define DLB2_POLL_INTERVAL_DEFAULT 1000 -#define DLB2_SW_CREDIT_QUANTA_DEFAULT 32 +#define DLB2_SW_CREDIT_QUANTA_DEFAULT 32/* Defaut = Worker */ +#define DLB2_SW_CREDIT_P_QUANTA_DEFAULT 256/* Producer */ +#define DLB2_SW_CREDIT_C_QUANTA_DEFAULT 256/* Consumer */ #define DLB2_DEPTH_THRESH_DEFAULT 256/* command line arg strings */
@@ -36,6 +38,7 @@#define DLB2_COS_ARG "cos"#define DLB2_POLL_INTERVAL_ARG "poll_interval"#define DLB2_SW_CREDIT_QUANTA_ARG "sw_credit_quanta" +#define DLB2_HW_CREDIT_QUANTA_ARG "hw_credit_quanta"#define DLB2_DEPTH_THRESH_ARG "default_depth_thresh"#define DLB2_VECTOR_OPTS_ENAB_ARG "vector_opts_enable"
@@ -72,7 +75,9 @@#define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1/* Note: "- 1" here to support the timeout range check in eventdev_autotest */ #define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1) -#define DLB2_SW_CREDIT_BATCH_SZ 32 +#define DLB2_SW_CREDIT_BATCH_SZ 32/* Default - Worker */ +#define DLB2_SW_CREDIT_P_BATCH_SZ 256/* Producer */ +#define DLB2_SW_CREDIT_C_BATCH_SZ 256/* Consumer */ #define DLB2_NUM_SN_GROUPS 2#define DLB2_MAX_LDB_SN_ALLOC 1024#define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191
@@ -367,6 +372,7 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint16_t hw_credit_quanta; };/* Per-process per-port mmio and memory pointers */
@@ -587,6 +593,7 @@ struct dlb2_eventdev {enum dlb2_cq_poll_modes poll_mode;int poll_interval;int sw_credit_quanta; +int hw_credit_quanta;int default_depth_thresh;uint8_t revision;uint8_t version;
@@ -622,6 +629,7 @@ struct dlb2_devargs {enum dlb2_cos cos_id;int poll_interval;int sw_credit_quanta; +int hw_credit_quanta;int default_depth_thresh;bool vector_opts_enabled; };
drivers/event/dlb2/pf/dlb2_pf.c +1 -0
@@ -618,6 +618,7 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .cos_id = DLB2_COS_DEFAULT, .poll_interval = DLB2_POLL_INTERVAL_DEFAULT, .sw_credit_quanta = DLB2_SW_CREDIT_QUANTA_DEFAULT, + .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT };struct dlb2_eventdev *dlb2;
Signature · 1 line
2.30.2
Re: [dpdk-dev] [PATCH v2 4/4] event/dlb2: optimize credit allocations using port hint flags
Quoted 2 lines · Harry van Haaren
From: "Pathak, Pravin" <[email protected]>
There are the following issues
1) WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name
mismatch: 'From: "Pathak, Pravin" <[email protected]>' != 'Signed-off-by: Pravin Pathak <[email protected]>'
2)
Headline too long:
event/dlb2: optimize credit allocations using port hint flags
Wrong tag:
Invalid patch(es) found - checked 4 patches
check-git-log failed
### event/dlb2: optimize credit allocations using port hint flags
WARNING:TYPO_SPELLING: 'Defaut' may be misspelled - perhaps 'Default'? #156: FILE: drivers/event/dlb2/dlb2_priv.h:27:
+#define DLB2_SW_CREDIT_QUANTA_DEFAULT 32 /* Defaut = Worker */
^^^^^^
I can fix item 2 on merge.
Regarding the author name(1). Can I change to Pravin Pathak <[email protected]> ?
Appreciate a quick reply.
Quoted 220 lines
This commit implements the changes required for using suggested port type hint feature. Each port uses different credit quanta based on port type specified using port configuration flags.
Each port has separate quanta defined in
dlb2_priv.h
Producer and consumer ports will need larger quanta value to reduce number of credit calls they make. Workers can use small quanta as they mostly work out of locally cached credits and don't request/return credits often.Signed-off-by Pathak, Pravin <[email protected]>--- drivers/event/dlb2/dlb2.c | 61 ++++++++++++++++++++++++++++++--- drivers/event/dlb2/dlb2_priv.h | 12 +++++-- drivers/event/dlb2/pf/dlb2_pf.c | 1 + 3 files changed, 67 insertions(+), 7 deletions(-)drivers/event/dlb2/dlb2.c +56
-5@@ -355,6 +355,26 @@ set_sw_credit_quanta(const char *key __rte_unused,return 0 ; } +static int +set_hw_credit_quanta(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *hw_credit_quanta = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (hw_credit_quanta, value); +if (ret <0 ) +return ret; + +return 0 ; +} + static int set_default_depth_thresh(const char *key __rte_unused, const char *value,@@ -769,7 +789,7 @@ dlb2_eventdev_configure(const struct rte_eventdev *dev)if (rsrcs->num_ldb_queues) rsrcs->num_ldb_credits = config->nb_events_limit;if (rsrcs->num_dir_ports) - rsrcs->num_dir_credits = config->nb_events_limit /4 ; + rsrcs->num_dir_credits = config->nb_events_limit /2 ;if (dlb2->num_dir_credits_override !=-1 ) rsrcs->num_dir_credits = dlb2->num_dir_credits_override; }@@ -1693,6 +1713,7 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2;struct dlb2_eventdev_port *ev_port;int ret; +uint32_t hw_credit_quanta, sw_credit_quanta;if (dev ==NULL || port_conf ==NULL ) {DLB2_LOG_ERR ("Null parameter\n" );@@ -1753,9 +1774,25 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev, RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL); ev_port->outstanding_releases =0 ; ev_port->inflight_credits =0 ; - ev_port->credit_update_quanta = dlb2->sw_credit_quanta; ev_port->dlb2 = dlb2;/* reverse link */ +/* Default for worker ports */ + sw_credit_quanta = dlb2->sw_credit_quanta; + hw_credit_quanta = dlb2->hw_credit_quanta; + +if (port_conf->event_port_cfg &RTE_EVENT_PORT_CFG_HINT_PRODUCER ) { +/* Producer type ports. Mostly enqueue */ + sw_credit_quanta =DLB2_SW_CREDIT_P_QUANTA_DEFAULT ; + hw_credit_quanta =DLB2_SW_CREDIT_P_BATCH_SZ ; + } +if (port_conf->event_port_cfg &RTE_EVENT_PORT_CFG_HINT_CONSUMER ) { +/* Consumer type ports. Mostly dequeue */ + sw_credit_quanta =DLB2_SW_CREDIT_C_QUANTA_DEFAULT ; + hw_credit_quanta =DLB2_SW_CREDIT_C_BATCH_SZ ; + } + ev_port->credit_update_quanta = sw_credit_quanta; + ev_port->qm_port.hw_credit_quanta = hw_credit_quanta; +/* Tear down pre-existing port->queue links */ if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED )dlb2_port_link_teardown (dlb2, &dlb2->ev_ports[ev_port_id]);@@ -2378,7 +2415,8 @@ dlb2_port_credits_get(struct dlb2_port *qm_port, enum dlb2_hw_queue_types type) {uint32_t credits = *qm_port->credit_pool[type]; -uint32_t batch_size =DLB2_SW_CREDIT_BATCH_SZ ; +/* By default hw_credit_quanta is DLB2_SW_CREDIT_BATCH_SZ */ +uint32_t batch_size = qm_port->hw_credit_quanta;if (unlikely (credits < batch_size)) batch_size = credits;@@ -3112,7 +3150,7 @@ dlb2_event_release(struct dlb2_eventdev *dlb2,static inline void dlb2_port_credits_inc (struct dlb2_port *qm_port,int num) { -uint32_t batch_size =DLB2_SW_CREDIT_BATCH_SZ ; +uint32_t batch_size = qm_port->hw_credit_quanta;/* increment port credits, and return to pool if exceeds threshold */ if (!qm_port->is_directed) {@@ -4446,6 +4484,7 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev, dlb2->qm_instance.cos_id = dlb2_args->cos_id; dlb2->poll_interval = dlb2_args->poll_interval; dlb2->sw_credit_quanta = dlb2_args->sw_credit_quanta; + dlb2->hw_credit_quanta = dlb2_args->hw_credit_quanta; dlb2->default_depth_thresh = dlb2_args->default_depth_thresh; dlb2->vector_opts_enabled = dlb2_args->vector_opts_enabled;@@ -4550,6 +4589,7 @@ dlb2_parse_params(const char *params,DLB2_COS_ARG ,DLB2_POLL_INTERVAL_ARG ,DLB2_SW_CREDIT_QUANTA_ARG , +DLB2_HW_CREDIT_QUANTA_ARG ,DLB2_DEPTH_THRESH_ARG ,DLB2_VECTOR_OPTS_ENAB_ARG , NULL };@@ -4649,7 +4689,18 @@ dlb2_parse_params(const char *params, set_sw_credit_quanta, &dlb2_args->sw_credit_quanta);if (ret !=0 ) { -DLB2_LOG_ERR ("%s: Error parsing sw xredit quanta parameter" , +DLB2_LOG_ERR ("%s: Error parsing sw credit quanta parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist, +DLB2_HW_CREDIT_QUANTA_ARG , + set_hw_credit_quanta, + &dlb2_args->hw_credit_quanta); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hw credit quanta parameter" , name);rte_kvargs_free (kvlist);return ret;drivers/event/dlb2/dlb2_priv.h +10
-2@@ -24,7 +24,9 @@/* Default values for command line devargs */ #define DLB2_POLL_INTERVAL_DEFAULT 1000 -#define DLB2_SW_CREDIT_QUANTA_DEFAULT 32 +#define DLB2_SW_CREDIT_QUANTA_DEFAULT 32/* Defaut = Worker */ +#define DLB2_SW_CREDIT_P_QUANTA_DEFAULT 256/* Producer */ +#define DLB2_SW_CREDIT_C_QUANTA_DEFAULT 256/* Consumer */ #define DLB2_DEPTH_THRESH_DEFAULT 256/* command line arg strings */ @@ -36,6 +38,7 @@#define DLB2_COS_ARG "cos"#define DLB2_POLL_INTERVAL_ARG "poll_interval"#define DLB2_SW_CREDIT_QUANTA_ARG "sw_credit_quanta" +#define DLB2_HW_CREDIT_QUANTA_ARG "hw_credit_quanta"#define DLB2_DEPTH_THRESH_ARG "default_depth_thresh"#define DLB2_VECTOR_OPTS_ENAB_ARG "vector_opts_enable"@@ -72,7 +75,9 @@#define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1/* Note: "- 1" here to support the timeout range check in eventdev_autotest */ #define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1) -#define DLB2_SW_CREDIT_BATCH_SZ 32 +#define DLB2_SW_CREDIT_BATCH_SZ 32/* Default - Worker */ +#define DLB2_SW_CREDIT_P_BATCH_SZ 256/* Producer */ +#define DLB2_SW_CREDIT_C_BATCH_SZ 256/* Consumer */ #define DLB2_NUM_SN_GROUPS 2#define DLB2_MAX_LDB_SN_ALLOC 1024#define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191@@ -367,6 +372,7 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint16_t hw_credit_quanta; };/* Per-process per-port mmio and memory pointers */ @@ -587,6 +593,7 @@ struct dlb2_eventdev {enum dlb2_cq_poll_modes poll_mode;int poll_interval;int sw_credit_quanta; +int hw_credit_quanta;int default_depth_thresh;uint8_t revision;uint8_t version;@@ -622,6 +629,7 @@ struct dlb2_devargs {enum dlb2_cos cos_id;int poll_interval;int sw_credit_quanta; +int hw_credit_quanta;int default_depth_thresh;bool vector_opts_enabled; };drivers/event/dlb2/pf/dlb2_pf.c +1
-1@@ -618,6 +618,7 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .cos_id = DLB2_COS_DEFAULT, .poll_interval = DLB2_POLL_INTERVAL_DEFAULT, .sw_credit_quanta = DLB2_SW_CREDIT_QUANTA_DEFAULT, + .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT };struct dlb2_eventdev *dlb2; --2.30.2
Re: [dpdk-dev] [PATCH v2 4/4] event/dlb2: optimize credit allocations using port hint flags
Hi Jerin,
Quoted 13 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Wednesday, October 20, 2021 2:19 PM
To: Van Haaren, Harry <[email protected]>
Cc: dpdk-dev <[email protected]>; Jerin Jacob <[email protected]>; Pathak, Pravin <[email protected]>; Shetty, Rashmi <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 4/4] event/dlb2: optimize credit allocations using port hint flagsQuoted 1 line · Harry van Haaren
Quoted 7 lines
Quoted 1 line
From: "Pathak, Pravin" <[email protected]>
There are the following issues
1) WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name
mismatch: 'From: "Pathak, Pravin" <[email protected]>' != 'Signed-off-by: Pravin Pathak <[email protected]>'
Signed off by line is correct, the "From" line is incorrect.
Quoted 3 lines
2)
Headline too long:
event/dlb2: optimize credit allocations using port hint flags
Suggest this headline (which brings under the 60 chars?)
event/dlb2: optimize credit allocations with port hints
Quoted 8 lines
Wrong tag:
Signed-off-by Pathak, Pravin <[email protected]>Invalid patch(es) found - checked 4 patches
check-git-log failed### event/dlb2: optimize credit allocations using port hint flags
Quoted 8 lines
WARNING:TYPO_SPELLING: 'Defaut' may be misspelled - perhaps 'Default'? #156: FILE:
drivers/event/dlb2/dlb2_priv.h:27:
+#defineDLB2_SW_CREDIT_QUANTA_DEFAULT32 /* Defaut = Worker */^^^^^^I can fix item 2 on merge.
Regarding the author name(1). Can I change to Pravin Pathak <[email protected]> ?
Yes, thanks.
Quoted 1 line
Appreciate a quick reply.
Thanks for review & response.
<snip patch contents>
Jerin Jacob
AppliedRe: [dpdk-dev] [PATCH v2 4/4] event/dlb2: optimize credit allocations using port hint flags
Quoted 49 lines · Harry
Hi Jerin,
Quoted 13 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Wednesday, October 20, 2021 2:19 PM
To: Van Haaren, Harry <[email protected]>
Cc: dpdk-dev <[email protected]>; Jerin Jacob <[email protected]>; Pathak, Pravin <[email protected]>; Shetty, Rashmi <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 4/4] event/dlb2: optimize credit allocations using port hint flagsQuoted 1 line · Harry van Haaren
Quoted 7 lines
Quoted 1 line
From: "Pathak, Pravin" <[email protected]>
There are the following issues
1) WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name
mismatch: 'From: "Pathak, Pravin" <[email protected]>' != 'Signed-off-by: Pravin Pathak <[email protected]>'Signed off by line is correct, the "From" line is incorrect.
Quoted 3 lines
2)
Headline too long:
event/dlb2: optimize credit allocations using port hint flagsSuggest this headline (which brings under the 60 chars?)
event/dlb2: optimize credit allocations with port hints
Quoted 14 lines
Wrong tag:
Signed-off-by Pathak, Pravin <[email protected]>Invalid patch(es) found - checked 4 patches
check-git-log failed### event/dlb2: optimize credit allocations using port hint flags
WARNING:TYPO_SPELLING: 'Defaut' may be misspelled - perhaps 'Default'? #156: FILE:
drivers/event/dlb2/dlb2_priv.h:27:
+#defineDLB2_SW_CREDIT_QUANTA_DEFAULT32 /* Defaut = Worker */^^^^^^I can fix item 2 on merge.
Quoted 8 lines
Quoted 2 lines
Regarding the author name(1). Can I change to Pravin Pathak <[email protected]> ?
Yes, thanks.
Quoted 1 line
Appreciate a quick reply.
Thanks for review & response.
Added Acked-by: Jerin Jacob <[email protected]> to 1,2,3 patches in the series.
Applied to dpdk-next-eventdev/for-main. Thanks.
Quoted 2 lines
<snip patch contents>
PATCH 2/2 examples/eventdev_pipeline: use port config hints
In reply to Harry van HaarenThis commit adds the per-port hints added to the eventdev API, indicating which eventdev ports will be used for producing, forwarding, or consuming events from the system.
--- examples/eventdev_pipeline/pipeline_worker_generic.c | 2 ++ examples/eventdev_pipeline/pipeline_worker_tx.c | 2 ++ 2 files changed, 4 insertions(+)
examples/eventdev_pipeline/pipeline_worker_generic.c +2 -0
@@ -139,6 +139,7 @@ setup_eventdev_generic(struct worker_data *worker_data) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_WORKER, };struct rte_event_queue_conf wkr_q_conf = { .schedule_type = cdata.queue_type,
@@ -419,6 +420,7 @@ init_adapters(uint16_t nb_ports) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_PRODUCER, };if (adptr_p_conf.new_event_threshold > dev_info.max_num_events)
examples/eventdev_pipeline/pipeline_worker_tx.c +2 -0
@@ -446,6 +446,7 @@ setup_eventdev_worker_tx_enq(struct worker_data *worker_data) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_WORKER, };struct rte_event_queue_conf wkr_q_conf = { .schedule_type = cdata.queue_type,
@@ -747,6 +748,7 @@ init_adapters(uint16_t nb_ports) .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, .new_event_threshold = 4096, + .event_port_cfg = RTE_EVENT_PORT_CFG_HINT_PRODUCER, };init_ports (nb_ports);
Signature · 1 line
2.30.2