On Tue, Aug 1, 2023 at 3:10 PM Naga Harish K S V <s.v.naga.haris...@intel.com> wrote: > > The adapter create APIs such as rte_event_eth_rx_adapter_create_ext() and > rte_event_eth_rx_adapter_create() are updated to take additional argument > as a pointer of type struct rte_event_eth_rx_adapter_params.
Please avod API prototype changes . It will be pain for application which needs to manage both. IMO, It is not worth it. > > The API rte_event_eth_rx_adapter_create_with_params() is > deprecated. > > Signed-off-by: Naga Harish K S V <s.v.naga.haris...@intel.com> > --- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test/test_event_eth_rx_adapter.c | 22 ++--- > app/test/test_security_inline_proto.c | 2 +- > .../pipeline_worker_generic.c | 2 +- > .../eventdev_pipeline/pipeline_worker_tx.c | 2 +- > examples/ipsec-secgw/event_helper.c | 2 +- > examples/l2fwd-event/l2fwd_event_generic.c | 2 +- > .../l2fwd-event/l2fwd_event_internal_port.c | 2 +- > examples/l3fwd/l3fwd_event_generic.c | 2 +- > examples/l3fwd/l3fwd_event_internal_port.c | 2 +- > lib/eventdev/rte_event_eth_rx_adapter.c | 96 ++++++++----------- > lib/eventdev/rte_event_eth_rx_adapter.h | 34 +------ > lib/eventdev/version.map | 1 - > 14 files changed, 67 insertions(+), 106 deletions(-) > > diff --git a/app/test-eventdev/test_perf_common.c > b/app/test-eventdev/test_perf_common.c > index 5e0255cfeb..0c6c252f7d 100644 > --- a/app/test-eventdev/test_perf_common.c > +++ b/app/test-eventdev/test_perf_common.c > @@ -1002,7 +1002,7 @@ perf_event_rx_adapter_setup(struct evt_options *opt, > uint8_t stride, > } > queue_conf.ev.queue_id = prod * stride; > ret = rte_event_eth_rx_adapter_create(prod, opt->dev_id, > - &prod_conf); > + &prod_conf, NULL); > if (ret) { > evt_err("failed to create rx adapter[%d]", prod); > return ret; > diff --git a/app/test-eventdev/test_pipeline_common.c > b/app/test-eventdev/test_pipeline_common.c > index b111690b7c..5ae175f2c7 100644 > --- a/app/test-eventdev/test_pipeline_common.c > +++ b/app/test-eventdev/test_pipeline_common.c > @@ -571,7 +571,7 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, > uint8_t stride, > } > queue_conf.ev.queue_id = prod * stride; > ret = rte_event_eth_rx_adapter_create(prod, opt->dev_id, > - &prod_conf); > + &prod_conf, NULL); > if (ret) { > evt_err("failed to create rx adapter[%d]", prod); > return ret; > diff --git a/app/test/test_event_eth_rx_adapter.c > b/app/test/test_event_eth_rx_adapter.c > index 52d146f97c..42edcb625a 100644 > --- a/app/test/test_event_eth_rx_adapter.c > +++ b/app/test/test_event_eth_rx_adapter.c > @@ -401,7 +401,7 @@ adapter_create(void) > rx_p_conf.dequeue_depth = dev_info.max_event_port_dequeue_depth; > rx_p_conf.enqueue_depth = dev_info.max_event_port_enqueue_depth; > err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, > - &rx_p_conf); > + &rx_p_conf, NULL); > TEST_ASSERT(err == 0, "Expected 0 got %d", err); > > return err; > @@ -427,17 +427,17 @@ adapter_create_with_params(void) > rxa_params.use_queue_event_buf = false; > rxa_params.event_buf_size = 0; > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); > > rxa_params.use_queue_event_buf = true; > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == 0, "Expected 0 got %d", err); > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == -EEXIST, "Expected -EEXIST got %d", err); > > @@ -567,15 +567,15 @@ adapter_create_free(void) > }; > > err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, > - NULL); > + NULL, NULL); > TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); > > err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, > - &rx_p_conf); > + &rx_p_conf, NULL); > TEST_ASSERT(err == 0, "Expected 0 got %d", err); > > err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > - TEST_DEV_ID, &rx_p_conf); > + TEST_DEV_ID, &rx_p_conf, NULL); > TEST_ASSERT(err == -EEXIST, "Expected -EEXIST %d got %d", -EEXIST, > err); > > err = rte_event_eth_rx_adapter_free(TEST_INST_ID); > @@ -605,20 +605,20 @@ adapter_create_free_with_params(void) > .event_buf_size = 1024 > }; > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, NULL, NULL); > TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == 0, "Expected 0 got %d", err); > > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == -EEXIST, "Expected -EEXIST %d got %d", -EEXIST, > err); > > rxa_params.event_buf_size = 0; > - err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, > + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, > TEST_DEV_ID, &rx_p_conf, &rxa_params); > TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); > > diff --git a/app/test/test_security_inline_proto.c > b/app/test/test_security_inline_proto.c > index 45aa742c6b..fc240201a3 100644 > --- a/app/test/test_security_inline_proto.c > +++ b/app/test/test_security_inline_proto.c > @@ -1872,7 +1872,7 @@ event_inline_ipsec_testsuite_setup(void) > > /* Create Rx adapter */ > ret = rte_event_eth_rx_adapter_create(rx_adapter_id, eventdev_id, > - &ev_port_conf); > + &ev_port_conf, NULL); > if (ret < 0) { > printf("Failed to create rx adapter %d\n", ret); > return ret; > diff --git a/examples/eventdev_pipeline/pipeline_worker_generic.c > b/examples/eventdev_pipeline/pipeline_worker_generic.c > index 783f68c91e..74510338ba 100644 > --- a/examples/eventdev_pipeline/pipeline_worker_generic.c > +++ b/examples/eventdev_pipeline/pipeline_worker_generic.c > @@ -436,7 +436,7 @@ init_adapters(uint16_t nb_ports) > init_ports(nb_ports); > /* Create one adapter for all the ethernet ports. */ > ret = rte_event_eth_rx_adapter_create(cdata.rx_adapter_id, evdev_id, > - &adptr_p_conf); > + &adptr_p_conf, NULL); > if (ret) > rte_exit(EXIT_FAILURE, "failed to create rx adapter[%d]", > cdata.rx_adapter_id); > diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c > b/examples/eventdev_pipeline/pipeline_worker_tx.c > index 98a52f3892..88619d6c2e 100644 > --- a/examples/eventdev_pipeline/pipeline_worker_tx.c > +++ b/examples/eventdev_pipeline/pipeline_worker_tx.c > @@ -793,7 +793,7 @@ init_adapters(uint16_t nb_ports) > uint32_t service_id; > > ret = rte_event_eth_rx_adapter_create(i, evdev_id, > - &adptr_p_conf); > + &adptr_p_conf, NULL); > if (ret) > rte_exit(EXIT_FAILURE, > "failed to create rx adapter[%d]", i); > diff --git a/examples/ipsec-secgw/event_helper.c > b/examples/ipsec-secgw/event_helper.c > index 89fb7e62a5..28d6778134 100644 > --- a/examples/ipsec-secgw/event_helper.c > +++ b/examples/ipsec-secgw/event_helper.c > @@ -1035,7 +1035,7 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf, > > /* Create Rx adapter */ > ret = rte_event_eth_rx_adapter_create(adapter->adapter_id, > - adapter->eventdev_id, &port_conf); > + adapter->eventdev_id, &port_conf, NULL); > if (ret < 0) { > EH_LOG_ERR("Failed to create rx adapter %d", ret); > return ret; > diff --git a/examples/l2fwd-event/l2fwd_event_generic.c > b/examples/l2fwd-event/l2fwd_event_generic.c > index 1977e23261..4360b20aa0 100644 > --- a/examples/l2fwd-event/l2fwd_event_generic.c > +++ b/examples/l2fwd-event/l2fwd_event_generic.c > @@ -235,7 +235,7 @@ l2fwd_rx_tx_adapter_setup_generic(struct l2fwd_resources > *rsrc) > } > > ret = rte_event_eth_rx_adapter_create(rx_adptr_id, event_d_id, > - &evt_rsrc->def_p_conf); > + &evt_rsrc->def_p_conf, NULL); > if (ret) > rte_panic("Failed to create rx adapter\n"); > > diff --git a/examples/l2fwd-event/l2fwd_event_internal_port.c > b/examples/l2fwd-event/l2fwd_event_internal_port.c > index 717a7bceb8..542890f354 100644 > --- a/examples/l2fwd-event/l2fwd_event_internal_port.c > +++ b/examples/l2fwd-event/l2fwd_event_internal_port.c > @@ -253,7 +253,7 @@ l2fwd_rx_tx_adapter_setup_internal_port(struct > l2fwd_resources *rsrc) > } > > ret = rte_event_eth_rx_adapter_create(adapter_id, event_d_id, > - &evt_rsrc->def_p_conf); > + &evt_rsrc->def_p_conf, NULL); > if (ret) > rte_panic("Failed to create rx adapter[%d]\n", > adapter_id); > diff --git a/examples/l3fwd/l3fwd_event_generic.c > b/examples/l3fwd/l3fwd_event_generic.c > index c80573fc58..88e7af538e 100644 > --- a/examples/l3fwd/l3fwd_event_generic.c > +++ b/examples/l3fwd/l3fwd_event_generic.c > @@ -217,7 +217,7 @@ l3fwd_rx_tx_adapter_setup_generic(void) > } > > ret = rte_event_eth_rx_adapter_create(rx_adptr_id, event_d_id, > - &evt_rsrc->def_p_conf); > + &evt_rsrc->def_p_conf, NULL); > if (ret) > rte_panic("Failed to create rx adapter\n"); > > diff --git a/examples/l3fwd/l3fwd_event_internal_port.c > b/examples/l3fwd/l3fwd_event_internal_port.c > index 32cf657148..dc8b5013cb 100644 > --- a/examples/l3fwd/l3fwd_event_internal_port.c > +++ b/examples/l3fwd/l3fwd_event_internal_port.c > @@ -246,7 +246,7 @@ l3fwd_rx_tx_adapter_setup_internal_port(void) > } > > ret = rte_event_eth_rx_adapter_create(adapter_id, event_d_id, > - &evt_rsrc->def_p_conf); > + &evt_rsrc->def_p_conf, > NULL); > if (ret) > rte_panic("Failed to create rx adapter[%d]\n", > adapter_id); > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c > b/lib/eventdev/rte_event_eth_rx_adapter.c > index f7f93ccdfd..263d6f54b7 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > @@ -2485,90 +2485,78 @@ rxa_create(uint8_t id, uint8_t dev_id, > return 0; > } > > -int > -rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id, > - rte_event_eth_rx_adapter_conf_cb conf_cb, > - void *conf_arg) > +static int __rte_cold > +rxa_config_params_validate(struct rte_event_eth_rx_adapter_params > *rxa_params, > + struct rte_event_eth_rx_adapter_params > *temp_params) > { > - struct rte_event_eth_rx_adapter_params rxa_params = {0}; > - > - /* use default values for adapter params */ > - rxa_params.event_buf_size = ETH_EVENT_BUFFER_SIZE; > - rxa_params.use_queue_event_buf = false; > - > - return rxa_create(id, dev_id, &rxa_params, conf_cb, conf_arg); > -} > - > -int > -rte_event_eth_rx_adapter_create_with_params(uint8_t id, uint8_t dev_id, > - struct rte_event_port_conf *port_config, > - struct rte_event_eth_rx_adapter_params *rxa_params) > -{ > - struct rte_event_port_conf *pc; > - int ret; > - struct rte_event_eth_rx_adapter_params temp_params = {0}; > - > - if (port_config == NULL) > - return -EINVAL; > - > if (rxa_params == NULL) { > /* use default values if rxa_params is NULL */ > - rxa_params = &temp_params; > - rxa_params->event_buf_size = ETH_EVENT_BUFFER_SIZE; > - rxa_params->use_queue_event_buf = false; > - } else if ((!rxa_params->use_queue_event_buf && > - rxa_params->event_buf_size == 0) || > - (rxa_params->use_queue_event_buf && > - rxa_params->event_buf_size != 0)) { > - RTE_EDEV_LOG_ERR("Invalid adapter params\n"); > + temp_params->event_buf_size = ETH_EVENT_BUFFER_SIZE; > + temp_params->use_queue_event_buf = false; > + } else if (!rxa_params->use_queue_event_buf && > + rxa_params->event_buf_size == 0) { > + RTE_EDEV_LOG_ERR("event buffer size can't be zero\n"); > return -EINVAL; > - } else if (!rxa_params->use_queue_event_buf) { > + } else if (rxa_params->use_queue_event_buf && > + rxa_params->event_buf_size != 0) { > + RTE_EDEV_LOG_ERR("event buffer size needs to be configured " > + "as part of queue add\n"); > + return -EINVAL; > + } else { > + *temp_params = *rxa_params; > /* adjust event buff size with BATCH_SIZE used for fetching > * packets from NIC rx queues to get full buffer utilization > * and prevent unnecessary rollovers. > */ > - > - rxa_params->event_buf_size = > - RTE_ALIGN(rxa_params->event_buf_size, BATCH_SIZE); > - rxa_params->event_buf_size += (BATCH_SIZE + BATCH_SIZE); > + if (!temp_params->use_queue_event_buf) { > + temp_params->event_buf_size = > + RTE_ALIGN(temp_params->event_buf_size, > BATCH_SIZE); > + temp_params->event_buf_size += (BATCH_SIZE + > BATCH_SIZE); > + } > } > > - pc = rte_malloc(NULL, sizeof(*pc), 0); > - if (pc == NULL) > - return -ENOMEM; > - > - *pc = *port_config; > + return 0; > +} > > - ret = rxa_create(id, dev_id, rxa_params, rxa_default_conf_cb, pc); > - if (ret) > - rte_free(pc); > +int > +rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id, > + rte_event_eth_rx_adapter_conf_cb conf_cb, > + void *conf_arg, > + struct rte_event_eth_rx_adapter_params *rxa_params) > +{ > + struct rte_event_eth_rx_adapter_params temp_params = {0}; > + int ret; > > - rte_eventdev_trace_eth_rx_adapter_create_with_params(id, dev_id, > - port_config, rxa_params, ret); > + ret = rxa_config_params_validate(rxa_params, &temp_params); > + if (ret != 0) > + return ret; > > - return ret; > + return rxa_create(id, dev_id, &temp_params, conf_cb, conf_arg); > } > > int > rte_event_eth_rx_adapter_create(uint8_t id, uint8_t dev_id, > - struct rte_event_port_conf *port_config) > + struct rte_event_port_conf *port_config, > + struct rte_event_eth_rx_adapter_params *rxa_params) > { > struct rte_event_port_conf *pc; > int ret; > + struct rte_event_eth_rx_adapter_params temp_params = {0}; > > if (port_config == NULL) > return -EINVAL; > > - RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + ret = rxa_config_params_validate(rxa_params, &temp_params); > + if (ret != 0) > + return ret; > > pc = rte_malloc(NULL, sizeof(*pc), 0); > if (pc == NULL) > return -ENOMEM; > + > *pc = *port_config; > > - ret = rte_event_eth_rx_adapter_create_ext(id, dev_id, > - rxa_default_conf_cb, > - pc); > + ret = rxa_create(id, dev_id, &temp_params, rxa_default_conf_cb, pc); > if (ret) > rte_free(pc); > return ret; > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h > b/lib/eventdev/rte_event_eth_rx_adapter.h > index fe2a6bdd2c..35bf303079 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.h > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h > @@ -26,7 +26,6 @@ > * The ethernet Rx event adapter's functions are: > * - rte_event_eth_rx_adapter_create_ext() > * - rte_event_eth_rx_adapter_create() > - * - rte_event_eth_rx_adapter_create_with_params() > * - rte_event_eth_rx_adapter_free() > * - rte_event_eth_rx_adapter_queue_add() > * - rte_event_eth_rx_adapter_queue_del() > @@ -45,7 +44,7 @@ > * > * The application creates an ethernet to event adapter using > * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create() > - * or rte_event_eth_rx_adapter_create_with_params() functions. > + * functions. > * > * The adapter needs to know which ethernet rx queues to poll for mbufs as > well > * as event device parameters such as the event queue identifier, event > @@ -399,8 +398,9 @@ typedef uint16_t > (*rte_event_eth_rx_adapter_cb_fn)(uint16_t eth_dev_id, > * - <0: Error code on failure > */ > int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id, > - rte_event_eth_rx_adapter_conf_cb conf_cb, > - void *conf_arg); > + rte_event_eth_rx_adapter_conf_cb conf_cb, > + void *conf_arg, > + struct rte_event_eth_rx_adapter_params *rxa_params); > > /** > * Create a new ethernet Rx event adapter with the specified identifier. > @@ -440,32 +440,6 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, > uint8_t dev_id, > * - <0: Error code on failure > */ > int rte_event_eth_rx_adapter_create(uint8_t id, uint8_t dev_id, > - struct rte_event_port_conf *port_config); > - > -/** > - * This is a variant of rte_event_eth_rx_adapter_create() with additional > - * adapter params specified in ``struct rte_event_eth_rx_adapter_params``. > - * > - * @param id > - * The identifier of the ethernet Rx event adapter. > - * > - * @param dev_id > - * The identifier of the event device to configure. > - * > - * @param port_config > - * Argument of type *rte_event_port_conf* that is passed to the conf_cb > - * function. > - * > - * @param rxa_params > - * Pointer to struct rte_event_eth_rx_adapter_params. > - * In case of NULL, default values are used. > - * > - * @return > - * - 0: Success > - * - <0: Error code on failure > - */ > -__rte_experimental > -int rte_event_eth_rx_adapter_create_with_params(uint8_t id, uint8_t dev_id, > struct rte_event_port_conf *port_config, > struct rte_event_eth_rx_adapter_params *rxa_params); > > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index b03c10d99f..1cf58f0d6c 100644 > --- a/lib/eventdev/version.map > +++ b/lib/eventdev/version.map > @@ -101,7 +101,6 @@ EXPERIMENTAL { > global: > > # added in 21.11 > - rte_event_eth_rx_adapter_create_with_params; > rte_event_eth_rx_adapter_queue_conf_get; > rte_event_eth_rx_adapter_queue_stats_get; > rte_event_eth_rx_adapter_queue_stats_reset; > -- > 2.25.1 >