raw/ioat: add datapath data structures for idxd devices
[dpdk.git] / drivers / raw / ioat / ioat_private.h
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         volatile struct rte_idxd_bar0 *regs;
34         volatile struct rte_idxd_wqcfg *wq_regs;
35         volatile struct rte_idxd_grpcfg *grp_regs;
36         volatile void *portals;
37 };
38
39 struct idxd_rawdev {
40         struct rte_idxd_rawdev public; /* the public members, must be first */
41
42         struct rte_rawdev *rawdev;
43         const struct rte_memzone *mz;
44         uint8_t qid;
45         uint16_t max_batches;
46
47         union {
48                 struct {
49                         unsigned int dsa_id;
50                 } vdev;
51
52                 struct idxd_pci_common *pci;
53         } u;
54 };
55
56 extern int idxd_rawdev_create(const char *name, struct rte_device *dev,
57                        const struct idxd_rawdev *idxd,
58                        const struct rte_rawdev_ops *ops);
59
60 extern int idxd_rawdev_close(struct rte_rawdev *dev);
61
62 extern int idxd_rawdev_test(uint16_t dev_id);
63
64 extern int idxd_dev_dump(struct rte_rawdev *dev, FILE *f);
65
66 #endif /* _IOAT_PRIVATE_H_ */