DPDK  19.11.14
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 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <string.h>
25 
26 #include <rte_common.h>
27 #include <rte_config.h>
28 #include <rte_dev.h>
29 #include <rte_log.h>
30 #include <rte_malloc.h>
31 
32 #include "rte_eventdev.h"
34 
35 /* Logging Macros */
36 #define RTE_EDEV_LOG_ERR(...) \
37  RTE_LOG(ERR, EVENTDEV, \
38  RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
39  __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
40 
41 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
42 #define RTE_EDEV_LOG_DEBUG(...) \
43  RTE_LOG(DEBUG, EVENTDEV, \
44  RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
45  __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
46 #else
47 #define RTE_EDEV_LOG_DEBUG(...) (void)0
48 #endif
49 
50 /* Macros to check for valid device */
51 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
52  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
53  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
54  return retval; \
55  } \
56 } while (0)
57 
58 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
59  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
60  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
61  rte_errno = errno; \
62  return retval; \
63  } \
64 } while (0)
65 
66 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
67  if (!rte_event_pmd_is_valid_dev((dev_id))) { \
68  RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
69  return; \
70  } \
71 } while (0)
72 
73 #define RTE_EVENT_ETH_RX_ADAPTER_SW_CAP \
74  ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \
75  (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ))
76 
77 #define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \
78  RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA
79 
84 #define RTE_EVENTDEV_DETACHED (0)
85 #define RTE_EVENTDEV_ATTACHED (1)
86 
87 struct rte_eth_dev;
88 
91  uint8_t nb_devs;
92 };
93 
94 extern struct rte_eventdev *rte_eventdevs;
106 static inline struct rte_eventdev *
108 {
109  struct rte_eventdev *dev;
110  unsigned int i;
111 
112  if (name == NULL)
113  return NULL;
114 
115  for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
116  dev = &rte_eventdevs[i];
117  if ((dev->attached == RTE_EVENTDEV_ATTACHED) &&
118  (strcmp(dev->data->name, name) == 0))
119  return dev;
120  }
121 
122  return NULL;
123 }
124 
134 static inline unsigned
136 {
137  struct rte_eventdev *dev;
138 
139  if (dev_id >= RTE_EVENT_MAX_DEVS)
140  return 0;
141 
142  dev = &rte_eventdevs[dev_id];
143  if (dev->attached != RTE_EVENTDEV_ATTACHED)
144  return 0;
145  else
146  return 1;
147 }
148 
163 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
164  struct rte_event_dev_info *dev_info);
165 
175 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
176 
186 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
187 
194 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
195 
206 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
207 
219 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
220  uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
221 
235 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
236  uint8_t queue_id,
237  const struct rte_event_queue_conf *queue_conf);
238 
248 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
249  uint8_t queue_id);
250 
262 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
263  uint8_t port_id, struct rte_event_port_conf *port_conf);
264 
278 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
279  uint8_t port_id,
280  const struct rte_event_port_conf *port_conf);
281 
289 typedef void (*eventdev_port_release_t)(void *port);
290 
311 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
312  const uint8_t queues[], const uint8_t priorities[],
313  uint16_t nb_links);
314 
331 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
332  uint8_t queues[], uint16_t nb_unlinks);
333 
348 typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev,
349  void *port);
350 
365 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
366  uint64_t ns, uint64_t *timeout_ticks);
367 
377 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
378 
393 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
394  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
395  const unsigned int ids[], uint64_t values[], unsigned int n);
396 
400 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
401  enum rte_event_dev_xstats_mode mode,
402  int16_t queue_port_id,
403  const uint32_t ids[],
404  uint32_t nb_ids);
405 
421 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
422  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
423  struct rte_event_dev_xstats_name *xstats_names,
424  unsigned int *ids, unsigned int size);
425 
441 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
442  const char *name, unsigned int *id);
443 
444 
465  (const struct rte_eventdev *dev,
466  const struct rte_eth_dev *eth_dev,
467  uint32_t *caps);
468 
470 
497  const struct rte_eventdev *dev,
498  uint64_t flags,
499  uint32_t *caps,
500  const struct rte_event_timer_adapter_ops **ops);
501 
525  const struct rte_eventdev *dev,
526  const struct rte_eth_dev *eth_dev,
527  int32_t rx_queue_id,
528  const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
529 
550  (const struct rte_eventdev *dev,
551  const struct rte_eth_dev *eth_dev,
552  int32_t rx_queue_id);
553 
570 typedef int (*eventdev_eth_rx_adapter_start_t)
571  (const struct rte_eventdev *dev,
572  const struct rte_eth_dev *eth_dev);
573 
590 typedef int (*eventdev_eth_rx_adapter_stop_t)
591  (const struct rte_eventdev *dev,
592  const struct rte_eth_dev *eth_dev);
593 
595 
613  (const struct rte_eventdev *dev,
614  const struct rte_eth_dev *eth_dev,
615  struct rte_event_eth_rx_adapter_stats *stats);
629  (const struct rte_eventdev *dev,
630  const struct rte_eth_dev *eth_dev);
637 typedef int (*eventdev_selftest)(void);
638 
639 
640 struct rte_cryptodev;
641 
665  (const struct rte_eventdev *dev,
666  const struct rte_cryptodev *cdev,
667  uint32_t *caps);
668 
696  (const struct rte_eventdev *dev,
697  const struct rte_cryptodev *cdev,
698  int32_t queue_pair_id,
699  const struct rte_event *event);
700 
701 
724  (const struct rte_eventdev *dev,
725  const struct rte_cryptodev *cdev,
726  int32_t queue_pair_id);
727 
744 typedef int (*eventdev_crypto_adapter_start_t)
745  (const struct rte_eventdev *dev,
746  const struct rte_cryptodev *cdev);
747 
764 typedef int (*eventdev_crypto_adapter_stop_t)
765  (const struct rte_eventdev *dev,
766  const struct rte_cryptodev *cdev);
767 
769 
787  (const struct rte_eventdev *dev,
788  const struct rte_cryptodev *cdev,
789  struct rte_event_crypto_adapter_stats *stats);
790 
805  (const struct rte_eventdev *dev,
806  const struct rte_cryptodev *cdev);
807 
826  (const struct rte_eventdev *dev,
827  const struct rte_eth_dev *eth_dev,
828  uint32_t *caps);
829 
843 typedef int (*eventdev_eth_tx_adapter_create_t)(uint8_t id,
844  const struct rte_eventdev *dev);
845 
859 typedef int (*eventdev_eth_tx_adapter_free_t)(uint8_t id,
860  const struct rte_eventdev *dev);
861 
884  uint8_t id,
885  const struct rte_eventdev *dev,
886  const struct rte_eth_dev *eth_dev,
887  int32_t tx_queue_id);
888 
912  uint8_t id,
913  const struct rte_eventdev *dev,
914  const struct rte_eth_dev *eth_dev,
915  int32_t tx_queue_id);
916 
930 typedef int (*eventdev_eth_tx_adapter_start_t)(uint8_t id,
931  const struct rte_eventdev *dev);
932 
946 typedef int (*eventdev_eth_tx_adapter_stop_t)(uint8_t id,
947  const struct rte_eventdev *dev);
948 
950 
968  uint8_t id,
969  const struct rte_eventdev *dev,
970  struct rte_event_eth_tx_adapter_stats *stats);
971 
985 typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id,
986  const struct rte_eventdev *dev);
987 
1018  eventdev_dump_t dump;
1019  /* Dump internal information */
1020 
1088 };
1089 
1101 struct rte_eventdev *
1102 rte_event_pmd_allocate(const char *name, int socket_id);
1103 
1112 int
1113 rte_event_pmd_release(struct rte_eventdev *eventdev);
1114 
1115 #ifdef __cplusplus
1116 }
1117 #endif
1118 
1119 #ifdef __cplusplus
1120 }
1121 #endif
1122 
1123 #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:831
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)