^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Copyright (c) 2005 Cisco Systems. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * licenses. You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * disclaimer in the documentation and/or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * $Id$
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #ifndef SCSI_SRP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define SCSI_SRP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Structures and constants for the SCSI RDMA Protocol (SRP) as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * defined by the INCITS T10 committee. This file was written using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * draft Revision 16a of the SRP standard.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <scsi/scsi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) SRP_LOGIN_REQ = 0x00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) SRP_TSK_MGMT = 0x01,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) SRP_CMD = 0x02,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) SRP_I_LOGOUT = 0x03,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) SRP_LOGIN_RSP = 0xc0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) SRP_RSP = 0xc1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) SRP_LOGIN_REJ = 0xc2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) SRP_T_LOGOUT = 0x80,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) SRP_CRED_REQ = 0x81,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) SRP_AER_REQ = 0x82,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) SRP_CRED_RSP = 0x41,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) SRP_AER_RSP = 0x42
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) SRP_BUF_FORMAT_DIRECT = 1 << 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) SRP_BUF_FORMAT_INDIRECT = 1 << 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) SRP_NO_DATA_DESC = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) SRP_DATA_DESC_DIRECT = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) SRP_DATA_DESC_INDIRECT = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) SRP_DATA_DESC_IMM = 3, /* new in SRP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) SRP_TSK_ABORT_TASK = 0x01,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) SRP_TSK_ABORT_TASK_SET = 0x02,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) SRP_TSK_CLEAR_TASK_SET = 0x04,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) SRP_TSK_LUN_RESET = 0x08,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) SRP_TSK_CLEAR_ACA = 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) enum srp_login_rej_reason {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) SRP_REV10_IB_IO_CLASS = 0xff00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) SRP_REV16A_IB_IO_CLASS = 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct srp_direct_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) __be64 va;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) __be32 key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) __be32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * We need the packed attribute because the SRP spec puts the list of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * descriptors at an offset of 20, which is not aligned to the size of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * struct srp_direct_buf. The whole structure must be packed to avoid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * having the 20-byte structure padded to 24 bytes on 64-bit architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct srp_indirect_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct srp_direct_buf table_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __be32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct srp_direct_buf desc_list[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* Immediate data buffer descriptor as defined in SRP2. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct srp_imm_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __be32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /* srp_login_req.flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) SRP_MULTICHAN_SINGLE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) SRP_MULTICHAN_MULTI = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) SRP_IMMED_REQUESTED = 0x80, /* new in SRP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct srp_login_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) u8 reserved1[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __be32 req_it_iu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) u8 reserved2[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) __be16 req_buf_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) u8 req_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) u8 reserved3[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) __be16 imm_data_offset; /* new in SRP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) u8 reserved4[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) u8 initiator_port_id[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) u8 target_port_id[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * struct srp_login_req_rdma - RDMA/CM login parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * RDMA/CM over InfiniBand can only carry 92 - 36 = 56 bytes of private
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * data. The %srp_login_req_rdma structure contains the same information as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * %srp_login_req but with the reserved data removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct srp_login_req_rdma {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) __be16 req_buf_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) u8 req_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __be32 req_it_iu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) u8 initiator_port_id[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) u8 target_port_id[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) __be16 imm_data_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) u8 reserved[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /* srp_login_rsp.rsp_flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) SRP_LOGIN_RSP_IMMED_SUPP = 0x80, /* new in SRP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * The SRP spec defines the size of the LOGIN_RSP structure to be 52
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * bytes, so it needs to be packed to avoid having it padded to 56
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * bytes on 64-bit architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) struct srp_login_rsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) u8 reserved1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) __be32 req_lim_delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) __be32 max_it_iu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) __be32 max_ti_iu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __be16 buf_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) u8 rsp_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) u8 reserved2[25];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct srp_login_rej {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) u8 reserved1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) __be32 reason;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) u8 reserved2[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __be16 buf_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) u8 reserved3[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct srp_i_logout {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) u8 reserved[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct srp_t_logout {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) u8 reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) __be32 reason;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * We need the packed attribute because the SRP spec only aligns the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * 8-byte LUN field to 4 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct srp_tsk_mgmt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) u8 reserved1[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) u8 reserved2[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct scsi_lun lun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) u8 reserved3[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) u8 tsk_mgmt_func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) u8 reserved4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) u64 task_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) u8 reserved5[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * We need the packed attribute because the SRP spec only aligns the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) * 8-byte LUN field to 4 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) struct srp_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) u8 reserved1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) u8 buf_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) u8 data_out_desc_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) u8 data_in_desc_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) u8 reserved2[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) struct scsi_lun lun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) u8 reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) u8 task_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) u8 reserved4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) u8 add_cdb_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) u8 cdb[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) u8 add_data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) SRP_RSP_FLAG_RSPVALID = 1 << 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) SRP_RSP_FLAG_SNSVALID = 1 << 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) SRP_RSP_FLAG_DOOVER = 1 << 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) SRP_RSP_FLAG_DOUNDER = 1 << 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) SRP_RSP_FLAG_DIOVER = 1 << 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) SRP_RSP_FLAG_DIUNDER = 1 << 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * The SRP spec defines the size of the RSP structure to be 36 bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * so it needs to be packed to avoid having it padded to 40 bytes on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * 64-bit architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct srp_rsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) u8 reserved1[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) __be32 req_lim_delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) u8 reserved2[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) u8 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) __be32 data_out_res_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) __be32 data_in_res_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) __be32 sense_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) __be32 resp_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) u8 data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) struct srp_cred_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) u8 reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) __be32 req_lim_delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) struct srp_cred_rsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) u8 reserved[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) * The SRP spec defines the fixed portion of the AER_REQ structure to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) * 36 bytes, so it needs to be packed to avoid having it padded to 40 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * on 64-bit architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) struct srp_aer_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) u8 sol_not;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) u8 reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) __be32 req_lim_delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) u32 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) struct scsi_lun lun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) __be32 sense_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) u32 reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) u8 sense_data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) struct srp_aer_rsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) u8 reserved[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) u64 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) #endif /* SCSI_SRP_H */