Whamcloud - gitweb
LU-6142 lnet: SPDX for lnet/include/ and misc files
[fs/lustre-release.git] / lnet / include / lnet / lnet_gds.h
1 // SPDX-License-Identifier: GPL-2.0
2
3 /* This file is part of Lustre, http://www.lustre.org/ */
4
5 #ifndef LUSTRE_NVFS_H
6 #define LUSTRE_NVFS_H
7
8 #include <linux/types.h>
9 #include <linux/delay.h>
10 #include <linux/blkdev.h>
11 #include <linux/cpumask.h>
12 #include <linux/scatterlist.h>
13 #include <linux/percpu-defs.h>
14 #include <linux/dma-direction.h>
15 #include <linux/dma-mapping.h>
16
17
18 struct nvfs_dma_rw_ops {
19         unsigned long long ft_bmap; /* feature bitmap */
20
21         int (*nvfs_blk_rq_map_sg) (struct request_queue *q,
22                                    struct request *req,
23                                    struct scatterlist *sglist);
24
25         int (*nvfs_dma_map_sg_attrs) (struct device *device,
26                                       struct scatterlist *sglist,
27                                       int nents,
28                                       enum dma_data_direction dma_dir,
29                                       unsigned long attrs);
30
31         int (*nvfs_dma_unmap_sg)  (struct device *device,
32                                    struct scatterlist *sglist,
33                                    int nents,
34                                    enum dma_data_direction dma_dir);
35         bool (*nvfs_is_gpu_page) (struct page *);
36         unsigned int (*nvfs_gpu_index) (struct page *page);
37         unsigned int (*nvfs_device_priority) (struct device *dev, unsigned int dev_index);
38 };
39
40 /* feature list for dma_ops, values indicate bit pos */
41 enum ft_bits {
42         nvfs_ft_prep_sglist         = 1ULL << 0,
43         nvfs_ft_map_sglist          = 1ULL << 1,
44         nvfs_ft_is_gpu_page         = 1ULL << 2,
45         nvfs_ft_device_priority     = 1ULL << 3,
46 };
47
48 /* check features for use in registration with vendor drivers */
49 #define NVIDIA_FS_CHECK_FT_SGLIST_PREP(ops) \
50         ((ops)->ft_bmap & nvfs_ft_prep_sglist)
51 #define NVIDIA_FS_CHECK_FT_SGLIST_DMA(ops) \
52         ((ops)->ft_bmap & nvfs_ft_map_sglist)
53 #define NVIDIA_FS_CHECK_FT_GPU_PAGE(ops) \
54         ((ops)->ft_bmap & nvfs_ft_is_gpu_page)
55 #define NVIDIA_FS_CHECK_FT_DEVICE_PRIORITY(ops) \
56         ((ops)->ft_bmap & nvfs_ft_device_priority)
57
58 #endif /* LUSTRE_NVFS_H */
59