.. | .. |
---|
15 | 15 | #define QDIO_BUSY_BIT_PATIENCE (100 << 12) /* 100 microseconds */ |
---|
16 | 16 | #define QDIO_BUSY_BIT_RETRY_DELAY 10 /* 10 milliseconds */ |
---|
17 | 17 | #define QDIO_BUSY_BIT_RETRIES 1000 /* = 10s retry time */ |
---|
18 | | -#define QDIO_INPUT_THRESHOLD (500 << 12) /* 500 microseconds */ |
---|
19 | 18 | |
---|
20 | 19 | enum qdio_irq_states { |
---|
21 | 20 | QDIO_IRQ_STATE_INACTIVE, |
---|
.. | .. |
---|
82 | 81 | #define QDIO_SIGA_WRITE 0x00 |
---|
83 | 82 | #define QDIO_SIGA_READ 0x01 |
---|
84 | 83 | #define QDIO_SIGA_SYNC 0x02 |
---|
| 84 | +#define QDIO_SIGA_WRITEM 0x03 |
---|
85 | 85 | #define QDIO_SIGA_WRITEQ 0x04 |
---|
86 | 86 | #define QDIO_SIGA_QEBSM_FLAG 0x80 |
---|
87 | 87 | |
---|
.. | .. |
---|
165 | 165 | } ____cacheline_aligned; |
---|
166 | 166 | |
---|
167 | 167 | struct qdio_queue_perf_stat { |
---|
168 | | - /* |
---|
169 | | - * Sorted into order-2 buckets: 1, 2-3, 4-7, ... 64-127, 128. |
---|
170 | | - * Since max. 127 SBALs are scanned reuse entry for 128 as queue full |
---|
171 | | - * aka 127 SBALs found. |
---|
172 | | - */ |
---|
| 168 | + /* Sorted into order-2 buckets: 1, 2-3, 4-7, ... 64-127, 128. */ |
---|
173 | 169 | unsigned int nr_sbals[8]; |
---|
174 | 170 | unsigned int nr_sbal_error; |
---|
175 | 171 | unsigned int nr_sbal_nop; |
---|
176 | 172 | unsigned int nr_sbal_total; |
---|
177 | 173 | }; |
---|
178 | 174 | |
---|
179 | | -enum qdio_queue_irq_states { |
---|
180 | | - QDIO_QUEUE_IRQS_DISABLED, |
---|
| 175 | +enum qdio_irq_poll_states { |
---|
| 176 | + QDIO_IRQ_DISABLED, |
---|
181 | 177 | }; |
---|
182 | 178 | |
---|
183 | 179 | struct qdio_input_q { |
---|
184 | | - /* input buffer acknowledgement flag */ |
---|
185 | | - int polling; |
---|
186 | | - /* first ACK'ed buffer */ |
---|
187 | | - int ack_start; |
---|
188 | | - /* how much sbals are acknowledged with qebsm */ |
---|
189 | | - int ack_count; |
---|
190 | | - /* last time of noticing incoming data */ |
---|
191 | | - u64 timestamp; |
---|
192 | | - /* upper-layer polling flag */ |
---|
193 | | - unsigned long queue_irq_state; |
---|
194 | | - /* callback to start upper-layer polling */ |
---|
195 | | - void (*queue_start_poll) (struct ccw_device *, int, unsigned long); |
---|
| 180 | + /* Batch of SBALs that we processed while polling the queue: */ |
---|
| 181 | + unsigned int batch_start; |
---|
| 182 | + unsigned int batch_count; |
---|
196 | 183 | }; |
---|
197 | 184 | |
---|
198 | 185 | struct qdio_output_q { |
---|
.. | .. |
---|
206 | 193 | struct qdio_outbuf_state *sbal_state; |
---|
207 | 194 | /* timer to check for more outbound work */ |
---|
208 | 195 | struct timer_list timer; |
---|
209 | | - /* used SBALs before tasklet schedule */ |
---|
210 | | - int scan_threshold; |
---|
211 | 196 | }; |
---|
212 | 197 | |
---|
213 | 198 | /* |
---|
.. | .. |
---|
227 | 212 | * outbound: next buffer to check if adapter processed it |
---|
228 | 213 | */ |
---|
229 | 214 | int first_to_check; |
---|
230 | | - |
---|
231 | | - /* first_to_check of the last time */ |
---|
232 | | - int last_move; |
---|
233 | | - |
---|
234 | | - /* beginning position for calling the program */ |
---|
235 | | - int first_to_kick; |
---|
236 | 215 | |
---|
237 | 216 | /* number of buffers in use by the adapter */ |
---|
238 | 217 | atomic_t nr_buf_used; |
---|
.. | .. |
---|
257 | 236 | /* input or output queue */ |
---|
258 | 237 | int is_input_q; |
---|
259 | 238 | |
---|
260 | | - /* list of thinint input queues */ |
---|
261 | | - struct list_head entry; |
---|
262 | | - |
---|
263 | 239 | /* upper-layer program handler */ |
---|
264 | 240 | qdio_handler_t (*handler); |
---|
265 | 241 | |
---|
266 | | - struct dentry *debugfs_q; |
---|
267 | 242 | struct qdio_irq *irq_ptr; |
---|
268 | 243 | struct sl *sl; |
---|
269 | 244 | /* |
---|
.. | .. |
---|
277 | 252 | struct qib qib; |
---|
278 | 253 | u32 *dsci; /* address of device state change indicator */ |
---|
279 | 254 | struct ccw_device *cdev; |
---|
| 255 | + struct list_head entry; /* list of thinint devices */ |
---|
280 | 256 | struct dentry *debugfs_dev; |
---|
281 | | - struct dentry *debugfs_perf; |
---|
282 | 257 | |
---|
283 | 258 | unsigned long int_parm; |
---|
284 | 259 | struct subchannel_id schid; |
---|
.. | .. |
---|
298 | 273 | struct qdio_ssqd_desc ssqd_desc; |
---|
299 | 274 | void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *); |
---|
300 | 275 | |
---|
| 276 | + unsigned int scan_threshold; /* used SBALs before tasklet schedule */ |
---|
301 | 277 | int perf_stat_enabled; |
---|
302 | 278 | |
---|
303 | 279 | struct qdr *qdr; |
---|
.. | .. |
---|
305 | 281 | |
---|
306 | 282 | struct qdio_q *input_qs[QDIO_MAX_QUEUES_PER_IRQ]; |
---|
307 | 283 | struct qdio_q *output_qs[QDIO_MAX_QUEUES_PER_IRQ]; |
---|
| 284 | + unsigned int max_input_qs; |
---|
| 285 | + unsigned int max_output_qs; |
---|
| 286 | + |
---|
| 287 | + void (*irq_poll)(struct ccw_device *cdev, unsigned long data); |
---|
| 288 | + unsigned long poll_state; |
---|
308 | 289 | |
---|
309 | 290 | debug_info_t *debug_area; |
---|
310 | 291 | struct mutex setup_mutex; |
---|
.. | .. |
---|
321 | 302 | |
---|
322 | 303 | #define qperf(__qdev, __attr) ((__qdev)->perf_stat.(__attr)) |
---|
323 | 304 | |
---|
324 | | -#define qperf_inc(__q, __attr) \ |
---|
| 305 | +#define QDIO_PERF_STAT_INC(__irq, __attr) \ |
---|
325 | 306 | ({ \ |
---|
326 | | - struct qdio_irq *qdev = (__q)->irq_ptr; \ |
---|
| 307 | + struct qdio_irq *qdev = __irq; \ |
---|
327 | 308 | if (qdev->perf_stat_enabled) \ |
---|
328 | 309 | (qdev->perf_stat.__attr)++; \ |
---|
329 | 310 | }) |
---|
| 311 | + |
---|
| 312 | +#define qperf_inc(__q, __attr) QDIO_PERF_STAT_INC((__q)->irq_ptr, __attr) |
---|
330 | 313 | |
---|
331 | 314 | static inline void account_sbals_error(struct qdio_q *q, int count) |
---|
332 | 315 | { |
---|
.. | .. |
---|
341 | 324 | (q->nr == q->irq_ptr->nr_output_qs - 1); |
---|
342 | 325 | } |
---|
343 | 326 | |
---|
344 | | -#define pci_out_supported(q) \ |
---|
345 | | - (q->irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) |
---|
| 327 | +#define pci_out_supported(irq) ((irq)->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) |
---|
346 | 328 | #define is_qebsm(q) (q->irq_ptr->sch_token != 0) |
---|
347 | 329 | |
---|
348 | 330 | #define need_siga_in(q) (q->irq_ptr->siga_flag.input) |
---|
.. | .. |
---|
360 | 342 | for (i = 0; i < irq_ptr->nr_output_qs && \ |
---|
361 | 343 | ({ q = irq_ptr->output_qs[i]; 1; }); i++) |
---|
362 | 344 | |
---|
363 | | -#define prev_buf(bufnr) \ |
---|
364 | | - ((bufnr + QDIO_MAX_BUFFERS_MASK) & QDIO_MAX_BUFFERS_MASK) |
---|
365 | | -#define next_buf(bufnr) \ |
---|
366 | | - ((bufnr + 1) & QDIO_MAX_BUFFERS_MASK) |
---|
367 | | -#define add_buf(bufnr, inc) \ |
---|
368 | | - ((bufnr + inc) & QDIO_MAX_BUFFERS_MASK) |
---|
369 | | -#define sub_buf(bufnr, dec) \ |
---|
370 | | - ((bufnr - dec) & QDIO_MAX_BUFFERS_MASK) |
---|
| 345 | +#define add_buf(bufnr, inc) QDIO_BUFNR((bufnr) + (inc)) |
---|
| 346 | +#define next_buf(bufnr) add_buf(bufnr, 1) |
---|
| 347 | +#define sub_buf(bufnr, dec) QDIO_BUFNR((bufnr) - (dec)) |
---|
| 348 | +#define prev_buf(bufnr) sub_buf(bufnr, 1) |
---|
371 | 349 | |
---|
372 | 350 | #define queue_irqs_enabled(q) \ |
---|
373 | 351 | (test_bit(QDIO_QUEUE_IRQS_DISABLED, &q->u.in.queue_irq_state) == 0) |
---|
.. | .. |
---|
379 | 357 | /* prototypes for thin interrupt */ |
---|
380 | 358 | int qdio_establish_thinint(struct qdio_irq *irq_ptr); |
---|
381 | 359 | void qdio_shutdown_thinint(struct qdio_irq *irq_ptr); |
---|
382 | | -void tiqdio_add_input_queues(struct qdio_irq *irq_ptr); |
---|
383 | | -void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr); |
---|
| 360 | +void tiqdio_add_device(struct qdio_irq *irq_ptr); |
---|
| 361 | +void tiqdio_remove_device(struct qdio_irq *irq_ptr); |
---|
384 | 362 | void tiqdio_inbound_processing(unsigned long q); |
---|
385 | | -int tiqdio_allocate_memory(void); |
---|
386 | | -void tiqdio_free_memory(void); |
---|
387 | | -int tiqdio_register_thinints(void); |
---|
388 | | -void tiqdio_unregister_thinints(void); |
---|
389 | | -void clear_nonshared_ind(struct qdio_irq *); |
---|
| 363 | +int qdio_thinint_init(void); |
---|
| 364 | +void qdio_thinint_exit(void); |
---|
390 | 365 | int test_nonshared_ind(struct qdio_irq *); |
---|
391 | 366 | |
---|
392 | 367 | /* prototypes for setup */ |
---|
.. | .. |
---|
401 | 376 | int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr, |
---|
402 | 377 | struct subchannel_id *schid, |
---|
403 | 378 | struct qdio_ssqd_desc *data); |
---|
404 | | -int qdio_setup_irq(struct qdio_initialize *init_data); |
---|
405 | | -void qdio_print_subchannel_info(struct qdio_irq *irq_ptr, |
---|
406 | | - struct ccw_device *cdev); |
---|
407 | | -void qdio_release_memory(struct qdio_irq *irq_ptr); |
---|
408 | | -int qdio_setup_create_sysfs(struct ccw_device *cdev); |
---|
409 | | -void qdio_setup_destroy_sysfs(struct ccw_device *cdev); |
---|
| 379 | +int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data); |
---|
| 380 | +void qdio_shutdown_irq(struct qdio_irq *irq); |
---|
| 381 | +void qdio_print_subchannel_info(struct qdio_irq *irq_ptr); |
---|
| 382 | +void qdio_free_queues(struct qdio_irq *irq_ptr); |
---|
| 383 | +void qdio_free_async_data(struct qdio_irq *irq_ptr); |
---|
410 | 384 | int qdio_setup_init(void); |
---|
411 | 385 | void qdio_setup_exit(void); |
---|
412 | 386 | int qdio_enable_async_operation(struct qdio_output_q *q); |
---|