DPDK  18.05.1
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_global *rte_eventdev_globals;
92 extern struct rte_eventdev *rte_eventdevs;
104 static inline struct rte_eventdev *
106 {
107  struct rte_eventdev *dev;
108  unsigned int i;
109 
110  if (name == NULL)
111  return NULL;
112 
113  for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
114  dev = &rte_eventdevs[i];
115  if ((dev->attached == RTE_EVENTDEV_ATTACHED) &&
116  (strcmp(dev->data->name, name) == 0))
117  return dev;
118  }
119 
120  return NULL;
121 }
122 
132 static inline unsigned
134 {
135  struct rte_eventdev *dev;
136 
137  if (dev_id >= RTE_EVENT_MAX_DEVS)
138  return 0;
139 
140  dev = &rte_eventdevs[dev_id];
141  if (dev->attached != RTE_EVENTDEV_ATTACHED)
142  return 0;
143  else
144  return 1;
145 }
146 
164 typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
165  struct rte_event_dev_info *dev_info);
166 
176 typedef int (*eventdev_configure_t)(const struct rte_eventdev *dev);
177 
187 typedef int (*eventdev_start_t)(struct rte_eventdev *dev);
188 
195 typedef void (*eventdev_stop_t)(struct rte_eventdev *dev);
196 
207 typedef int (*eventdev_close_t)(struct rte_eventdev *dev);
208 
220 typedef void (*eventdev_queue_default_conf_get_t)(struct rte_eventdev *dev,
221  uint8_t queue_id, struct rte_event_queue_conf *queue_conf);
222 
236 typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
237  uint8_t queue_id,
238  const struct rte_event_queue_conf *queue_conf);
239 
249 typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
250  uint8_t queue_id);
251 
263 typedef void (*eventdev_port_default_conf_get_t)(struct rte_eventdev *dev,
264  uint8_t port_id, struct rte_event_port_conf *port_conf);
265 
279 typedef int (*eventdev_port_setup_t)(struct rte_eventdev *dev,
280  uint8_t port_id,
281  const struct rte_event_port_conf *port_conf);
282 
290 typedef void (*eventdev_port_release_t)(void *port);
291 
312 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
313  const uint8_t queues[], const uint8_t priorities[],
314  uint16_t nb_links);
315 
332 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
333  uint8_t queues[], uint16_t nb_unlinks);
334 
349 typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev,
350  uint64_t ns, uint64_t *timeout_ticks);
351 
361 typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f);
362 
377 typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
378  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
379  const unsigned int ids[], uint64_t values[], unsigned int n);
380 
384 typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
385  enum rte_event_dev_xstats_mode mode,
386  int16_t queue_port_id,
387  const uint32_t ids[],
388  uint32_t nb_ids);
389 
405 typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
406  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
407  struct rte_event_dev_xstats_name *xstats_names,
408  unsigned int *ids, unsigned int size);
409 
425 typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
426  const char *name, unsigned int *id);
427 
428 
449  (const struct rte_eventdev *dev,
450  const struct rte_eth_dev *eth_dev,
451  uint32_t *caps);
452 
453 struct rte_event_eth_rx_adapter_queue_conf *queue_conf;
454 
481  const struct rte_eventdev *dev,
482  uint64_t flags,
483  uint32_t *caps,
484  const struct rte_event_timer_adapter_ops **ops);
485 
509  const struct rte_eventdev *dev,
510  const struct rte_eth_dev *eth_dev,
511  int32_t rx_queue_id,
512  const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
513 
534  (const struct rte_eventdev *dev,
535  const struct rte_eth_dev *eth_dev,
536  int32_t rx_queue_id);
537 
554 typedef int (*eventdev_eth_rx_adapter_start_t)
555  (const struct rte_eventdev *dev,
556  const struct rte_eth_dev *eth_dev);
557 
574 typedef int (*eventdev_eth_rx_adapter_stop_t)
575  (const struct rte_eventdev *dev,
576  const struct rte_eth_dev *eth_dev);
577 
578 struct rte_event_eth_rx_adapter_stats *stats;
579 
597  (const struct rte_eventdev *dev,
598  const struct rte_eth_dev *eth_dev,
599  struct rte_event_eth_rx_adapter_stats *stats);
613  (const struct rte_eventdev *dev,
614  const struct rte_eth_dev *eth_dev);
621 typedef int (*eventdev_selftest)(void);
622 
623 
624 struct rte_cryptodev;
625 
649  (const struct rte_eventdev *dev,
650  const struct rte_cryptodev *cdev,
651  uint32_t *caps);
652 
680  (const struct rte_eventdev *dev,
681  const struct rte_cryptodev *cdev,
682  int32_t queue_pair_id,
683  const struct rte_event *event);
684 
685 
708  (const struct rte_eventdev *dev,
709  const struct rte_cryptodev *cdev,
710  int32_t queue_pair_id);
711 
728 typedef int (*eventdev_crypto_adapter_start_t)
729  (const struct rte_eventdev *dev,
730  const struct rte_cryptodev *cdev);
731 
748 typedef int (*eventdev_crypto_adapter_stop_t)
749  (const struct rte_eventdev *dev,
750  const struct rte_cryptodev *cdev);
751 
753 
771  (const struct rte_eventdev *dev,
772  const struct rte_cryptodev *cdev,
773  struct rte_event_crypto_adapter_stats *stats);
774 
789  (const struct rte_eventdev *dev,
790  const struct rte_cryptodev *cdev);
791 
820  eventdev_dump_t dump;
821  /* Dump internal information */
822 
870 };
871 
883 struct rte_eventdev *
884 rte_event_pmd_allocate(const char *name, int socket_id);
885 
894 int
895 rte_event_pmd_release(struct rte_eventdev *eventdev);
896 
897 #ifdef __cplusplus
898 }
899 #endif
900 
901 #endif /* _RTE_EVENTDEV_PMD_H_ */