1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
6 #include <rte_ethdev.h>
8 #include <rte_graph_worker.h>
11 #include "ethdev_tx_priv.h"
13 static struct ethdev_tx_node_main ethdev_tx_main;
16 ethdev_tx_node_process(struct rte_graph *graph, struct rte_node *node,
17 void **objs, uint16_t nb_objs)
19 ethdev_tx_node_ctx_t *ctx = (ethdev_tx_node_ctx_t *)node->ctx;
27 count = rte_eth_tx_burst(port, queue, (struct rte_mbuf **)objs,
30 /* Redirect unsent pkts to drop node */
31 if (count != nb_objs) {
32 rte_node_enqueue(graph, node, ETHDEV_TX_NEXT_PKT_DROP,
33 &objs[count], nb_objs - count);
40 ethdev_tx_node_init(const struct rte_graph *graph, struct rte_node *node)
42 ethdev_tx_node_ctx_t *ctx = (ethdev_tx_node_ctx_t *)node->ctx;
43 uint64_t port_id = RTE_MAX_ETHPORTS;
46 /* Find our port id */
47 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
48 if (ethdev_tx_main.nodes[i] == node->id) {
53 RTE_VERIFY(port_id < RTE_MAX_ETHPORTS);
55 /* Update port and queue */
57 ctx->queue = graph->id;
62 struct ethdev_tx_node_main *
63 ethdev_tx_node_data_get(void)
65 return ðdev_tx_main;
68 static struct rte_node_register ethdev_tx_node_base = {
69 .process = ethdev_tx_node_process,
72 .init = ethdev_tx_node_init,
74 .nb_edges = ETHDEV_TX_NEXT_MAX,
76 [ETHDEV_TX_NEXT_PKT_DROP] = "pkt_drop",
80 struct rte_node_register *
81 ethdev_tx_node_get(void)
83 return ðdev_tx_node_base;
86 RTE_NODE_REGISTER(ethdev_tx_node_base);