1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright 2008 Cisco Systems, Inc. All rights reserved. 4 * Copyright 2007 Nuova Systems, Inc. All rights reserved. 5 */ 6 #ifndef _FNIC_IO_H_ 7 #define _FNIC_IO_H_ 8 9 #include <scsi/fc/fc_fcp.h> 10 #include "fnic_fdls.h" 11 12 #define FNIC_DFLT_SG_DESC_CNT 32 13 #define FNIC_MAX_SG_DESC_CNT 256 /* Maximum descriptors per sgl */ 14 #define FNIC_SG_DESC_ALIGN 16 /* Descriptor address alignment */ 15 16 struct host_sg_desc { 17 __le64 addr; 18 __le32 len; 19 u32 _resvd; 20 }; 21 22 struct fnic_dflt_sgl_list { 23 struct host_sg_desc sg_desc[FNIC_DFLT_SG_DESC_CNT]; 24 }; 25 26 struct fnic_sgl_list { 27 struct host_sg_desc sg_desc[FNIC_MAX_SG_DESC_CNT]; 28 }; 29 30 enum fnic_sgl_list_type { 31 FNIC_SGL_CACHE_DFLT = 0, /* cache with default size sgl */ 32 FNIC_SGL_CACHE_MAX, /* cache with max size sgl */ 33 FNIC_SGL_NUM_CACHES /* number of sgl caches */ 34 }; 35 36 enum fnic_ioreq_state { 37 FNIC_IOREQ_NOT_INITED = 0, 38 FNIC_IOREQ_CMD_PENDING, 39 FNIC_IOREQ_ABTS_PENDING, 40 FNIC_IOREQ_ABTS_COMPLETE, 41 FNIC_IOREQ_CMD_COMPLETE, 42 }; 43 44 struct fnic_io_req { 45 struct fnic_iport_s *iport; 46 struct fnic_tport_s *tport; 47 struct host_sg_desc *sgl_list; /* sgl list */ 48 void *sgl_list_alloc; /* sgl list address used for free */ 49 dma_addr_t sense_buf_pa; /* dma address for sense buffer*/ 50 dma_addr_t sgl_list_pa; /* dma address for sgl list */ 51 u16 sgl_cnt; 52 u8 sgl_type; /* device DMA descriptor list type */ 53 u8 io_completed:1; /* set to 1 when fw completes IO */ 54 u32 port_id; /* remote port DID */ 55 unsigned long start_time; /* in jiffies */ 56 struct completion *abts_done; /* completion for abts */ 57 struct completion *dr_done; /* completion for device reset */ 58 unsigned int tag; 59 struct scsi_cmnd *sc; /* midlayer's cmd pointer */ 60 }; 61 #endif /* _FNIC_IO_H_ */ 62