Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  iSCSI Transport BSG Interface
0004  *
0005  *  Copyright (C) 2009   James Smart, Emulex Corporation
0006  */
0007 
0008 #ifndef SCSI_BSG_ISCSI_H
0009 #define SCSI_BSG_ISCSI_H
0010 
0011 /*
0012  * This file intended to be included by both kernel and user space
0013  */
0014 
0015 #include <scsi/scsi.h>
0016 
0017 /*
0018  * iSCSI Transport SGIO v4 BSG Message Support
0019  */
0020 
0021 /* Default BSG request timeout (in seconds) */
0022 #define ISCSI_DEFAULT_BSG_TIMEOUT      (10 * HZ)
0023 
0024 
0025 /*
0026  * Request Message Codes supported by the iSCSI Transport
0027  */
0028 
0029 /* define the class masks for the message codes */
0030 #define ISCSI_BSG_CLS_MASK     0xF0000000      /* find object class */
0031 #define ISCSI_BSG_HST_MASK     0x80000000      /* iscsi host class */
0032 
0033 /* iscsi host Message Codes */
0034 #define ISCSI_BSG_HST_VENDOR           (ISCSI_BSG_HST_MASK | 0x000000FF)
0035 
0036 
0037 /*
0038  * iSCSI Host Messages
0039  */
0040 
0041 /* ISCSI_BSG_HST_VENDOR : */
0042 
0043 /* Request:
0044  * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
0045  *   formatting requirements specified in scsi_netlink.h
0046  */
0047 struct iscsi_bsg_host_vendor {
0048     /*
0049      * Identifies the vendor that the message is formatted for. This
0050      * should be the recipient of the message.
0051      */
0052     uint64_t vendor_id;
0053 
0054     /* start of vendor command area */
0055     uint32_t vendor_cmd[];
0056 };
0057 
0058 /* Response:
0059  */
0060 struct iscsi_bsg_host_vendor_reply {
0061     /* start of vendor response area */
0062     uint32_t vendor_rsp[0];
0063 };
0064 
0065 
0066 /* request (CDB) structure of the sg_io_v4 */
0067 struct iscsi_bsg_request {
0068     uint32_t msgcode;
0069     union {
0070         struct iscsi_bsg_host_vendor    h_vendor;
0071     } rqst_data;
0072 } __attribute__((packed));
0073 
0074 
0075 /* response (request sense data) structure of the sg_io_v4 */
0076 struct iscsi_bsg_reply {
0077     /*
0078      * The completion result. Result exists in two forms:
0079      * if negative, it is an -Exxx system errno value. There will
0080      * be no further reply information supplied.
0081      * else, it's the 4-byte scsi error result, with driver, host,
0082      * msg and status fields. The per-msgcode reply structure
0083      * will contain valid data.
0084      */
0085     uint32_t result;
0086 
0087     /* If there was reply_payload, how much was received ? */
0088     uint32_t reply_payload_rcv_len;
0089 
0090     union {
0091         struct iscsi_bsg_host_vendor_reply      vendor_reply;
0092     } reply_data;
0093 };
0094 
0095 
0096 #endif /* SCSI_BSG_ISCSI_H */