Print this page
NEX-5428 Backout the 5.0 changes
NEX-2937 Continuous write_same starves all other commands
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-3217 Panic running benchmark at ESX VM
NEX-3204 Panic doing FC rescan from ESXi 5.5u1 with VAAI enabled
        Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
        Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
NEX-3023 Panics and hangs when using write_same and compare_and_write
Review by: Bayard Bell <bayard.bell@nexenta.com>
Review by: Rick McNeal <rick.mcneal@nexenta.com>
Review by: Jean McCormack <jean.mccormack@nexenta.com>
Approved by: Jean McCormack <jean.mccormack@nexenta.com>
Related bug: NEX-2723 Kernel panic in xfer_completion code for write_same (0x93) and compare_and_write (0x89)
NEX-2178 Multi-block transfers on memory constrained systems for write_same (0x93) and compare_and_write (0x89) cause memory corruption
NEX-2105 assertion failed: (scmd->flags & SBD_SCSI_CMD_TRANS_DATA) && scmd->trans_data != NULL, file: ../../common/io/comstar/lu/stmf_sbd/sbd_scsi.c, line: 2447
SUP-698  Appliance is regularly crashing with a kernel memory allocator, duplicate free: buffer freed
NEX-2105 assertion failed: (scmd->flags & SBD_SCSI_CMD_TRANS_DATA) && scmd->trans_data != NULL, file:
NEX-1965 Page fault at netbios_first_level_name_decode+0xbb
Support simultaneous compare_and_write operations for VAAI
Bug IDs SUP-505
                SUP-1768
                SUP-1928
Code Reviewers:
        Sarah Jelinek
        Jeffry Molanus
        Albert Lee
        Harold Shaw
