lpfc_vport.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*******************************************************************
  2. * This file is part of the Emulex Linux Device Driver for *
  3. * Fibre Channel Host Bus Adapters. *
  4. * Copyright (C) 2004-2006 Emulex. All rights reserved. *
  5. * EMULEX and SLI are trademarks of Emulex. *
  6. * www.emulex.com *
  7. * Portions Copyright (C) 2004-2005 Christoph Hellwig *
  8. * *
  9. * This program is free software; you can redistribute it and/or *
  10. * modify it under the terms of version 2 of the GNU General *
  11. * Public License as published by the Free Software Foundation. *
  12. * This program is distributed in the hope that it will be useful. *
  13. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
  14. * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
  15. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
  16. * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
  17. * TO BE LEGALLY INVALID. See the GNU General Public License for *
  18. * more details, a copy of which can be found in the file COPYING *
  19. * included with this package. *
  20. *******************************************************************/
  21. #ifndef _H_LPFC_VPORT
  22. #define _H_LPFC_VPORT
  23. /* API version values (each will be an individual bit) */
  24. #define VPORT_API_VERSION_1 0x01
  25. /* Values returned via lpfc_vport_getinfo() */
  26. struct vport_info {
  27. uint32_t api_versions;
  28. uint8_t linktype;
  29. #define VPORT_TYPE_PHYSICAL 0
  30. #define VPORT_TYPE_VIRTUAL 1
  31. uint8_t state;
  32. #define VPORT_STATE_OFFLINE 0
  33. #define VPORT_STATE_ACTIVE 1
  34. #define VPORT_STATE_FAILED 2
  35. uint8_t fail_reason;
  36. uint8_t prev_fail_reason;
  37. #define VPORT_FAIL_UNKNOWN 0
  38. #define VPORT_FAIL_LINKDOWN 1
  39. #define VPORT_FAIL_FAB_UNSUPPORTED 2
  40. #define VPORT_FAIL_FAB_NORESOURCES 3
  41. #define VPORT_FAIL_FAB_LOGOUT 4
  42. #define VPORT_FAIL_ADAP_NORESOURCES 5
  43. uint8_t node_name[8]; /* WWNN */
  44. uint8_t port_name[8]; /* WWPN */
  45. struct Scsi_Host *shost;
  46. /* Following values are valid only on physical links */
  47. uint32_t vports_max;
  48. uint32_t vports_inuse;
  49. uint32_t rpi_max;
  50. uint32_t rpi_inuse;
  51. #define VPORT_CNT_INVALID 0xFFFFFFFF
  52. };
  53. /* data used in link creation */
  54. struct vport_data {
  55. uint32_t api_version;
  56. uint32_t options;
  57. #define VPORT_OPT_AUTORETRY 0x01
  58. uint8_t node_name[8]; /* WWNN */
  59. uint8_t port_name[8]; /* WWPN */
  60. /*
  61. * Upon successful creation, vport_shost will point to the new Scsi_Host
  62. * structure for the new virtual link.
  63. */
  64. struct Scsi_Host *vport_shost;
  65. };
  66. /* API function return codes */
  67. #define VPORT_OK 0
  68. #define VPORT_ERROR -1
  69. #define VPORT_INVAL -2
  70. #define VPORT_NOMEM -3
  71. #define VPORT_NORESOURCES -4
  72. int lpfc_vport_create(struct fc_vport *, bool);
  73. int lpfc_vport_delete(struct fc_vport *);
  74. int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
  75. int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
  76. struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
  77. void lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **);
  78. int lpfc_alloc_vpi(struct lpfc_hba *phba);
  79. /*
  80. * queuecommand VPORT-specific return codes. Specified in the host byte code.
  81. * Returned when the virtual link has failed or is not active.
  82. */
  83. #define DID_VPORT_ERROR 0x0f
  84. #define VPORT_INFO 0x1
  85. #define VPORT_CREATE 0x2
  86. #define VPORT_DELETE 0x4
  87. struct vport_cmd_tag {
  88. uint32_t cmd;
  89. struct vport_data cdata;
  90. struct vport_info cinfo;
  91. void *vport;
  92. int vport_num;
  93. };
  94. void lpfc_vport_set_state(struct lpfc_vport *vport,
  95. enum fc_vport_state new_state);
  96. void lpfc_vport_reset_stat_data(struct lpfc_vport *);
  97. void lpfc_alloc_bucket(struct lpfc_vport *);
  98. void lpfc_free_bucket(struct lpfc_vport *);
  99. #endif /* H_LPFC_VPORT */