5 #ifndef _RTE_RAWDEV_PMD_H_
6 #define _RTE_RAWDEV_PMD_H_
29 extern int librawdev_logtype;
32 #define RTE_RDEV_LOG(level, fmt, args...) \
33 rte_log(RTE_LOG_ ## level, librawdev_logtype, "%s(): " fmt "\n", \
36 #define RTE_RDEV_ERR(fmt, args...) \
37 RTE_RDEV_LOG(ERR, fmt, ## args)
38 #define RTE_RDEV_DEBUG(fmt, args...) \
39 RTE_RDEV_LOG(DEBUG, fmt, ## args)
40 #define RTE_RDEV_INFO(fmt, args...) \
41 RTE_RDEV_LOG(INFO, fmt, ## args)
45 #define RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
46 if (!rte_rawdev_pmd_is_valid_dev((dev_id))) { \
47 RTE_RDEV_ERR("Invalid dev_id=%d", dev_id); \
52 #define RTE_RAWDEV_VALID_DEVID_OR_RET(dev_id) do { \
53 if (!rte_rawdev_pmd_is_valid_dev((dev_id))) { \
54 RTE_RDEV_ERR("Invalid dev_id=%d", dev_id); \
59 #define RTE_RAWDEV_DETACHED (0)
60 #define RTE_RAWDEV_ATTACHED (1)
68 struct rte_rawdev_global {
73 extern struct rte_rawdev *rte_rawdevs;
85 static inline struct rte_rawdev *
88 struct rte_rawdev *dev;
94 for (i = 0; i < RTE_RAWDEV_MAX_DEVS; i++) {
95 dev = &rte_rawdevs[i];
96 if ((dev->attached == RTE_RAWDEV_ATTACHED) &&
97 (strcmp(dev->name, name) == 0))
113 static inline unsigned
116 struct rte_rawdev *dev;
118 if (dev_id >= RTE_RAWDEV_MAX_DEVS)
121 dev = &rte_rawdevs[dev_id];
122 if (dev->attached != RTE_RAWDEV_ATTACHED)
146 rte_rawdev_obj_t dev_info);
160 rte_rawdev_obj_t config);
217 rte_rawdev_obj_t queue_conf);
234 rte_rawdev_obj_t queue_conf);
289 struct rte_rawdev_buf **buffers,
291 rte_rawdev_obj_t context);
314 struct rte_rawdev_buf **buffers,
316 rte_rawdev_obj_t context);
348 const char *attr_name,
349 uint64_t *attr_value);
366 const char *attr_name,
367 const uint64_t attr_value);
386 const unsigned int ids[], uint64_t values[],
unsigned int n);
392 const uint32_t ids[],
446 rte_rawdev_obj_t status_info);
460 rte_rawdev_obj_t version_info);
477 rte_rawdev_obj_t firmware_buf);
int(* rawdev_xstats_get_t)(const struct rte_rawdev *dev, const unsigned int ids[], uint64_t values[], unsigned int n)
int(* rawdev_set_attr_t)(struct rte_rawdev *dev, const char *attr_name, const uint64_t attr_value)
rawdev_dequeue_bufs_t dequeue_bufs
rawdev_xstats_get_t xstats_get
int(* rawdev_get_attr_t)(struct rte_rawdev *dev, const char *attr_name, uint64_t *attr_value)
int(* rawdev_start_t)(struct rte_rawdev *dev)
int(* rawdev_configure_t)(const struct rte_rawdev *dev, rte_rawdev_obj_t config)
rawdev_info_get_t dev_info_get
static unsigned rte_rawdev_pmd_is_valid_dev(uint8_t dev_id)
void(* rawdev_info_get_t)(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
int rte_rawdev_pmd_uninit(const char *name)
int(* rawdev_xstats_reset_t)(struct rte_rawdev *dev, const uint32_t ids[], uint32_t nb_ids)
int rte_rawdev_pmd_release(struct rte_rawdev *rawdev)
int(* rawdev_firmware_version_get_t)(struct rte_rawdev *dev, rte_rawdev_obj_t version_info)
struct rte_rawdev * rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size, int socket_id)
rawdev_firmware_version_get_t firmware_version_get
int(* rawdev_selftest_t)(void)
rawdev_xstats_reset_t xstats_reset
int(* rawdev_queue_release_t)(struct rte_rawdev *dev, uint16_t queue_id)
rawdev_queue_conf_get_t queue_def_conf
int(* rawdev_firmware_load_t)(struct rte_rawdev *dev, rte_rawdev_obj_t firmware_buf)
rawdev_configure_t dev_configure
int(* rawdev_dequeue_bufs_t)(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context)
rawdev_queue_count_t queue_count
int(* rawdev_firmware_unload_t)(struct rte_rawdev *dev)
int(* rawdev_queue_setup_t)(struct rte_rawdev *dev, uint16_t queue_id, rte_rawdev_obj_t queue_conf)
uint16_t(* rawdev_queue_count_t)(struct rte_rawdev *dev)
struct rte_rawdev * rte_rawdev_pmd_init(const char *name, size_t dev_private_size, int socket_id)
int(* rawdev_close_t)(struct rte_rawdev *dev)
rawdev_xstats_get_by_name_t xstats_get_by_name
rawdev_firmware_load_t firmware_load
int(* rawdev_xstats_get_names_t)(const struct rte_rawdev *dev, struct rte_rawdev_xstats_name *xstats_names, unsigned int size)
uint64_t(* rawdev_xstats_get_by_name_t)(const struct rte_rawdev *dev, const char *name, unsigned int *id)
rawdev_set_attr_t attr_set
rawdev_queue_release_t queue_release
void(* rawdev_stop_t)(struct rte_rawdev *dev)
rawdev_queue_setup_t queue_setup
rawdev_xstats_get_names_t xstats_get_names
rawdev_get_attr_t attr_get
int(* rawdev_reset_t)(struct rte_rawdev *dev)
rawdev_firmware_status_get_t firmware_status_get
rawdev_enqueue_bufs_t enqueue_bufs
int(* rawdev_firmware_status_get_t)(struct rte_rawdev *dev, rte_rawdev_obj_t status_info)
static struct rte_rawdev * rte_rawdev_pmd_get_named_dev(const char *name)
void(* rawdev_queue_conf_get_t)(struct rte_rawdev *dev, uint16_t queue_id, rte_rawdev_obj_t queue_conf)
int(* rawdev_enqueue_bufs_t)(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context)
int(* rawdev_dump_t)(struct rte_rawdev *dev, FILE *f)
rawdev_firmware_unload_t firmware_unload