+int
+pipeline_event_tx_service_setup(struct evt_test *test, struct evt_options *opt,
+ uint8_t tx_queue_id, uint8_t tx_port_id,
+ const struct rte_event_port_conf p_conf)
+{
+ int ret;
+ struct rte_service_spec serv;
+ struct test_pipeline *t = evt_test_priv(test);
+ struct tx_service_data *tx = &t->tx_service;
+
+ ret = rte_event_port_setup(opt->dev_id, tx_port_id, &p_conf);
+ if (ret) {
+ evt_err("failed to setup port %d", tx_port_id);
+ return ret;
+ }
+
+ if (rte_event_port_link(opt->dev_id, tx_port_id, &tx_queue_id,
+ NULL, 1) != 1) {
+ evt_err("failed to link queues to port %d", tx_port_id);
+ return -EINVAL;
+ }
+
+ tx->dev_id = opt->dev_id;
+ tx->queue_id = tx_queue_id;
+ tx->port_id = tx_port_id;
+ tx->nb_ethports = rte_eth_dev_count();
+ tx->t = t;
+
+ /* Register Tx service */
+ memset(&serv, 0, sizeof(struct rte_service_spec));
+ snprintf(serv.name, sizeof(serv.name), "Tx_service");
+
+ if (evt_has_burst_mode(opt->dev_id))
+ serv.callback = pipeline_event_tx_burst_service_func;
+ else
+ serv.callback = pipeline_event_tx_service_func;
+
+ serv.callback_userdata = (void *)tx;
+ ret = rte_service_component_register(&serv, &tx->service_id);
+ if (ret) {
+ evt_err("failed to register Tx service");
+ return ret;
+ }
+
+ ret = evt_service_setup(tx->service_id);
+ if (ret) {
+ evt_err("Failed to setup service core for Tx service\n");
+ return ret;
+ }
+
+ rte_service_runstate_set(tx->service_id, 1);
+
+ return 0;
+}
+
+