fnic_io.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  3. * Copyright 2007 Nuova Systems, Inc. All rights reserved.
  4. *
  5. * This program is free software; you may redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  12. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  13. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  14. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. * SOFTWARE.
  17. */
  18. #ifndef _FNIC_IO_H_
  19. #define _FNIC_IO_H_
  20. #include <scsi/fc/fc_fcp.h>
  21. #define FNIC_DFLT_SG_DESC_CNT 32
  22. #define FNIC_MAX_SG_DESC_CNT 256 /* Maximum descriptors per sgl */
  23. #define FNIC_SG_DESC_ALIGN 16 /* Descriptor address alignment */
  24. struct host_sg_desc {
  25. __le64 addr;
  26. __le32 len;
  27. u32 _resvd;
  28. };
  29. struct fnic_dflt_sgl_list {
  30. struct host_sg_desc sg_desc[FNIC_DFLT_SG_DESC_CNT];
  31. };
  32. struct fnic_sgl_list {
  33. struct host_sg_desc sg_desc[FNIC_MAX_SG_DESC_CNT];
  34. };
  35. enum fnic_sgl_list_type {
  36. FNIC_SGL_CACHE_DFLT = 0, /* cache with default size sgl */
  37. FNIC_SGL_CACHE_MAX, /* cache with max size sgl */
  38. FNIC_SGL_NUM_CACHES /* number of sgl caches */
  39. };
  40. enum fnic_ioreq_state {
  41. FNIC_IOREQ_NOT_INITED = 0,
  42. FNIC_IOREQ_CMD_PENDING,
  43. FNIC_IOREQ_ABTS_PENDING,
  44. FNIC_IOREQ_ABTS_COMPLETE,
  45. FNIC_IOREQ_CMD_COMPLETE,
  46. };
  47. struct fnic_io_req {
  48. struct host_sg_desc *sgl_list; /* sgl list */
  49. void *sgl_list_alloc; /* sgl list address used for free */
  50. dma_addr_t sense_buf_pa; /* dma address for sense buffer*/
  51. dma_addr_t sgl_list_pa; /* dma address for sgl list */
  52. u16 sgl_cnt;
  53. u8 sgl_type; /* device DMA descriptor list type */
  54. u8 io_completed:1; /* set to 1 when fw completes IO */
  55. u32 port_id; /* remote port DID */
  56. unsigned long start_time; /* in jiffies */
  57. struct completion *abts_done; /* completion for abts */
  58. struct completion *dr_done; /* completion for device reset */
  59. };
  60. #endif /* _FNIC_IO_H_ */