target_core_rd.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef TARGET_CORE_RD_H
  3. #define TARGET_CORE_RD_H
  4. #include <linux/module.h>
  5. #include <linux/types.h>
  6. #include <target/target_core_base.h>
  7. #define RD_HBA_VERSION "v4.0"
  8. #define RD_MCP_VERSION "4.0"
  9. /* Largest piece of memory kmalloc can allocate */
  10. #define RD_MAX_ALLOCATION_SIZE 65536
  11. #define RD_DEVICE_QUEUE_DEPTH 32
  12. #define RD_MAX_DEVICE_QUEUE_DEPTH 128
  13. #define RD_BLOCKSIZE 512
  14. /* Used in target_core_init_configfs() for virtual LUN 0 access */
  15. int __init rd_module_init(void);
  16. void rd_module_exit(void);
  17. struct rd_dev_sg_table {
  18. u32 page_start_offset;
  19. u32 page_end_offset;
  20. u32 rd_sg_count;
  21. struct scatterlist *sg_table;
  22. } ____cacheline_aligned;
  23. #define RDF_HAS_PAGE_COUNT 0x01
  24. #define RDF_NULLIO 0x02
  25. #define RDF_DUMMY 0x04
  26. struct rd_dev {
  27. struct se_device dev;
  28. u32 rd_flags;
  29. /* Unique Ramdisk Device ID in Ramdisk HBA */
  30. u32 rd_dev_id;
  31. /* Total page count for ramdisk device */
  32. u32 rd_page_count;
  33. /* Number of SG tables in sg_table_array */
  34. u32 sg_table_count;
  35. /* Number of SG tables in sg_prot_array */
  36. u32 sg_prot_count;
  37. /* Array of rd_dev_sg_table_t containing scatterlists */
  38. struct rd_dev_sg_table *sg_table_array;
  39. /* Array of rd_dev_sg_table containing protection scatterlists */
  40. struct rd_dev_sg_table *sg_prot_array;
  41. /* Ramdisk HBA device is connected to */
  42. struct rd_host *rd_host;
  43. } ____cacheline_aligned;
  44. struct rd_host {
  45. u32 rd_host_dev_id_count;
  46. u32 rd_host_id; /* Unique Ramdisk Host ID */
  47. } ____cacheline_aligned;
  48. #endif /* TARGET_CORE_RD_H */