lpfc_vport.h 3.8 KB

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