DPDK  22.11.0
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_compat.h>
83 #include <rte_mbuf.h>
84 
85 #include "rte_eventdev.h"
86 
94  uint8_t event_port_id;
99  uint32_t max_nb_tx;
104 };
105 
126 typedef int (*rte_event_eth_tx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
127  struct rte_event_eth_tx_adapter_conf *conf,
128  void *arg);
129 
134  uint64_t tx_retry;
136  uint64_t tx_packets;
138  uint64_t tx_dropped;
140 };
141 
156 int
157 rte_event_eth_tx_adapter_create(uint8_t id, uint8_t dev_id,
158  struct rte_event_port_conf *port_config);
159 
177 int
178 rte_event_eth_tx_adapter_create_ext(uint8_t id, uint8_t dev_id,
180  void *conf_arg);
181 
192 int
194 
204 int
206 
216 int
218 
234 int
236  uint16_t eth_dev_id,
237  int32_t queue);
238 
255 int
257  uint16_t eth_dev_id,
258  int32_t queue);
259 
269 static __rte_always_inline void
270 rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue)
271 {
272  pkt->hash.txadapter.txq = queue;
273 }
274 
285 static __rte_always_inline uint16_t
287 {
288  return pkt->hash.txadapter.txq;
289 }
290 
304 int
306 
307 #define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST 0x1
308 
355 static inline uint16_t
357  uint8_t port_id,
358  struct rte_event ev[],
359  uint16_t nb_events,
360  const uint8_t flags)
361 {
362  const struct rte_event_fp_ops *fp_ops;
363  void *port;
364 
365  fp_ops = &rte_event_fp_ops[dev_id];
366  port = fp_ops->data[port_id];
367 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
368  if (dev_id >= RTE_EVENT_MAX_DEVS ||
369  port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
370  rte_errno = EINVAL;
371  return 0;
372  }
373 
374  if (port == NULL) {
375  rte_errno = EINVAL;
376  return 0;
377  }
378 #endif
379  rte_eventdev_trace_eth_tx_adapter_enqueue(dev_id, port_id, ev,
380  nb_events, flags);
381  if (flags)
382  return fp_ops->txa_enqueue_same_dest(port, ev, nb_events);
383  else
384  return fp_ops->txa_enqueue(port, ev, nb_events);
385 }
386 
398 int
400  struct rte_event_eth_tx_adapter_stats *stats);
401 
411 int
413 
427 int
428 rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id);
429 
447 __rte_experimental
448 int
449 rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id,
450  uint16_t tx_queue_id,
451  uint8_t *txa_inst_id);
482 __rte_experimental
483 int
484 rte_event_eth_tx_adapter_queue_start(uint16_t eth_dev_id, uint16_t tx_queue_id);
485 
501 __rte_experimental
502 int
503 rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
504 
505 #ifdef __cplusplus
506 }
507 #endif
508 #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)