1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef _H_LPFC_VPORT
25 #define _H_LPFC_VPORT
26
27
28 #define VPORT_API_VERSION_1 0x01
29
30
31 struct vport_info {
32
33 uint32_t api_versions;
34 uint8_t linktype;
35 #define VPORT_TYPE_PHYSICAL 0
36 #define VPORT_TYPE_VIRTUAL 1
37
38 uint8_t state;
39 #define VPORT_STATE_OFFLINE 0
40 #define VPORT_STATE_ACTIVE 1
41 #define VPORT_STATE_FAILED 2
42
43 uint8_t fail_reason;
44 uint8_t prev_fail_reason;
45 #define VPORT_FAIL_UNKNOWN 0
46 #define VPORT_FAIL_LINKDOWN 1
47 #define VPORT_FAIL_FAB_UNSUPPORTED 2
48 #define VPORT_FAIL_FAB_NORESOURCES 3
49 #define VPORT_FAIL_FAB_LOGOUT 4
50 #define VPORT_FAIL_ADAP_NORESOURCES 5
51
52 uint8_t node_name[8];
53 uint8_t port_name[8];
54
55 struct Scsi_Host *shost;
56
57
58 uint32_t vports_max;
59 uint32_t vports_inuse;
60 uint32_t rpi_max;
61 uint32_t rpi_inuse;
62 #define VPORT_CNT_INVALID 0xFFFFFFFF
63 };
64
65
66 struct vport_data {
67 uint32_t api_version;
68
69 uint32_t options;
70 #define VPORT_OPT_AUTORETRY 0x01
71
72 uint8_t node_name[8];
73 uint8_t port_name[8];
74
75
76
77
78
79 struct Scsi_Host *vport_shost;
80 };
81
82
83 #define VPORT_OK 0
84 #define VPORT_ERROR -1
85 #define VPORT_INVAL -2
86 #define VPORT_NOMEM -3
87 #define VPORT_NORESOURCES -4
88
89 int lpfc_vport_create(struct fc_vport *, bool);
90 int lpfc_vport_delete(struct fc_vport *);
91 int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
92 int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
93 struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
94 void lpfc_destroy_vport_work_array(struct lpfc_hba *, struct lpfc_vport **);
95 int lpfc_alloc_vpi(struct lpfc_hba *phba);
96
97
98
99
100
101 #define DID_VPORT_ERROR 0x0f
102
103 #define VPORT_INFO 0x1
104 #define VPORT_CREATE 0x2
105 #define VPORT_DELETE 0x4
106
107 struct vport_cmd_tag {
108 uint32_t cmd;
109 struct vport_data cdata;
110 struct vport_info cinfo;
111 void *vport;
112 int vport_num;
113 };
114
115 void lpfc_vport_set_state(struct lpfc_vport *vport,
116 enum fc_vport_state new_state);
117
118 void lpfc_vport_reset_stat_data(struct lpfc_vport *);
119 void lpfc_alloc_bucket(struct lpfc_vport *);
120 void lpfc_free_bucket(struct lpfc_vport *);
121
122 #endif