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