Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef TARGET_CORE_RD_H
3#define TARGET_CORE_RD_H
4
5#include <linux/module.h>
6#include <linux/types.h>
7#include <target/target_core_base.h>
8
9#define RD_HBA_VERSION "v4.0"
10#define RD_MCP_VERSION "4.0"
11
12/* Largest piece of memory kmalloc can allocate */
13#define RD_MAX_ALLOCATION_SIZE 65536
14#define RD_DEVICE_QUEUE_DEPTH 32
15#define RD_MAX_DEVICE_QUEUE_DEPTH 128
16#define RD_BLOCKSIZE 512
17
18/* Used in target_core_init_configfs() for virtual LUN 0 access */
19int __init rd_module_init(void);
20void rd_module_exit(void);
21
22struct rd_dev_sg_table {
23 u32 page_start_offset;
24 u32 page_end_offset;
25 u32 rd_sg_count;
26 struct scatterlist *sg_table;
27} ____cacheline_aligned;
28
29#define RDF_HAS_PAGE_COUNT 0x01
30#define RDF_NULLIO 0x02
31#define RDF_DUMMY 0x04
32
33struct rd_dev {
34 struct se_device dev;
35 u32 rd_flags;
36 /* Unique Ramdisk Device ID in Ramdisk HBA */
37 u32 rd_dev_id;
38 /* Total page count for ramdisk device */
39 u32 rd_page_count;
40 /* Number of SG tables in sg_table_array */
41 u32 sg_table_count;
42 /* Number of SG tables in sg_prot_array */
43 u32 sg_prot_count;
44 /* Array of rd_dev_sg_table_t containing scatterlists */
45 struct rd_dev_sg_table *sg_table_array;
46 /* Array of rd_dev_sg_table containing protection scatterlists */
47 struct rd_dev_sg_table *sg_prot_array;
48 /* Ramdisk HBA device is connected to */
49 struct rd_host *rd_host;
50} ____cacheline_aligned;
51
52struct rd_host {
53 u32 rd_host_dev_id_count;
54 u32 rd_host_id; /* Unique Ramdisk Host ID */
55} ____cacheline_aligned;
56
57#endif /* TARGET_CORE_RD_H */
1#ifndef TARGET_CORE_RD_H
2#define TARGET_CORE_RD_H
3
4#define RD_HBA_VERSION "v4.0"
5#define RD_DR_VERSION "4.0"
6#define RD_MCP_VERSION "4.0"
7
8/* Largest piece of memory kmalloc can allocate */
9#define RD_MAX_ALLOCATION_SIZE 65536
10#define RD_DEVICE_QUEUE_DEPTH 32
11#define RD_MAX_DEVICE_QUEUE_DEPTH 128
12#define RD_BLOCKSIZE 512
13#define RD_MAX_SECTORS 1024
14
15/* Used in target_core_init_configfs() for virtual LUN 0 access */
16int __init rd_module_init(void);
17void rd_module_exit(void);
18
19#define RRF_EMULATE_CDB 0x01
20#define RRF_GOT_LBA 0x02
21
22struct rd_request {
23 struct se_task rd_task;
24
25 /* SCSI CDB from iSCSI Command PDU */
26 unsigned char rd_scsi_cdb[TCM_MAX_COMMAND_SIZE];
27 /* Offset from start of page */
28 u32 rd_offset;
29 /* Starting page in Ramdisk for request */
30 u32 rd_page;
31 /* Total number of pages needed for request */
32 u32 rd_page_count;
33 /* Scatterlist count */
34 u32 rd_size;
35} ____cacheline_aligned;
36
37struct rd_dev_sg_table {
38 u32 page_start_offset;
39 u32 page_end_offset;
40 u32 rd_sg_count;
41 struct scatterlist *sg_table;
42} ____cacheline_aligned;
43
44#define RDF_HAS_PAGE_COUNT 0x01
45
46struct rd_dev {
47 int rd_direct;
48 u32 rd_flags;
49 /* Unique Ramdisk Device ID in Ramdisk HBA */
50 u32 rd_dev_id;
51 /* Total page count for ramdisk device */
52 u32 rd_page_count;
53 /* Number of SG tables in sg_table_array */
54 u32 sg_table_count;
55 u32 rd_queue_depth;
56 /* Array of rd_dev_sg_table_t containing scatterlists */
57 struct rd_dev_sg_table *sg_table_array;
58 /* Ramdisk HBA device is connected to */
59 struct rd_host *rd_host;
60} ____cacheline_aligned;
61
62struct rd_host {
63 u32 rd_host_dev_id_count;
64 u32 rd_host_id; /* Unique Ramdisk Host ID */
65} ____cacheline_aligned;
66
67#endif /* TARGET_CORE_RD_H */