0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef _H_LPFC_VPORT
0025 #define _H_LPFC_VPORT
0026
0027
0028 #define VPORT_API_VERSION_1 0x01
0029
0030
0031 struct vport_info {
0032
0033 uint32_t api_versions;
0034 uint8_t linktype;
0035 #define VPORT_TYPE_PHYSICAL 0
0036 #define VPORT_TYPE_VIRTUAL 1
0037
0038 uint8_t state;
0039 #define VPORT_STATE_OFFLINE 0
0040 #define VPORT_STATE_ACTIVE 1
0041 #define VPORT_STATE_FAILED 2
0042
0043 uint8_t fail_reason;
0044 uint8_t prev_fail_reason;
0045 #define VPORT_FAIL_UNKNOWN 0
0046 #define VPORT_FAIL_LINKDOWN 1
0047 #define VPORT_FAIL_FAB_UNSUPPORTED 2
0048 #define VPORT_FAIL_FAB_NORESOURCES 3
0049 #define VPORT_FAIL_FAB_LOGOUT 4
0050 #define VPORT_FAIL_ADAP_NORESOURCES 5
0051
0052 uint8_t node_name[8];
0053 uint8_t port_name[8];
0054
0055 struct Scsi_Host *shost;
0056
0057
0058 uint32_t vports_max;
0059 uint32_t vports_inuse;
0060 uint32_t rpi_max;
0061 uint32_t rpi_inuse;
0062 #define VPORT_CNT_INVALID 0xFFFFFFFF
0063 };
0064
0065
0066 struct vport_data {
0067 uint32_t api_version;
0068
0069 uint32_t options;
0070 #define VPORT_OPT_AUTORETRY 0x01
0071
0072 uint8_t node_name[8];
0073 uint8_t port_name[8];
0074
0075
0076
0077
0078
0079 struct Scsi_Host *vport_shost;
0080 };
0081
0082
0083 #define VPORT_OK 0
0084 #define VPORT_ERROR -1
0085 #define VPORT_INVAL -2
0086 #define VPORT_NOMEM -3
0087 #define VPORT_NORESOURCES -4
0088
0089 int lpfc_vport_create(struct fc_vport *, bool);
0090 int lpfc_vport_delete(struct fc_vport *);
0091 int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
0092 int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
0093 struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
0094 void lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **);
0095 int lpfc_alloc_vpi(struct lpfc_hba *phba);
0096
0097
0098
0099
0100
0101 #define DID_VPORT_ERROR 0x0f
0102
0103 #define VPORT_INFO 0x1
0104 #define VPORT_CREATE 0x2
0105 #define VPORT_DELETE 0x4
0106
0107 struct vport_cmd_tag {
0108 uint32_t cmd;
0109 struct vport_data cdata;
0110 struct vport_info cinfo;
0111 void *vport;
0112 int vport_num;
0113 };
0114
0115 void lpfc_vport_set_state(struct lpfc_vport *vport,
0116 enum fc_vport_state new_state);
0117
0118 void lpfc_vport_reset_stat_data(struct lpfc_vport *);
0119 void lpfc_alloc_bucket(struct lpfc_vport *);
0120 void lpfc_free_bucket(struct lpfc_vport *);
0121
0122 #endif