scsi_bsg_iscsi.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * iSCSI Transport BSG Interface
  3. *
  4. * Copyright (C) 2009 James Smart, Emulex Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef SCSI_BSG_ISCSI_H
  22. #define SCSI_BSG_ISCSI_H
  23. /*
  24. * This file intended to be included by both kernel and user space
  25. */
  26. #include <scsi/scsi.h>
  27. /*
  28. * iSCSI Transport SGIO v4 BSG Message Support
  29. */
  30. /* Default BSG request timeout (in seconds) */
  31. #define ISCSI_DEFAULT_BSG_TIMEOUT (10 * HZ)
  32. /*
  33. * Request Message Codes supported by the iSCSI Transport
  34. */
  35. /* define the class masks for the message codes */
  36. #define ISCSI_BSG_CLS_MASK 0xF0000000 /* find object class */
  37. #define ISCSI_BSG_HST_MASK 0x80000000 /* iscsi host class */
  38. /* iscsi host Message Codes */
  39. #define ISCSI_BSG_HST_VENDOR (ISCSI_BSG_HST_MASK | 0x000000FF)
  40. /*
  41. * iSCSI Host Messages
  42. */
  43. /* ISCSI_BSG_HST_VENDOR : */
  44. /* Request:
  45. * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
  46. * formatting requirements specified in scsi_netlink.h
  47. */
  48. struct iscsi_bsg_host_vendor {
  49. /*
  50. * Identifies the vendor that the message is formatted for. This
  51. * should be the recipient of the message.
  52. */
  53. uint64_t vendor_id;
  54. /* start of vendor command area */
  55. uint32_t vendor_cmd[0];
  56. };
  57. /* Response:
  58. */
  59. struct iscsi_bsg_host_vendor_reply {
  60. /* start of vendor response area */
  61. uint32_t vendor_rsp[0];
  62. };
  63. /* request (CDB) structure of the sg_io_v4 */
  64. struct iscsi_bsg_request {
  65. uint32_t msgcode;
  66. union {
  67. struct iscsi_bsg_host_vendor h_vendor;
  68. } rqst_data;
  69. } __attribute__((packed));
  70. /* response (request sense data) structure of the sg_io_v4 */
  71. struct iscsi_bsg_reply {
  72. /*
  73. * The completion result. Result exists in two forms:
  74. * if negative, it is an -Exxx system errno value. There will
  75. * be no further reply information supplied.
  76. * else, it's the 4-byte scsi error result, with driver, host,
  77. * msg and status fields. The per-msgcode reply structure
  78. * will contain valid data.
  79. */
  80. uint32_t result;
  81. /* If there was reply_payload, how much was recevied ? */
  82. uint32_t reply_payload_rcv_len;
  83. union {
  84. struct iscsi_bsg_host_vendor_reply vendor_reply;
  85. } reply_data;
  86. };
  87. #endif /* SCSI_BSG_ISCSI_H */