1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
8 #include <rte_malloc.h>
11 #include "l3fwd_event.h"
13 struct l3fwd_event_resources *
14 l3fwd_get_eventdev_rsrc(void)
16 static struct l3fwd_event_resources *rsrc;
21 rsrc = rte_zmalloc("l3fwd", sizeof(struct l3fwd_event_resources), 0);
23 rsrc->sched_type = RTE_SCHED_TYPE_ATOMIC;
24 rsrc->eth_rx_queues = 1;
28 rte_exit(EXIT_FAILURE, "Unable to allocate memory for eventdev cfg\n");
34 l3fwd_event_capability_setup(void)
36 struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
41 RTE_ETH_FOREACH_DEV(i) {
42 ret = rte_event_eth_tx_adapter_caps_get(0, i, &caps);
44 rte_exit(EXIT_FAILURE,
45 "Invalid capability for Tx adptr port %d\n",
48 evt_rsrc->tx_mode_q |= !(caps &
49 RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT);
52 if (evt_rsrc->tx_mode_q)
53 l3fwd_event_set_generic_ops(&evt_rsrc->ops);
55 l3fwd_event_set_internal_port_ops(&evt_rsrc->ops);
59 l3fwd_event_resource_setup(void)
61 struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
63 if (!evt_rsrc->enabled)
66 if (!rte_event_dev_count())
67 rte_exit(EXIT_FAILURE, "No Eventdev found");
69 /* Setup eventdev capability callbacks */
70 l3fwd_event_capability_setup();