linux/drivers/scsi/bfa/include/bfi/bfi_fcpim.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
   3 * All rights reserved
   4 * www.brocade.com
   5 *
   6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
   7 *
   8 * This program is free software; you can redistribute it and/or modify it
   9 * under the terms of the GNU General Public License (GPL) Version 2 as
  10 * published by the Free Software Foundation
  11 *
  12 * This program is distributed in the hope that it will be useful, but
  13 * WITHOUT ANY WARRANTY; without even the implied warranty of
  14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15 * General Public License for more details.
  16 */
  17
  18#ifndef __BFI_FCPIM_H__
  19#define __BFI_FCPIM_H__
  20
  21#include "bfi.h"
  22#include <protocol/fcp.h>
  23
  24#pragma pack(1)
  25
  26/*
  27 * Initiator mode I-T nexus interface defines.
  28 */
  29
  30enum bfi_itnim_h2i {
  31        BFI_ITNIM_H2I_CREATE_REQ = 1,   /*  i-t nexus creation */
  32        BFI_ITNIM_H2I_DELETE_REQ = 2,   /*  i-t nexus deletion */
  33};
  34
  35enum bfi_itnim_i2h {
  36        BFI_ITNIM_I2H_CREATE_RSP = BFA_I2HM(1),
  37        BFI_ITNIM_I2H_DELETE_RSP = BFA_I2HM(2),
  38        BFI_ITNIM_I2H_SLER_EVENT = BFA_I2HM(3),
  39};
  40
  41struct bfi_itnim_create_req_s {
  42        struct bfi_mhdr_s  mh;          /*  common msg header            */
  43        u16        fw_handle;   /*  f/w handle for itnim         */
  44        u8         class;               /*  FC class for IO              */
  45        u8         seq_rec;     /*  sequence recovery support    */
  46        u8         msg_no;              /*  seq id of the msg            */
  47};
  48
  49struct bfi_itnim_create_rsp_s {
  50        struct bfi_mhdr_s  mh;          /*  common msg header            */
  51        u16        bfa_handle;  /*  bfa handle for itnim         */
  52        u8         status;              /*  fcp request status           */
  53        u8         seq_id;              /*  seq id of the msg            */
  54};
  55
  56struct bfi_itnim_delete_req_s {
  57        struct bfi_mhdr_s  mh;          /*  common msg header            */
  58        u16        fw_handle;   /*  f/w itnim handle             */
  59        u8         seq_id;              /*  seq id of the msg            */
  60        u8         rsvd;
  61};
  62
  63struct bfi_itnim_delete_rsp_s {
  64        struct bfi_mhdr_s  mh;          /*  common msg header            */
  65        u16        bfa_handle;  /*  bfa handle for itnim         */
  66        u8         status;              /*  fcp request status           */
  67        u8         seq_id;              /*  seq id of the msg            */
  68};
  69
  70struct bfi_itnim_sler_event_s {
  71        struct bfi_mhdr_s  mh;          /*  common msg header            */
  72        u16        bfa_handle;  /*  bfa handle for itnim         */
  73        u16        rsvd;
  74};
  75
  76union bfi_itnim_h2i_msg_u {
  77        struct bfi_itnim_create_req_s *create_req;
  78        struct bfi_itnim_delete_req_s *delete_req;
  79        struct bfi_msg_s      *msg;
  80};
  81
  82union bfi_itnim_i2h_msg_u {
  83        struct bfi_itnim_create_rsp_s *create_rsp;
  84        struct bfi_itnim_delete_rsp_s *delete_rsp;
  85        struct bfi_itnim_sler_event_s *sler_event;
  86        struct bfi_msg_s      *msg;
  87};
  88
  89/*
  90 * Initiator mode IO interface defines.
  91 */
  92
  93enum bfi_ioim_h2i {
  94        BFI_IOIM_H2I_IOABORT_REQ = 1,   /*  IO abort request     */
  95        BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /*  IO cleanup request   */
  96};
  97
  98enum bfi_ioim_i2h {
  99        BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1),      /*  non-fp IO response   */
 100        BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2),/*  ABORT rsp     */
 101};
 102
 103/**
 104 * IO command DIF info
 105 */
 106struct bfi_ioim_dif_s {
 107        u32     dif_info[4];
 108};
 109
 110/**
 111 * FCP IO messages overview
 112 *
 113 * @note
 114 * - Max CDB length supported is 64 bytes.
 115 * - SCSI Linked commands and SCSI bi-directional Commands not
 116 *       supported.
 117 *
 118 */
 119struct bfi_ioim_req_s {
 120        struct bfi_mhdr_s  mh;          /*  Common msg header            */
 121        u16        io_tag;              /*  I/O tag                      */
 122        u16        rport_hdl;   /*  itnim/rport firmware handle */
 123        struct fcp_cmnd_s cmnd;         /*  IO request info              */
 124
 125        /**
 126         * SG elements array within the IO request must be double word
 127         * aligned. This aligment is required to optimize SGM setup for the IO.
 128         */
 129        struct bfi_sge_s   sges[BFI_SGE_INLINE_MAX];
 130        u8         io_timeout;
 131        u8         dif_en;
 132        u8         rsvd_a[2];
 133        struct bfi_ioim_dif_s  dif;
 134};
 135
 136/**
 137 *      This table shows various IO status codes from firmware and their
 138 *      meaning. Host driver can use these status codes to further process
 139 *      IO completions.
 140 *
 141 *      BFI_IOIM_STS_OK         : IO completed with error free SCSI &
 142 *                                         transport status.
 143 *                                         - io-tag can be reused.
 144 *
 145 *      BFA_IOIM_STS_SCSI_ERR           : IO completed with scsi error.
 146 *                                        - io-tag can be reused.
 147 *
 148 *      BFI_IOIM_STS_HOST_ABORTED       : IO was aborted successfully due to
 149 *                                         host request.
 150 *                                         - io-tag cannot be reused yet.
 151 *
 152 *      BFI_IOIM_STS_ABORTED            : IO was aborted successfully
 153 *                                         internally by f/w.
 154 *                                         - io-tag cannot be reused yet.
 155 *
 156 *      BFI_IOIM_STS_TIMEDOUT   : IO timedout and ABTS/RRQ is happening
 157 *                                         in the firmware and
 158 *                                         - io-tag cannot be reused yet.
 159 *
 160 *      BFI_IOIM_STS_SQER_NEEDED        : Firmware could not recover the IO
 161 *                                        with sequence level error
 162 *                                        logic and hence host needs to retry
 163 *                                        this IO with a different IO tag
 164 *                                        - io-tag cannot be used yet.
 165 *
 166 *      BFI_IOIM_STS_NEXUS_ABORT        : Second Level Error Recovery from host
 167 *                                        is required because 2 consecutive ABTS
 168 *                                        timedout and host needs logout and
 169 *                                        re-login with the target
 170 *                                        - io-tag cannot be used yet.
 171 *
 172 *      BFI_IOIM_STS_UNDERRUN   : IO completed with SCSI status good,
 173 *                                        but the data tranferred is less than
 174 *                                        the fcp data length in the command.
 175 *                                        ex. SCSI INQUIRY where transferred
 176 *                                        data length and residue count in FCP
 177 *                                        response accounts for total fcp-dl
 178 *                                        - io-tag can be reused.
 179 *
 180 *      BFI_IOIM_STS_OVERRUN    : IO completed with SCSI status good,
 181 *                                        but the data transerred is more than
 182 *                                        fcp data length in the command. ex.
 183 *                                        TAPE IOs where blocks can of unequal
 184 *                                        lengths.
 185 *                                        - io-tag can be reused.
 186 *
 187 *      BFI_IOIM_STS_RES_FREE   : Firmware has completed using io-tag
 188 *                                        during abort process
 189 *                                        - io-tag can be reused.
 190 *
 191 *      BFI_IOIM_STS_PROTO_ERR  : Firmware detected a protocol error.
 192 *                                        ex target sent more data than
 193 *                                        requested, or there was data frame
 194 *                                        loss and other reasons
 195 *                                        - io-tag cannot be used yet.
 196 *
 197 *      BFI_IOIM_STS_DIF_ERR    : Firwmare detected DIF error. ex: DIF
 198 *                                        CRC err or Ref Tag err or App tag err.
 199 *                                        - io-tag can be reused.
 200 *
 201 *      BFA_IOIM_STS_TSK_MGT_ABORT      : IO was aborted because of Task
 202 *                                        Management command from the host
 203 *                                        - io-tag can be reused.
 204 *
 205 *      BFI_IOIM_STS_UTAG               : Firmware does not know about this
 206 *                                        io_tag.
 207 *                                        - io-tag can be reused.
 208 */
 209enum bfi_ioim_status {
 210        BFI_IOIM_STS_OK = 0,
 211        BFI_IOIM_STS_HOST_ABORTED = 1,
 212        BFI_IOIM_STS_ABORTED = 2,
 213        BFI_IOIM_STS_TIMEDOUT = 3,
 214        BFI_IOIM_STS_RES_FREE = 4,
 215        BFI_IOIM_STS_SQER_NEEDED = 5,
 216        BFI_IOIM_STS_PROTO_ERR = 6,
 217        BFI_IOIM_STS_UTAG = 7,
 218        BFI_IOIM_STS_PATHTOV = 8,
 219};
 220
 221#define BFI_IOIM_SNSLEN (256)
 222/**
 223 * I/O response message
 224 */
 225struct bfi_ioim_rsp_s {
 226        struct bfi_mhdr_s  mh;          /*  common msg header            */
 227        u16        io_tag;              /*  completed IO tag             */
 228        u16        bfa_rport_hndl;      /*  releated rport handle        */
 229        u8         io_status;   /*  IO completion status         */
 230        u8         reuse_io_tag;        /*  IO tag can be reused        */
 231        u16     abort_tag;      /*  host abort request tag      */
 232        u8              scsi_status;    /*  scsi status from target      */
 233        u8              sns_len;        /*  scsi sense length            */
 234        u8              resid_flags;    /*  IO residue flags             */
 235        u8              rsvd_a;
 236        u32     residue;        /*  IO residual length in bytes */
 237        u32     rsvd_b[3];
 238};
 239
 240struct bfi_ioim_abort_req_s {
 241        struct bfi_mhdr_s  mh;          /*  Common msg header  */
 242        u16        io_tag;         /*  I/O tag            */
 243        u16        abort_tag;      /*  unique request tag */
 244};
 245
 246/*
 247 * Initiator mode task management command interface defines.
 248 */
 249
 250enum bfi_tskim_h2i {
 251        BFI_TSKIM_H2I_TM_REQ    = 1, /*  task-mgmt command         */
 252        BFI_TSKIM_H2I_ABORT_REQ = 2, /*  task-mgmt command         */
 253};
 254
 255enum bfi_tskim_i2h {
 256        BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
 257};
 258
 259struct bfi_tskim_req_s {
 260        struct bfi_mhdr_s  mh;             /*  Common msg header          */
 261        u16        tsk_tag;        /*  task management tag        */
 262        u16        itn_fhdl;       /*  itn firmware handle        */
 263        lun_t           lun;            /*  LU number                  */
 264        u8         tm_flags;       /*  see fcp_tm_cmnd_t          */
 265        u8         t_secs;         /*  Timeout value in seconds   */
 266        u8         rsvd[2];
 267};
 268
 269struct bfi_tskim_abortreq_s {
 270        struct bfi_mhdr_s  mh;             /*  Common msg header          */
 271        u16        tsk_tag;        /*  task management tag        */
 272        u16        rsvd;
 273};
 274
 275enum bfi_tskim_status {
 276        /*
 277         * Following are FCP-4 spec defined status codes,
 278         * **DO NOT CHANGE THEM **
 279         */
 280        BFI_TSKIM_STS_OK       = 0,
 281        BFI_TSKIM_STS_NOT_SUPP = 4,
 282        BFI_TSKIM_STS_FAILED   = 5,
 283
 284        /**
 285         * Defined by BFA
 286         */
 287        BFI_TSKIM_STS_TIMEOUT  = 10,    /*  TM request timedout     */
 288        BFI_TSKIM_STS_ABORTED  = 11,    /*  Aborted on host request */
 289};
 290
 291struct bfi_tskim_rsp_s {
 292        struct bfi_mhdr_s  mh;          /*  Common msg header            */
 293        u16        tsk_tag;     /*  task mgmt cmnd tag           */
 294        u8         tsk_status;  /*  @ref bfi_tskim_status */
 295        u8         rsvd;
 296};
 297
 298#pragma pack()
 299
 300#endif /* __BFI_FCPIM_H__ */
 301
 302
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.