This patch adjusts the DMA map benchmark framework to make the DMA map benchmark framework more flexible and adaptable to other mapping modes in the future. By abstracting the framework into five interfaces: prepare, unprepare, initialize_data, do_map, and do_unmap. The new map schema can be introduced more easily without major modifications to the existing code structure.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -17,6 +17,11 @@ · 16 unmodified lines | |||
| 17 | #define DMA_MAP_TO_DEVICE 1 | 17 | #define DMA_MAP_TO_DEVICE 1 |
| 18 | #define DMA_MAP_FROM_DEVICE 2 | 18 | #define DMA_MAP_FROM_DEVICE 2 |
| 19 | 19 | ||
| 20 | enum { | ||
| 21 | DMA_MAP_BENCH_SINGLE_MODE, | ||
| 22 | DMA_MAP_BENCH_MODE_MAX | ||
| 23 | }; | ||
| 24 | |||
| 20 | struct map_benchmark { | 25 | struct map_benchmark { |
| 21 | __u64 avg_map_100ns; /* average map latency in 100ns */ | 26 | __u64 avg_map_100ns; /* average map latency in 100ns */ |
| 22 | __u64 map_stddev; /* standard deviation of map latency */ | 27 | __u64 map_stddev; /* standard deviation of map latency */ |
| @@ -29,7 +34,8 @@ struct map_benchmark { · 6 unmodified lines | |||
| 29 | __u32 dma_dir; /* DMA data direction */ | 34 | __u32 dma_dir; /* DMA data direction */ |
| 30 | __u32 dma_trans_ns; /* time for DMA transmission in ns */ | 35 | __u32 dma_trans_ns; /* time for DMA transmission in ns */ |
| 31 | __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */ | 36 | __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */ |
| 32 | __u8 expansion[76]; /* For future use */ | 37 | __u8 map_mode; /* the mode of dma map */ |
| 38 | __u8 expansion[75]; /* For future use */ | ||
| 33 | }; | 39 | }; |
| 34 | 40 | ||
| 35 | #endif /* _UAPI_DMA_BENCHMARK_H */ | 41 | #endif /* _UAPI_DMA_BENCHMARK_H */ |