OS-69 Open source VAAI
8226 nza-kernel needs to be buildable by itself
Re #6790 backspace should perform delete on console
VAAI (XXX ATS support for COMSTAR, YYY Block-copy support for COMSTAR)


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23  *
  24  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 #ifndef _SBD_IMPL_H
  28 #define _SBD_IMPL_H
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 struct register_lu_cmd;
  35 struct modify_lu_cmd;
  36 struct sbd_lu_attr;
  37 struct sbd_it_data;
  38 





  39 /*
  40  * sms endianess
  41  */
  42 #define SMS_BIG_ENDIAN                  0x00
  43 #define SMS_LITTLE_ENDIAN               0xFF
  44 
  45 #ifdef  _BIG_ENDIAN
  46 #define SMS_DATA_ORDER  SMS_BIG_ENDIAN
  47 #else
  48 #define SMS_DATA_ORDER  SMS_LITTLE_ENDIAN
  49 #endif
  50 
  51 /* Test if one of the BitOrder definitions exists */
  52 #ifdef _BIT_FIELDS_LTOH
  53 #elif defined(_BIT_FIELDS_HTOL)
  54 #else
  55 #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
  56 #endif
  57 
  58 #define SBD_V0_MAGIC    0x53554e4d4943524f


 189         uint8_t                 sli_data_order;
 190         uint8_t                 rsvd1;
 191         uint8_t                 sli_lu_devid[20];
 192         uint32_t                rsvd2;
 193 } sbd_lu_info_t;
 194 
 195 /*
 196  * sl_flags
 197  */
 198 #define SBD_LU_HAS_SCSI2_RESERVATION    0x0001
 199 
 200 typedef struct sbd_cmd {
 201         uint8_t         flags;
 202         uint8_t         nbufs;
 203         uint16_t        cmd_type;       /* Type of command */
 204         uint32_t        trans_data_len; /* Length of transient data buf */
 205         uint64_t        addr;           /* current */
 206         uint32_t        len;            /* len left */
 207         uint32_t        current_ro;     /* running relative offset */
 208         uint8_t         *trans_data;    /* Any transient data */


 209 } sbd_cmd_t;
 210 
 211 /*
 212  * flags for sbd_cmd

















 213  */
 214 #define SBD_SCSI_CMD_ACTIVE             0x01
 215 #define SBD_SCSI_CMD_ABORT_REQUESTED    0x02
 216 #define SBD_SCSI_CMD_XFER_FAIL          0x04
 217 #define SBD_SCSI_CMD_SYNC_WRITE         0x08
 218 #define SBD_SCSI_CMD_TRANS_DATA         0x10

 219 
 220 /*
 221  * cmd types
 222  */
 223 #define SBD_CMD_SCSI_READ       0x01
 224 #define SBD_CMD_SCSI_WRITE      0x02
 225 #define SBD_CMD_SMALL_READ      0x03
 226 #define SBD_CMD_SMALL_WRITE     0x04
 227 #define SBD_CMD_SCSI_PR_OUT     0x05
 228 
 229 typedef struct sbd_it_data {
 230         struct sbd_it_data      *sbd_it_next;
 231         uint64_t                sbd_it_session_id;
 232         uint8_t                 sbd_it_lun[8];
 233         uint8_t                 sbd_it_ua_conditions;
 234         uint8_t                 sbd_it_flags;
 235         sbd_pgr_key_t           *pgr_key_ptr;
 236 } sbd_it_data_t;
 237 
 238 typedef struct sbd_create_standby_lu {


 283 /*
 284  * zvol data path functions
 285  */
 286 int sbd_zvol_get_volume_params(sbd_lu_t *sl);
 287 uint32_t sbd_zvol_numsegs(sbd_lu_t *sl, uint64_t off, uint32_t len);
 288 int sbd_zvol_alloc_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 289 void sbd_zvol_rele_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 290 int sbd_zvol_alloc_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 291 void sbd_zvol_rele_write_bufs_abort(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 292 int sbd_zvol_rele_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 293 int sbd_zvol_copy_read(sbd_lu_t *sl, uio_t *uio);
 294 int sbd_zvol_copy_write(sbd_lu_t *sl, uio_t *uio, int flags);
 295 
 296 stmf_status_t sbd_task_alloc(struct scsi_task *task);
 297 void sbd_new_task(struct scsi_task *task, struct stmf_data_buf *initial_dbuf);
 298 void sbd_dbuf_xfer_done(struct scsi_task *task, struct stmf_data_buf *dbuf);
 299 void sbd_send_status_done(struct scsi_task *task);
 300 void sbd_task_free(struct scsi_task *task);
 301 stmf_status_t sbd_abort(struct stmf_lu *lu, int abort_cmd, void *arg,
 302                                                         uint32_t flags);

 303 void sbd_dbuf_free(struct scsi_task *task, struct stmf_data_buf *dbuf);
 304 void sbd_ctl(struct stmf_lu *lu, int cmd, void *arg);
 305 stmf_status_t sbd_info(uint32_t cmd, stmf_lu_t *lu, void *arg,
 306                                 uint8_t *buf, uint32_t *bufsizep);


 307 
 308 #ifdef  __cplusplus
 309 }
 310 #endif
 311 
 312 #endif /* _SBD_IMPL_H */


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23  *
  24  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 #ifndef _SBD_IMPL_H
  28 #define _SBD_IMPL_H
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 struct register_lu_cmd;
  35 struct modify_lu_cmd;
  36 struct sbd_lu_attr;
  37 struct sbd_it_data;
  38 
  39 #define ATOMIC8_GET(val) (              \
  40                         (atomic_add_8_nv(&(val), 0)))
  41 #define ATOMIC32_GET(val) (             \
  42                         (atomic_add_32_nv(&(val), 0)))
  43 
  44 /*
  45  * sms endianess
  46  */
  47 #define SMS_BIG_ENDIAN                  0x00
  48 #define SMS_LITTLE_ENDIAN               0xFF
  49 
  50 #ifdef  _BIG_ENDIAN
  51 #define SMS_DATA_ORDER  SMS_BIG_ENDIAN
  52 #else
  53 #define SMS_DATA_ORDER  SMS_LITTLE_ENDIAN
  54 #endif
  55 
  56 /* Test if one of the BitOrder definitions exists */
  57 #ifdef _BIT_FIELDS_LTOH
  58 #elif defined(_BIT_FIELDS_HTOL)
  59 #else
  60 #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
  61 #endif
  62 
  63 #define SBD_V0_MAGIC    0x53554e4d4943524f


 194         uint8_t                 sli_data_order;
 195         uint8_t                 rsvd1;
 196         uint8_t                 sli_lu_devid[20];
 197         uint32_t                rsvd2;
 198 } sbd_lu_info_t;
 199 
 200 /*
 201  * sl_flags
 202  */
 203 #define SBD_LU_HAS_SCSI2_RESERVATION    0x0001
 204 
 205 typedef struct sbd_cmd {
 206         uint8_t         flags;
 207         uint8_t         nbufs;
 208         uint16_t        cmd_type;       /* Type of command */
 209         uint32_t        trans_data_len; /* Length of transient data buf */
 210         uint64_t        addr;           /* current */
 211         uint32_t        len;            /* len left */
 212         uint32_t        current_ro;     /* running relative offset */
 213         uint8_t         *trans_data;    /* Any transient data */
 214         ats_state_t     *ats_state;
 215         uint32_t        rsvd;
 216 } sbd_cmd_t;
 217 
 218 /*
 219  * flags for sbd_cmd
 220  *
 221  * SBD_SCSI_CMD_ACTIVE means that a command is running.  This is the time
 222  *      between the function sbd_new_task is called and either the command
 223  *      completion is sent (stmf_scsilib_send_status) or an abort is
 224  *      issued
 225  *
 226  * SBD_SCSI_CMD_ABORT_REQUESTED is when a command is being aborted.  It may
 227  *      be set prior to the task being dispatched or anywhere in the process
 228  *      of the command.
 229  *
 230  * SBD_SCSI_CMD_XFER_FAIL is set when a command data buffer transfer was
 231  *      errored.  Usually it leads to an abort.
 232  *
 233  * SBD_SCSI_CMD_SYNC_WRITE synchronous write being done.
 234  *
 235  * SBD_SCSI_CMD_TRANS_DATA means that a buffer has been allocated to
 236  *      be used for the transfer of data.
 237  */
 238 #define SBD_SCSI_CMD_ACTIVE             0x01
 239 #define SBD_SCSI_CMD_ABORT_REQUESTED    0x02
 240 #define SBD_SCSI_CMD_XFER_FAIL          0x04
 241 #define SBD_SCSI_CMD_SYNC_WRITE         0x08
 242 #define SBD_SCSI_CMD_TRANS_DATA         0x10
 243 #define SBD_SCSI_CMD_ATS_RELATED        0x20
 244 
 245 /*
 246  * cmd types
 247  */
 248 #define SBD_CMD_SCSI_READ       0x01
 249 #define SBD_CMD_SCSI_WRITE      0x02
 250 #define SBD_CMD_SMALL_READ      0x03
 251 #define SBD_CMD_SMALL_WRITE     0x04
 252 #define SBD_CMD_SCSI_PR_OUT     0x05
 253 
 254 typedef struct sbd_it_data {
 255         struct sbd_it_data      *sbd_it_next;
 256         uint64_t                sbd_it_session_id;
 257         uint8_t                 sbd_it_lun[8];
 258         uint8_t                 sbd_it_ua_conditions;
 259         uint8_t                 sbd_it_flags;
 260         sbd_pgr_key_t           *pgr_key_ptr;
 261 } sbd_it_data_t;
 262 
 263 typedef struct sbd_create_standby_lu {


 308 /*
 309  * zvol data path functions
 310  */
 311 int sbd_zvol_get_volume_params(sbd_lu_t *sl);
 312 uint32_t sbd_zvol_numsegs(sbd_lu_t *sl, uint64_t off, uint32_t len);
 313 int sbd_zvol_alloc_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 314 void sbd_zvol_rele_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 315 int sbd_zvol_alloc_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 316 void sbd_zvol_rele_write_bufs_abort(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 317 int sbd_zvol_rele_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
 318 int sbd_zvol_copy_read(sbd_lu_t *sl, uio_t *uio);
 319 int sbd_zvol_copy_write(sbd_lu_t *sl, uio_t *uio, int flags);
 320 
 321 stmf_status_t sbd_task_alloc(struct scsi_task *task);
 322 void sbd_new_task(struct scsi_task *task, struct stmf_data_buf *initial_dbuf);
 323 void sbd_dbuf_xfer_done(struct scsi_task *task, struct stmf_data_buf *dbuf);
 324 void sbd_send_status_done(struct scsi_task *task);
 325 void sbd_task_free(struct scsi_task *task);
 326 stmf_status_t sbd_abort(struct stmf_lu *lu, int abort_cmd, void *arg,
 327                                                         uint32_t flags);
 328 void sbd_task_poll(struct scsi_task *task);
 329 void sbd_dbuf_free(struct scsi_task *task, struct stmf_data_buf *dbuf);
 330 void sbd_ctl(struct stmf_lu *lu, int cmd, void *arg);
 331 stmf_status_t sbd_info(uint32_t cmd, stmf_lu_t *lu, void *arg,
 332                                 uint8_t *buf, uint32_t *bufsizep);
 333 uint8_t sbd_get_lbasize_shift(stmf_lu_t *lu);
 334 int sbd_is_valid_lu(stmf_lu_t *lu);
 335 
 336 #ifdef  __cplusplus
 337 }
 338 #endif
 339 
 340 #endif /* _SBD_IMPL_H */