1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2 | /* |
3 | * iSCSI Transport BSG Interface |
4 | * |
5 | * Copyright (C) 2009 James Smart, Emulex Corporation |
6 | */ |
7 | |
8 | #ifndef SCSI_BSG_ISCSI_H |
9 | #define SCSI_BSG_ISCSI_H |
10 | |
11 | /* |
12 | * This file intended to be included by both kernel and user space |
13 | */ |
14 | |
15 | #include <scsi/scsi.h> |
16 | |
17 | /* |
18 | * iSCSI Transport SGIO v4 BSG Message Support |
19 | */ |
20 | |
21 | /* Default BSG request timeout (in seconds) */ |
22 | #define ISCSI_DEFAULT_BSG_TIMEOUT (10 * HZ) |
23 | |
24 | |
25 | /* |
26 | * Request Message Codes supported by the iSCSI Transport |
27 | */ |
28 | |
29 | /* define the class masks for the message codes */ |
30 | #define ISCSI_BSG_CLS_MASK 0xF0000000 /* find object class */ |
31 | #define ISCSI_BSG_HST_MASK 0x80000000 /* iscsi host class */ |
32 | |
33 | /* iscsi host Message Codes */ |
34 | #define ISCSI_BSG_HST_VENDOR (ISCSI_BSG_HST_MASK | 0x000000FF) |
35 | |
36 | |
37 | /* |
38 | * iSCSI Host Messages |
39 | */ |
40 | |
41 | /* ISCSI_BSG_HST_VENDOR : */ |
42 | |
43 | /* Request: |
44 | * Note: When specifying vendor_id, be sure to read the Vendor Type and ID |
45 | * formatting requirements specified in scsi_netlink.h |
46 | */ |
47 | struct iscsi_bsg_host_vendor { |
48 | /* |
49 | * Identifies the vendor that the message is formatted for. This |
50 | * should be the recipient of the message. |
51 | */ |
52 | uint64_t vendor_id; |
53 | |
54 | /* start of vendor command area */ |
55 | uint32_t vendor_cmd[]; |
56 | }; |
57 | |
58 | /* Response: |
59 | */ |
60 | struct iscsi_bsg_host_vendor_reply { |
61 | /* start of vendor response area */ |
62 | uint32_t vendor_rsp[0]; |
63 | }; |
64 | |
65 | |
66 | /* request (CDB) structure of the sg_io_v4 */ |
67 | struct iscsi_bsg_request { |
68 | uint32_t msgcode; |
69 | union { |
70 | struct iscsi_bsg_host_vendor h_vendor; |
71 | } rqst_data; |
72 | } __attribute__((packed)); |
73 | |
74 | |
75 | /* response (request sense data) structure of the sg_io_v4 */ |
76 | struct iscsi_bsg_reply { |
77 | /* |
78 | * The completion result. Result exists in two forms: |
79 | * if negative, it is an -Exxx system errno value. There will |
80 | * be no further reply information supplied. |
81 | * else, it's the 4-byte scsi error result, with driver, host, |
82 | * msg and status fields. The per-msgcode reply structure |
83 | * will contain valid data. |
84 | */ |
85 | uint32_t result; |
86 | |
87 | /* If there was reply_payload, how much was received ? */ |
88 | uint32_t reply_payload_rcv_len; |
89 | |
90 | union { |
91 | struct iscsi_bsg_host_vendor_reply vendor_reply; |
92 | } reply_data; |
93 | }; |
94 | |
95 | |
96 | #endif /* SCSI_BSG_ISCSI_H */ |
97 | |