xref: /f-stack/dpdk/drivers/raw/ioat/ioat_private.h (revision 2d9fd380)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 
5 #ifndef _IOAT_PRIVATE_H_
6 #define _IOAT_PRIVATE_H_
7 
8 /**
9  * @file idxd_private.h
10  *
11  * Private data structures for the idxd/DSA part of ioat device driver
12  *
13  * @warning
14  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
15  */
16 
17 #include <rte_spinlock.h>
18 #include <rte_rawdev_pmd.h>
19 #include "rte_ioat_rawdev.h"
20 
21 extern int ioat_pmd_logtype;
22 
23 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
24 		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
25 
26 #define IOAT_PMD_DEBUG(fmt, args...)  IOAT_PMD_LOG(DEBUG, fmt, ## args)
27 #define IOAT_PMD_INFO(fmt, args...)   IOAT_PMD_LOG(INFO, fmt, ## args)
28 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
29 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
30 
31 struct idxd_pci_common {
32 	rte_spinlock_t lk;
33 
34 	uint8_t wq_cfg_sz;
35 	volatile struct rte_idxd_bar0 *regs;
36 	volatile uint32_t *wq_regs_base;
37 	volatile struct rte_idxd_grpcfg *grp_regs;
38 	volatile void *portals;
39 };
40 
41 struct idxd_rawdev {
42 	struct rte_idxd_rawdev public; /* the public members, must be first */
43 
44 	struct rte_rawdev *rawdev;
45 	const struct rte_memzone *mz;
46 	uint8_t qid;
47 	uint16_t max_batches;
48 
49 	union {
50 		struct {
51 			unsigned int dsa_id;
52 		} vdev;
53 
54 		struct idxd_pci_common *pci;
55 	} u;
56 };
57 
58 int ioat_xstats_get(const struct rte_rawdev *dev, const unsigned int ids[],
59 		uint64_t values[], unsigned int n);
60 
61 int ioat_xstats_get_names(const struct rte_rawdev *dev,
62 		struct rte_rawdev_xstats_name *names,
63 		unsigned int size);
64 
65 int ioat_xstats_reset(struct rte_rawdev *dev, const uint32_t *ids,
66 		uint32_t nb_ids);
67 
68 extern int ioat_rawdev_test(uint16_t dev_id);
69 
70 extern int idxd_rawdev_create(const char *name, struct rte_device *dev,
71 		       const struct idxd_rawdev *idxd,
72 		       const struct rte_rawdev_ops *ops);
73 
74 extern int idxd_rawdev_close(struct rte_rawdev *dev);
75 
76 extern int idxd_dev_configure(const struct rte_rawdev *dev,
77 		rte_rawdev_obj_t config, size_t config_size);
78 
79 extern int idxd_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info,
80 		size_t info_size);
81 
82 extern int idxd_dev_dump(struct rte_rawdev *dev, FILE *f);
83 
84 #endif /* _IOAT_PRIVATE_H_ */
85