DPDK  20.05.0
rte_eventdev_pmd.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016 Cavium, Inc
3  */
4 
5 #ifndef _RTE_EVENTDEV_PMD_H_
6 #define _RTE_EVENTDEV_PMD_H_
7 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #include <string.h>
21 
22 #include <rte_common.h>
23 #include <rte_config.h>
24 #include <rte_dev.h>
25 #include <rte_log.h>
26 #include <rte_malloc.h>
27 
28 #include "rte_eventdev.h"
30 
31 /* Logging Macros */
32 #define RTE_EDEV_LOG_ERR(...) \
33  RTE_LOG(ERR, EVENTDEV, \
34  RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
35  __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
36 
37 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
38 #define RTE_EDEV_LOG_DEBUG(...) \
39  RTE_LOG(DEBUG, EVENTDEV, \
40  RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
41  __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
42 #else
43 #define RTE_EDEV_LOG_DEBUG(...) (void)0
44 #endif
45 
46 /* Macros to check for valid device */
47 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
48  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
49  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
50  return retval; \
51  } \
52 } while (0)
53 
54 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
55  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
56  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
57  rte_errno = errno; \
58  return retval; \
59  } \
60 } while (0)
61 
62 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
63  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
64  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
65  return; \
66  } \
67 } while (0)
68 
69 #define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \
70  ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \
71  (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ))
72 
73 #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \
74  RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA
75 
80 #define RTE_EVENTDEV_DETACHED (0)
81 #define RTE_EVENTDEV_ATTACHED (1)
82 
83 struct rte_eth_dev;
84 
87  uint8_t nb_devs;
88 };
89 
90 extern struct rte_eventdev *rte_eventdevs;
102 static inline struct rte_eventdev *
104 {
105  struct rte_eventdev *dev;
106  unsigned int i;
107 
108  if (name == NULL)
109  return NULL;
110 
111  for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
112  dev = &rte_eventdevs[i];
113  if ((dev->attached == RTE_EVENTDEV_ATTACHED) &&
114  (strcmp(dev->data->name, name) == 0))
115  return dev;
116  }
117 
118  return NULL;
119 }
120 
130 static inline unsigned
132 {
133  struct rte_eventdev *dev;
134 
135  if (dev_id >= RTE_EVENT_MAX_DEVS)
136  return 0;
137 
138  dev = &rte_eventdevs[dev_id];
139  if (dev->attached != RTE_EVENTDEV_ATTACHED)
140  return 0;
141  else
142  return 1;
143 }
144 
162 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
163  struct rte_event_dev_info *dev_info);
164 
174 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
175 
185 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
186 
193 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
194 
205 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
206 
218 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
219  uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
220 
234 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
235  uint8_t queue_id,
236  const struct rte_event_queue_conf *queue_conf);
237 
247 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
248  uint8_t queue_id);
249 
261 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
262  uint8_t port_id, struct rte_event_port_conf *port_conf);
263 
277 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
278  uint8_t port_id,
279  const struct rte_event_port_conf *port_conf);
280 
288 typedef void (*eventdev_port_release_t)(void *port);
289 
310 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
311  const uint8_t queues[], const uint8_t priorities[],
312  uint16_t nb_links);
313 
330 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
331  uint8_t queues[], uint16_t nb_unlinks);
332 
347 typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev,
348  void *port);
349 
364 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
365  uint64_t ns, uint64_t *timeout_ticks);
366 
376 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
377 
392 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
393  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
394  const unsigned int ids[], uint64_t values[], unsigned int n);
395 
399 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
400  enum rte_event_dev_xstats_mode mode,
401  int16_t queue_port_id,
402  const uint32_t ids[],
403  uint32_t nb_ids);
404 
420 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
421  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
422  struct rte_event_dev_xstats_name *xstats_names,
423  unsigned int *ids, unsigned int size);
424 
440 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
441  const char *name, unsigned int *id);
442 
443 
464  (const struct rte_eventdev *dev,
465  const struct rte_eth_dev *eth_dev,
466  uint32_t *caps);
467 
469 
496  const struct rte_eventdev *dev,
497  uint64_t flags,
498  uint32_t *caps,
499  const struct rte_event_timer_adapter_ops **ops);
500 
524  const struct rte_eventdev *dev,
525  const struct rte_eth_dev *eth_dev,
526  int32_t rx_queue_id,
527  const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
528 
549  (const struct rte_eventdev *dev,
550  const struct rte_eth_dev *eth_dev,
551  int32_t rx_queue_id);
552 
569 typedef int (*eventdev_eth_rx_adapter_start_t)
570  (const struct rte_eventdev *dev,
571  const struct rte_eth_dev *eth_dev);
572 
589 typedef int (*eventdev_eth_rx_adapter_stop_t)
590  (const struct rte_eventdev *dev,
591  const struct rte_eth_dev *eth_dev);
592 
594 
612  (const struct rte_eventdev *dev,
613  const struct rte_eth_dev *eth_dev,
614  struct rte_event_eth_rx_adapter_stats *stats);
628  (const struct rte_eventdev *dev,
629  const struct rte_eth_dev *eth_dev);
636 typedef int (*eventdev_selftest)(void);
637 
638 
639 struct rte_cryptodev;
640 
664  (const struct rte_eventdev *dev,
665  const struct rte_cryptodev *cdev,
666  uint32_t *caps);
667 
695  (const struct rte_eventdev *dev,
696  const struct rte_cryptodev *cdev,
697  int32_t queue_pair_id,
698  const struct rte_event *event);
699 
700 
723  (const struct rte_eventdev *dev,
724  const struct rte_cryptodev *cdev,
725  int32_t queue_pair_id);
726 
743 typedef int (*eventdev_crypto_adapter_start_t)
744  (const struct rte_eventdev *dev,
745  const struct rte_cryptodev *cdev);
746 
763 typedef int (*eventdev_crypto_adapter_stop_t)
764  (const struct rte_eventdev *dev,
765  const struct rte_cryptodev *cdev);
766 
768 
786  (const struct rte_eventdev *dev,
787  const struct rte_cryptodev *cdev,
788  struct rte_event_crypto_adapter_stats *stats);
789 
804  (const struct rte_eventdev *dev,
805  const struct rte_cryptodev *cdev);
806 
825  (const struct rte_eventdev *dev,
826  const struct rte_eth_dev *eth_dev,
827  uint32_t *caps);
828 
842 typedef int (*eventdev_eth_tx_adapter_create_t)(uint8_t id,
843  const struct rte_eventdev *dev);
844 
858 typedef int (*eventdev_eth_tx_adapter_free_t)(uint8_t id,
859  const struct rte_eventdev *dev);
860 
883  uint8_t id,
884  const struct rte_eventdev *dev,
885  const struct rte_eth_dev *eth_dev,
886  int32_t tx_queue_id);
887 
911  uint8_t id,
912  const struct rte_eventdev *dev,
913  const struct rte_eth_dev *eth_dev,
914  int32_t tx_queue_id);
915 
929 typedef int (*eventdev_eth_tx_adapter_start_t)(uint8_t id,
930  const struct rte_eventdev *dev);
931 
945 typedef int (*eventdev_eth_tx_adapter_stop_t)(uint8_t id,
946  const struct rte_eventdev *dev);
947 
949 
967  uint8_t id,
968  const struct rte_eventdev *dev,
969  struct rte_event_eth_tx_adapter_stats *stats);
970 
984 typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,
985  const struct rte_eventdev *dev);
986 
1017  eventdev_dump_t dump;
1018  /* Dump internal information */
1019 
1087 };
1088 
1100 struct rte_eventdev *
1101 rte_event_pmd_allocate(const char *name, int socket_id);
1102 
1111 int
1112 rte_event_pmd_release(struct rte_eventdev *eventdev);
1113 
1114 #ifdef __cplusplus
1115 }
1116 #endif
1117 
1118 #endif /* _RTE_EVENTDEV_PMD_H_ */
eventdev_stop_t dev_stop
eventdev_port_release_t port_release
eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset
eventdev_port_default_conf_get_t port_def_conf
eventdev_configure_t dev_configure
eventdev_selftest dev_selftest
int(* eventdev_close_t)(struct rte_eventdev *dev)
eventdev_eth_tx_adapter_queue_add_t eth_tx_adapter_queue_add
int(* eventdev_crypto_adapter_start_t)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev)
eventdev_eth_rx_adapter_caps_get_t eth_rx_adapter_caps_get
eventdev_queue_release_t queue_release
eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset
eventdev_eth_rx_adapter_start_t eth_rx_adapter_start
eventdev_port_link_t port_link
eventdev_info_get_t dev_infos_get
eventdev_port_setup_t port_setup
void(* eventdev_port_default_conf_get_t)(struct rte_eventdev *dev, uint8_t port_id, struct rte_event_port_conf *port_conf)
static unsigned rte_event_pmd_is_valid_dev(uint8_t dev_id)
int(* eventdev_timer_adapter_caps_get_t)(const struct rte_eventdev *dev, uint64_t flags, uint32_t *caps, const struct rte_event_timer_adapter_ops **ops)
int(* eventdev_xstats_reset_t)(struct rte_eventdev *dev, enum rte_event_dev_xstats_mode mode, int16_t queue_port_id, const uint32_t ids[], uint32_t nb_ids)
int(* eventdev_port_setup_t)(struct rte_eventdev *dev, uint8_t port_id, const struct rte_event_port_conf *port_conf)
int(* eventdev_configure_t)(const struct rte_eventdev *dev)
int(* eventdev_crypto_adapter_stop_t)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev)
eventdev_eth_rx_adapter_queue_add_t eth_rx_adapter_queue_add
eventdev_eth_tx_adapter_queue_del_t eth_tx_adapter_queue_del
int(* eventdev_eth_tx_adapter_queue_del_t)(uint8_t id, const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
void(* eventdev_queue_release_t)(struct rte_eventdev *dev, uint8_t queue_id)
int(* eventdev_crypto_adapter_queue_pair_add_t)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, int32_t queue_pair_id, const struct rte_event *event)
eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del
int(* eventdev_eth_tx_adapter_stats_get_t)(uint8_t id, const struct rte_eventdev *dev, struct rte_event_eth_tx_adapter_stats *stats)
void(* eventdev_port_release_t)(void *port)
eventdev_queue_setup_t queue_setup
int(* eventdev_eth_tx_adapter_caps_get_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, uint32_t *caps)
void(* eventdev_stop_t)(struct rte_eventdev *dev)
int(* eventdev_crypto_adapter_stats_get)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, struct rte_event_crypto_adapter_stats *stats)
eventdev_crypto_adapter_queue_pair_add_t crypto_adapter_queue_pair_add
eventdev_xstats_get_by_name xstats_get_by_name
eventdev_queue_default_conf_get_t queue_def_conf
eventdev_eth_rx_adapter_stats_get eth_rx_adapter_stats_get
eventdev_port_unlink_t port_unlink
int(* eventdev_eth_rx_adapter_stats_reset)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev)
int(* eventdev_queue_setup_t)(struct rte_eventdev *dev, uint8_t queue_id, const struct rte_event_queue_conf *queue_conf)
int rte_event_pmd_release(struct rte_eventdev *eventdev)
rte_event_dev_xstats_mode
int(* eventdev_eth_rx_adapter_stop_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev)
int(* eventdev_eth_rx_adapter_queue_del_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, int32_t rx_queue_id)
int(* eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port, uint8_t queues[], uint16_t nb_unlinks)
int(* eventdev_eth_rx_adapter_start_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev)
struct rte_eventdev * rte_event_pmd_allocate(const char *name, int socket_id)
static struct rte_eventdev * rte_event_pmd_get_named_dev(const char *name)
int(* eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev, void *port)
int(* eventdev_selftest)(void)
eventdev_crypto_adapter_start_t crypto_adapter_start
eventdev_start_t dev_start
int(* eventdev_start_t)(struct rte_eventdev *dev)
eventdev_dequeue_timeout_ticks_t timeout_ticks
int(* eventdev_crypto_adapter_queue_pair_del_t)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, int32_t queue_pair_id)
eventdev_eth_tx_adapter_stop_t eth_tx_adapter_stop
eventdev_xstats_reset_t xstats_reset
eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset
int(* eventdev_eth_rx_adapter_caps_get_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, uint32_t *caps)
eventdev_stop_flush_t dev_stop_flush
eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get
int(* eventdev_eth_tx_adapter_create_t)(uint8_t id, const struct rte_eventdev *dev)
int(* eventdev_xstats_get_names_t)(const struct rte_eventdev *dev, enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id, struct rte_event_dev_xstats_name *xstats_names, unsigned int *ids, unsigned int size)
eventdev_eth_tx_adapter_stats_get_t eth_tx_adapter_stats_get
eventdev_eth_tx_adapter_free_t eth_tx_adapter_free
int(* eventdev_eth_tx_adapter_stop_t)(uint8_t id, const struct rte_eventdev *dev)
int(* eventdev_eth_rx_adapter_queue_add_t)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, int32_t rx_queue_id, const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
int(* eventdev_xstats_get_t)(const struct rte_eventdev *dev, enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id, const unsigned int ids[], uint64_t values[], unsigned int n)
eventdev_eth_tx_adapter_create_t eth_tx_adapter_create
void(* eventdev_info_get_t)(struct rte_eventdev *dev, struct rte_event_dev_info *dev_info)
void(* eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev, uint8_t queue_id, struct rte_event_queue_conf *queue_conf)
eventdev_port_unlinks_in_progress_t port_unlinks_in_progress
eventdev_crypto_adapter_queue_pair_del_t crypto_adapter_queue_pair_del
eventdev_xstats_get_names_t xstats_get_names
uint64_t(* eventdev_xstats_get_by_name)(const struct rte_eventdev *dev, const char *name, unsigned int *id)
eventdev_eth_tx_adapter_start_t eth_tx_adapter_start
eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop
eventdev_crypto_adapter_stop_t crypto_adapter_stop
eventdev_close_t dev_close
int(* eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev, uint64_t ns, uint64_t *timeout_ticks)
eventdev_xstats_get_t xstats_get
int(* eventdev_port_link_t)(struct rte_eventdev *dev, void *port, const uint8_t queues[], const uint8_t priorities[], uint16_t nb_links)
void(* eventdev_dump_t)(struct rte_eventdev *dev, FILE *f)
eventdev_crypto_adapter_stats_get crypto_adapter_stats_get
int(* eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id, const struct rte_eventdev *dev)
int(* eventdev_eth_tx_adapter_queue_add_t)(uint8_t id, const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
eventdev_crypto_adapter_caps_get_t crypto_adapter_caps_get
void(* eventdev_stop_flush_t)(uint8_t dev_id, struct rte_event event, void *arg)
Definition: rte_eventdev.h:833
eventdev_timer_adapter_caps_get_t timer_adapter_caps_get
int(* eventdev_eth_tx_adapter_free_t)(uint8_t id, const struct rte_eventdev *dev)
int(* eventdev_eth_tx_adapter_start_t)(uint8_t id, const struct rte_eventdev *dev)
int(* eventdev_eth_rx_adapter_stats_get)(const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, struct rte_event_eth_rx_adapter_stats *stats)
int(* eventdev_crypto_adapter_caps_get_t)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, uint32_t *caps)
int(* eventdev_crypto_adapter_stats_reset)(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev)