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