scsi_bsg_iscsi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * iSCSI Transport BSG Interface
  4. *
  5. * Copyright (C) 2009 James Smart, Emulex Corporation
  6. */
  7. #ifndef SCSI_BSG_ISCSI_H
  8. #define SCSI_BSG_ISCSI_H
  9. /*
  10. * This file intended to be included by both kernel and user space
  11. */
  12. #include <scsi/scsi.h>
  13. /*
  14. * iSCSI Transport SGIO v4 BSG Message Support
  15. */
  16. /* Default BSG request timeout (in seconds) */
  17. #define ISCSI_DEFAULT_BSG_TIMEOUT (10 * HZ)
  18. /*
  19. * Request Message Codes supported by the iSCSI Transport
  20. */
  21. /* define the class masks for the message codes */
  22. #define ISCSI_BSG_CLS_MASK 0xF0000000 /* find object class */
  23. #define ISCSI_BSG_HST_MASK 0x80000000 /* iscsi host class */
  24. /* iscsi host Message Codes */
  25. #define ISCSI_BSG_HST_VENDOR (ISCSI_BSG_HST_MASK | 0x000000FF)
  26. /*
  27. * iSCSI Host Messages
  28. */
  29. /* ISCSI_BSG_HST_VENDOR : */
  30. /* Request:
  31. * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
  32. * formatting requirements specified in scsi_netlink.h
  33. */
  34. struct iscsi_bsg_host_vendor {
  35. /*
  36. * Identifies the vendor that the message is formatted for. This
  37. * should be the recipient of the message.
  38. */
  39. uint64_t vendor_id;
  40. /* start of vendor command area */
  41. uint32_t vendor_cmd[];
  42. };
  43. /* Response:
  44. */
  45. struct iscsi_bsg_host_vendor_reply {
  46. /* start of vendor response area */
  47. uint32_t vendor_rsp[0];
  48. };
  49. /* request (CDB) structure of the sg_io_v4 */
  50. struct iscsi_bsg_request {
  51. uint32_t msgcode;
  52. union {
  53. struct iscsi_bsg_host_vendor h_vendor;
  54. } rqst_data;
  55. } __attribute__((packed));
  56. /* response (request sense data) structure of the sg_io_v4 */
  57. struct iscsi_bsg_reply {
  58. /*
  59. * The completion result. Result exists in two forms:
  60. * if negative, it is an -Exxx system errno value. There will
  61. * be no further reply information supplied.
  62. * else, it's the 4-byte scsi error result, with driver, host,
  63. * msg and status fields. The per-msgcode reply structure
  64. * will contain valid data.
  65. */
  66. uint32_t result;
  67. /* If there was reply_payload, how much was recevied ? */
  68. uint32_t reply_payload_rcv_len;
  69. union {
  70. struct iscsi_bsg_host_vendor_reply vendor_reply;
  71. } reply_data;
  72. };
  73. #endif /* SCSI_BSG_ISCSI_H */