scsi_transport_iscsi.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * iSCSI transport class definitions
  3. *
  4. * Copyright (C) IBM Corporation, 2004
  5. * Copyright (C) Mike Christie, 2004 - 2005
  6. * Copyright (C) Dmitry Yusupov, 2004 - 2005
  7. * Copyright (C) Alex Aizman, 2004 - 2005
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef SCSI_TRANSPORT_ISCSI_H
  24. #define SCSI_TRANSPORT_ISCSI_H
  25. #include <scsi/iscsi_if.h>
  26. /**
  27. * struct iscsi_transport - iSCSI Transport template
  28. *
  29. * @name: transport name
  30. * @caps: iSCSI Data-Path capabilities
  31. * @create_session: create new iSCSI session object
  32. * @destroy_session: destroy existing iSCSI session object
  33. * @create_conn: create new iSCSI connection
  34. * @bind_conn: associate this connection with existing iSCSI session
  35. * and specified transport descriptor
  36. * @destroy_conn: destroy inactive iSCSI connection
  37. * @set_param: set iSCSI Data-Path operational parameter
  38. * @start_conn: set connection to be operational
  39. * @stop_conn: suspend/recover/terminate connection
  40. * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
  41. *
  42. * Template API provided by iSCSI Transport
  43. */
  44. struct iscsi_transport {
  45. struct module *owner;
  46. char *name;
  47. unsigned int caps;
  48. struct scsi_host_template *host_template;
  49. int hostdata_size;
  50. int max_lun;
  51. unsigned int max_conn;
  52. unsigned int max_cmd_len;
  53. iscsi_sessionh_t (*create_session) (uint32_t initial_cmdsn,
  54. struct Scsi_Host *shost);
  55. void (*destroy_session) (iscsi_sessionh_t session);
  56. iscsi_connh_t (*create_conn) (iscsi_sessionh_t session, uint32_t cid);
  57. int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn,
  58. uint32_t transport_fd, int is_leading);
  59. int (*start_conn) (iscsi_connh_t conn);
  60. void (*stop_conn) (iscsi_connh_t conn, int flag);
  61. void (*destroy_conn) (iscsi_connh_t conn);
  62. int (*set_param) (iscsi_connh_t conn, enum iscsi_param param,
  63. uint32_t value);
  64. int (*get_param) (iscsi_connh_t conn, enum iscsi_param param,
  65. uint32_t *value);
  66. int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr,
  67. char *data, uint32_t data_size);
  68. void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats);
  69. };
  70. /*
  71. * transport registration upcalls
  72. */
  73. extern int iscsi_register_transport(struct iscsi_transport *tt);
  74. extern int iscsi_unregister_transport(struct iscsi_transport *tt);
  75. /*
  76. * control plane upcalls
  77. */
  78. extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error);
  79. extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr,
  80. char *data, uint32_t data_size);
  81. #endif