DPDK  22.11.0-rc0
rte_event_eth_tx_adapter.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation.
3  */
4 
5 #ifndef _RTE_EVENT_ETH_TX_ADAPTER_
6 #define _RTE_EVENT_ETH_TX_ADAPTER_
7 
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 
80 #include <stdint.h>
81 
82 #include <rte_mbuf.h>
83 
84 #include "rte_eventdev.h"
85 
93  uint8_t event_port_id;
98  uint32_t max_nb_tx;
103 };
104 
125 typedef int (*rte_event_eth_tx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
126  struct rte_event_eth_tx_adapter_conf *conf,
127  void *arg);
128 
133  uint64_t tx_retry;
135  uint64_t tx_packets;
137  uint64_t tx_dropped;
139 };
140 
155 int
156 rte_event_eth_tx_adapter_create(uint8_t id, uint8_t dev_id,
157  struct rte_event_port_conf *port_config);
158 
176 int
177 rte_event_eth_tx_adapter_create_ext(uint8_t id, uint8_t dev_id,
179  void *conf_arg);
180 
191 int
193 
203 int
205 
215 int
217 
233 int
235  uint16_t eth_dev_id,
236  int32_t queue);
237 
254 int
256  uint16_t eth_dev_id,
257  int32_t queue);
258 
268 static __rte_always_inline void
269 rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue)
270 {
271  pkt->hash.txadapter.txq = queue;
272 }
273 
284 static __rte_always_inline uint16_t
286 {
287  return pkt->hash.txadapter.txq;
288 }
289 
303 int
305 
306 #define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST 0x1
307 
354 static inline uint16_t
356  uint8_t port_id,
357  struct rte_event ev[],
358  uint16_t nb_events,
359  const uint8_t flags)
360 {
361  const struct rte_event_fp_ops *fp_ops;
362  void *port;
363 
364  fp_ops = &rte_event_fp_ops[dev_id];
365  port = fp_ops->data[port_id];
366 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
367  if (dev_id >= RTE_EVENT_MAX_DEVS ||
368  port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
369  rte_errno = EINVAL;
370  return 0;
371  }
372 
373  if (port == NULL) {
374  rte_errno = EINVAL;
375  return 0;
376  }
377 #endif
378  rte_eventdev_trace_eth_tx_adapter_enqueue(dev_id, port_id, ev,
379  nb_events, flags);
380  if (flags)
381  return fp_ops->txa_enqueue_same_dest(port, ev, nb_events);
382  else
383  return fp_ops->txa_enqueue(port, ev, nb_events);
384 }
385 
397 int
399  struct rte_event_eth_tx_adapter_stats *stats);
400 
410 int
412 
426 int
427 rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id);
428 
446 __rte_experimental
447 int
448 rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id,
449  uint16_t tx_queue_id,
450  uint8_t *txa_inst_id);
481 __rte_experimental
482 int
483 rte_event_eth_tx_adapter_queue_start(uint16_t eth_dev_id, uint16_t tx_queue_id);
484 
500 __rte_experimental
501 int
502 rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
503 
504 #ifdef __cplusplus
505 }
506 #endif
507 #endif /* _RTE_EVENT_ETH_TX_ADAPTER_ */
#define __rte_always_inline
Definition: rte_common.h:255
int rte_event_eth_tx_adapter_start(uint8_t id)
#define rte_errno
Definition: rte_errno.h:29
static uint16_t rte_event_eth_tx_adapter_enqueue(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], uint16_t nb_events, const uint8_t flags)
int rte_event_eth_tx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id, int32_t queue)
int rte_event_eth_tx_adapter_stop(uint8_t id)
int rte_event_eth_tx_adapter_queue_add(uint8_t id, uint16_t eth_dev_id, int32_t queue)
static __rte_always_inline void rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue)
int rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
__rte_experimental int rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id, uint16_t tx_queue_id, uint8_t *txa_inst_id)
static __rte_always_inline uint16_t rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)
__rte_experimental int rte_event_eth_tx_adapter_queue_start(uint16_t eth_dev_id, uint16_t tx_queue_id)
int rte_event_eth_tx_adapter_stats_reset(uint8_t id)
int rte_event_eth_tx_adapter_stats_get(uint8_t id, struct rte_event_eth_tx_adapter_stats *stats)
int rte_event_eth_tx_adapter_create(uint8_t id, uint8_t dev_id, struct rte_event_port_conf *port_config)
int(* rte_event_eth_tx_adapter_conf_cb)(uint8_t id, uint8_t dev_id, struct rte_event_eth_tx_adapter_conf *conf, void *arg)
int rte_event_eth_tx_adapter_free(uint8_t id)
__rte_experimental int rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id)
int rte_event_eth_tx_adapter_create_ext(uint8_t id, uint8_t dev_id, rte_event_eth_tx_adapter_conf_cb conf_cb, void *conf_arg)
int rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id)