.. | .. |
---|
4 | 4 | * |
---|
5 | 5 | * Global definitions for the zfcp device driver. |
---|
6 | 6 | * |
---|
7 | | - * Copyright IBM Corp. 2002, 2010 |
---|
| 7 | + * Copyright IBM Corp. 2002, 2020 |
---|
8 | 8 | */ |
---|
9 | 9 | |
---|
10 | 10 | #ifndef ZFCP_DEF_H |
---|
.. | .. |
---|
41 | 41 | #include "zfcp_fc.h" |
---|
42 | 42 | #include "zfcp_qdio.h" |
---|
43 | 43 | |
---|
44 | | -struct zfcp_reqlist; |
---|
45 | | - |
---|
46 | | -/********************* SCSI SPECIFIC DEFINES *********************************/ |
---|
47 | | -#define ZFCP_SCSI_ER_TIMEOUT (10*HZ) |
---|
48 | | - |
---|
49 | 44 | /********************* FSF SPECIFIC DEFINES *********************************/ |
---|
50 | 45 | |
---|
51 | 46 | /* ATTENTION: value must not be used by hardware */ |
---|
52 | 47 | #define FSF_QTCB_UNSOLICITED_STATUS 0x6305 |
---|
53 | 48 | |
---|
54 | | -/* timeout value for "default timer" for fsf requests */ |
---|
55 | | -#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ) |
---|
56 | | - |
---|
57 | 49 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ |
---|
58 | 50 | |
---|
59 | 51 | /* |
---|
60 | | - * Note, the leftmost status byte is common among adapter, port |
---|
61 | | - * and unit |
---|
| 52 | + * Note, the leftmost 12 status bits (3 nibbles) are common among adapter, port |
---|
| 53 | + * and unit. This is a mask for bitwise 'and' with status values. |
---|
62 | 54 | */ |
---|
63 | 55 | #define ZFCP_COMMON_FLAGS 0xfff00000 |
---|
64 | 56 | |
---|
.. | .. |
---|
94 | 86 | #define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED 0x00000080 |
---|
95 | 87 | #define ZFCP_STATUS_FSFREQ_TMFUNCFAILED 0x00000200 |
---|
96 | 88 | #define ZFCP_STATUS_FSFREQ_DISMISSED 0x00001000 |
---|
| 89 | +#define ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE 0x00020000 |
---|
97 | 90 | |
---|
98 | 91 | /************************* STRUCTURE DEFINITIONS *****************************/ |
---|
99 | 92 | |
---|
100 | | -struct zfcp_fsf_req; |
---|
| 93 | +/** |
---|
| 94 | + * enum zfcp_erp_act_type - Type of ERP action object. |
---|
| 95 | + * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery. |
---|
| 96 | + * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery. |
---|
| 97 | + * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery. |
---|
| 98 | + * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery. |
---|
| 99 | + * |
---|
| 100 | + * Values must fit into u8 because of code dependencies: |
---|
| 101 | + * zfcp_dbf_rec_trig(), &zfcp_dbf_rec_trigger.want, &zfcp_dbf_rec_trigger.need; |
---|
| 102 | + * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), &zfcp_dbf_rec_running.rec_action. |
---|
| 103 | + */ |
---|
| 104 | +enum zfcp_erp_act_type { |
---|
| 105 | + ZFCP_ERP_ACTION_REOPEN_LUN = 1, |
---|
| 106 | + ZFCP_ERP_ACTION_REOPEN_PORT = 2, |
---|
| 107 | + ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3, |
---|
| 108 | + ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4, |
---|
| 109 | +}; |
---|
| 110 | + |
---|
| 111 | +/* |
---|
| 112 | + * Values must fit into u16 because of code dependencies: |
---|
| 113 | + * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), zfcp_dbf_rec_run_wka(), |
---|
| 114 | + * &zfcp_dbf_rec_running.rec_step. |
---|
| 115 | + */ |
---|
| 116 | +enum zfcp_erp_steps { |
---|
| 117 | + ZFCP_ERP_STEP_UNINITIALIZED = 0x0000, |
---|
| 118 | + ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010, |
---|
| 119 | + ZFCP_ERP_STEP_PORT_CLOSING = 0x0100, |
---|
| 120 | + ZFCP_ERP_STEP_PORT_OPENING = 0x0800, |
---|
| 121 | + ZFCP_ERP_STEP_LUN_CLOSING = 0x1000, |
---|
| 122 | + ZFCP_ERP_STEP_LUN_OPENING = 0x2000, |
---|
| 123 | +}; |
---|
| 124 | + |
---|
| 125 | +struct zfcp_erp_action { |
---|
| 126 | + struct list_head list; |
---|
| 127 | + enum zfcp_erp_act_type type; /* requested action code */ |
---|
| 128 | + struct zfcp_adapter *adapter; /* device which should be recovered */ |
---|
| 129 | + struct zfcp_port *port; |
---|
| 130 | + struct scsi_device *sdev; |
---|
| 131 | + u32 status; /* recovery status */ |
---|
| 132 | + enum zfcp_erp_steps step; /* active step of this erp action */ |
---|
| 133 | + unsigned long fsf_req_id; |
---|
| 134 | + struct timer_list timer; |
---|
| 135 | +}; |
---|
101 | 136 | |
---|
102 | 137 | /* holds various memory pools of an adapter */ |
---|
103 | 138 | struct zfcp_adapter_mempool { |
---|
.. | .. |
---|
109 | 144 | mempool_t *sr_data; |
---|
110 | 145 | mempool_t *gid_pn; |
---|
111 | 146 | mempool_t *qtcb_pool; |
---|
112 | | -}; |
---|
113 | | - |
---|
114 | | -struct zfcp_erp_action { |
---|
115 | | - struct list_head list; |
---|
116 | | - int action; /* requested action code */ |
---|
117 | | - struct zfcp_adapter *adapter; /* device which should be recovered */ |
---|
118 | | - struct zfcp_port *port; |
---|
119 | | - struct scsi_device *sdev; |
---|
120 | | - u32 status; /* recovery status */ |
---|
121 | | - u32 step; /* active step of this erp action */ |
---|
122 | | - unsigned long fsf_req_id; |
---|
123 | | - struct timer_list timer; |
---|
124 | | -}; |
---|
125 | | - |
---|
126 | | -struct fsf_latency_record { |
---|
127 | | - u32 min; |
---|
128 | | - u32 max; |
---|
129 | | - u64 sum; |
---|
130 | | -}; |
---|
131 | | - |
---|
132 | | -struct latency_cont { |
---|
133 | | - struct fsf_latency_record channel; |
---|
134 | | - struct fsf_latency_record fabric; |
---|
135 | | - u64 counter; |
---|
136 | | -}; |
---|
137 | | - |
---|
138 | | -struct zfcp_latencies { |
---|
139 | | - struct latency_cont read; |
---|
140 | | - struct latency_cont write; |
---|
141 | | - struct latency_cont cmd; |
---|
142 | | - spinlock_t lock; |
---|
143 | 147 | }; |
---|
144 | 148 | |
---|
145 | 149 | struct zfcp_adapter { |
---|
.. | .. |
---|
154 | 158 | u32 adapter_features; /* FCP channel features */ |
---|
155 | 159 | u32 connection_features; /* host connection features */ |
---|
156 | 160 | u32 hardware_version; /* of FCP channel */ |
---|
| 161 | + u32 fc_security_algorithms; /* of FCP channel */ |
---|
| 162 | + u32 fc_security_algorithms_old; /* of FCP channel */ |
---|
157 | 163 | u16 timer_ticks; /* time int for a tick */ |
---|
158 | 164 | struct Scsi_Host *scsi_host; /* Pointer to mid-layer */ |
---|
159 | 165 | struct list_head port_list; /* remote port list */ |
---|
.. | .. |
---|
194 | 200 | struct device_dma_parameters dma_parms; |
---|
195 | 201 | struct zfcp_fc_events events; |
---|
196 | 202 | unsigned long next_port_scan; |
---|
| 203 | + struct zfcp_diag_adapter *diagnostics; |
---|
197 | 204 | }; |
---|
198 | 205 | |
---|
199 | 206 | struct zfcp_port { |
---|
.. | .. |
---|
213 | 220 | atomic_t erp_counter; |
---|
214 | 221 | u32 maxframe_size; |
---|
215 | 222 | u32 supported_classes; |
---|
| 223 | + u32 connection_info; |
---|
| 224 | + u32 connection_info_old; |
---|
216 | 225 | struct work_struct gid_pn_work; |
---|
217 | 226 | struct work_struct test_link_work; |
---|
218 | 227 | struct work_struct rport_work; |
---|
219 | 228 | enum { RPORT_NONE, RPORT_ADD, RPORT_DEL } rport_task; |
---|
220 | 229 | unsigned int starget_id; |
---|
| 230 | +}; |
---|
| 231 | + |
---|
| 232 | +struct zfcp_latency_record { |
---|
| 233 | + u32 min; |
---|
| 234 | + u32 max; |
---|
| 235 | + u64 sum; |
---|
| 236 | +}; |
---|
| 237 | + |
---|
| 238 | +struct zfcp_latency_cont { |
---|
| 239 | + struct zfcp_latency_record channel; |
---|
| 240 | + struct zfcp_latency_record fabric; |
---|
| 241 | + u64 counter; |
---|
| 242 | +}; |
---|
| 243 | + |
---|
| 244 | +struct zfcp_latencies { |
---|
| 245 | + struct zfcp_latency_cont read; |
---|
| 246 | + struct zfcp_latency_cont write; |
---|
| 247 | + struct zfcp_latency_cont cmd; |
---|
| 248 | + spinlock_t lock; |
---|
221 | 249 | }; |
---|
222 | 250 | |
---|
223 | 251 | /** |
---|
.. | .. |
---|
287 | 315 | * @qdio_req: qdio queue related values |
---|
288 | 316 | * @completion: used to signal the completion of the request |
---|
289 | 317 | * @status: status of the request |
---|
290 | | - * @fsf_command: FSF command issued |
---|
291 | 318 | * @qtcb: associated QTCB |
---|
292 | | - * @seq_no: sequence number of this request |
---|
293 | 319 | * @data: private data |
---|
294 | 320 | * @timer: timer data of this request |
---|
295 | 321 | * @erp_action: reference to erp action if request issued on behalf of ERP |
---|
.. | .. |
---|
304 | 330 | struct zfcp_qdio_req qdio_req; |
---|
305 | 331 | struct completion completion; |
---|
306 | 332 | u32 status; |
---|
307 | | - u32 fsf_command; |
---|
308 | 333 | struct fsf_qtcb *qtcb; |
---|
309 | | - u32 seq_no; |
---|
310 | 334 | void *data; |
---|
311 | 335 | struct timer_list timer; |
---|
312 | 336 | struct zfcp_erp_action *erp_action; |
---|
.. | .. |
---|
321 | 345 | return atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_MB_ACT; |
---|
322 | 346 | } |
---|
323 | 347 | |
---|
| 348 | +static inline bool zfcp_fsf_req_is_status_read_buffer(struct zfcp_fsf_req *req) |
---|
| 349 | +{ |
---|
| 350 | + return req->qtcb == NULL; |
---|
| 351 | +} |
---|
| 352 | + |
---|
324 | 353 | #endif /* ZFCP_DEF_H */ |
---|