8 #ifdef CONFIG_QDIO_DEBUG
9 #define QDIO_VERBOSE_LEVEL 9
10 #else /* CONFIG_QDIO_DEBUG */
11 #define QDIO_VERBOSE_LEVEL 5
12 #endif /* CONFIG_QDIO_DEBUG */
13 #define QDIO_USE_PROCESSING_STATE
15 #define QDIO_MINIMAL_BH_RELIEF_TIME 16
16 #define QDIO_TIMER_POLL_VALUE 1
17 #define IQDIO_TIMER_POLL_VALUE 1
20 * unfortunately this can't be (QDIO_MAX_BUFFERS_PER_Q*4/3) or so -- as
21 * we never know, whether we'll get initiative again, e.g. to give the
22 * transmit skb's back to the stack, however the stack may be waiting for
23 * them... therefore we define 4 as threshold to start polling (which
24 * will stop as soon as the asynchronous queue catches up)
25 * btw, this only applies to the asynchronous HiperSockets queue
27 #define IQDIO_FILL_LEVEL_TO_POLL 4
29 #define TIQDIO_THININT_ISC 3
30 #define TIQDIO_DELAY_TARGET 0
31 #define QDIO_BUSY_BIT_PATIENCE 100 /* in microsecs */
32 #define QDIO_BUSY_BIT_GIVE_UP 10000000 /* 10 seconds */
33 #define IQDIO_GLOBAL_LAPS 2 /* GLOBAL_LAPS are not used as we */
34 #define IQDIO_GLOBAL_LAPS_INT 1 /* don't global summary */
35 #define IQDIO_LOCAL_LAPS 4
36 #define IQDIO_LOCAL_LAPS_INT 1
37 #define IQDIO_GLOBAL_SUMMARY_CC_MASK 2
38 /*#define IQDIO_IQDC_INT_PARM 0x1234*/
42 #define QDIO_STORAGE_KEY PAGE_DEFAULT_KEY
44 #define L2_CACHELINE_SIZE 256
45 #define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
47 #define QDIO_PERF "qdio_perf"
49 /* must be a power of 2 */
50 /*#define QDIO_STATS_NUMBER 4
52 #define QDIO_STATS_CLASSES 2
53 #define QDIO_STATS_COUNT_NEEDED 2*/
55 #define QDIO_NO_USE_COUNT_TIMEOUT (1*HZ) /* wait for 1 sec on each q before
56 exiting without having use_count
59 #define QDIO_ESTABLISH_TIMEOUT (1*HZ)
60 <<<<<<< HEAD
:drivers
/s390
/cio
/qdio
.h
61 #define QDIO_ACTIVATE_TIMEOUT (5*HZ)
63 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/s390
/cio
/qdio
.h
64 #define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ)
65 #define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ)
66 #define QDIO_FORCE_CHECK_TIMEOUT (10*HZ)
67 <<<<<<< HEAD
:drivers
/s390
/cio
/qdio
.h
69 #define QDIO_ACTIVATE_TIMEOUT (5) /* 5 ms */
70 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/s390
/cio
/qdio
.h
72 enum qdio_irq_states
{
73 QDIO_IRQ_STATE_INACTIVE
,
74 QDIO_IRQ_STATE_ESTABLISHED
,
75 QDIO_IRQ_STATE_ACTIVE
,
76 QDIO_IRQ_STATE_STOPPED
,
77 QDIO_IRQ_STATE_CLEANUP
,
82 /* used as intparm in do_IO: */
83 #define QDIO_DOING_SENSEID 0
84 #define QDIO_DOING_ESTABLISH 1
85 #define QDIO_DOING_ACTIVATE 2
86 #define QDIO_DOING_CLEANUP 3
88 /************************* DEBUG FACILITY STUFF *********************/
90 #define QDIO_DBF_HEX(ex,name,level,addr,len) \
93 debug_exception(qdio_dbf_##name,level,(void*)(addr),len); \
95 debug_event(qdio_dbf_##name,level,(void*)(addr),len); \
97 #define QDIO_DBF_TEXT(ex,name,level,text) \
100 debug_text_exception(qdio_dbf_##name,level,text); \
102 debug_text_event(qdio_dbf_##name,level,text); \
106 #define QDIO_DBF_HEX0(ex,name,addr,len) QDIO_DBF_HEX(ex,name,0,addr,len)
107 #define QDIO_DBF_HEX1(ex,name,addr,len) QDIO_DBF_HEX(ex,name,1,addr,len)
108 #define QDIO_DBF_HEX2(ex,name,addr,len) QDIO_DBF_HEX(ex,name,2,addr,len)
109 #ifdef CONFIG_QDIO_DEBUG
110 #define QDIO_DBF_HEX3(ex,name,addr,len) QDIO_DBF_HEX(ex,name,3,addr,len)
111 #define QDIO_DBF_HEX4(ex,name,addr,len) QDIO_DBF_HEX(ex,name,4,addr,len)
112 #define QDIO_DBF_HEX5(ex,name,addr,len) QDIO_DBF_HEX(ex,name,5,addr,len)
113 #define QDIO_DBF_HEX6(ex,name,addr,len) QDIO_DBF_HEX(ex,name,6,addr,len)
114 #else /* CONFIG_QDIO_DEBUG */
115 #define QDIO_DBF_HEX3(ex,name,addr,len) do {} while (0)
116 #define QDIO_DBF_HEX4(ex,name,addr,len) do {} while (0)
117 #define QDIO_DBF_HEX5(ex,name,addr,len) do {} while (0)
118 #define QDIO_DBF_HEX6(ex,name,addr,len) do {} while (0)
119 #endif /* CONFIG_QDIO_DEBUG */
121 #define QDIO_DBF_TEXT0(ex,name,text) QDIO_DBF_TEXT(ex,name,0,text)
122 #define QDIO_DBF_TEXT1(ex,name,text) QDIO_DBF_TEXT(ex,name,1,text)
123 #define QDIO_DBF_TEXT2(ex,name,text) QDIO_DBF_TEXT(ex,name,2,text)
124 #ifdef CONFIG_QDIO_DEBUG
125 #define QDIO_DBF_TEXT3(ex,name,text) QDIO_DBF_TEXT(ex,name,3,text)
126 #define QDIO_DBF_TEXT4(ex,name,text) QDIO_DBF_TEXT(ex,name,4,text)
127 #define QDIO_DBF_TEXT5(ex,name,text) QDIO_DBF_TEXT(ex,name,5,text)
128 #define QDIO_DBF_TEXT6(ex,name,text) QDIO_DBF_TEXT(ex,name,6,text)
129 #else /* CONFIG_QDIO_DEBUG */
130 #define QDIO_DBF_TEXT3(ex,name,text) do {} while (0)
131 #define QDIO_DBF_TEXT4(ex,name,text) do {} while (0)
132 #define QDIO_DBF_TEXT5(ex,name,text) do {} while (0)
133 #define QDIO_DBF_TEXT6(ex,name,text) do {} while (0)
134 #endif /* CONFIG_QDIO_DEBUG */
136 #define QDIO_DBF_SETUP_NAME "qdio_setup"
137 #define QDIO_DBF_SETUP_LEN 8
138 #define QDIO_DBF_SETUP_PAGES 4
139 #define QDIO_DBF_SETUP_NR_AREAS 1
140 #ifdef CONFIG_QDIO_DEBUG
141 #define QDIO_DBF_SETUP_LEVEL 6
142 #else /* CONFIG_QDIO_DEBUG */
143 #define QDIO_DBF_SETUP_LEVEL 2
144 #endif /* CONFIG_QDIO_DEBUG */
146 #define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
147 #define QDIO_DBF_SBAL_LEN 256
148 #define QDIO_DBF_SBAL_PAGES 4
149 #define QDIO_DBF_SBAL_NR_AREAS 2
150 #ifdef CONFIG_QDIO_DEBUG
151 #define QDIO_DBF_SBAL_LEVEL 6
152 #else /* CONFIG_QDIO_DEBUG */
153 #define QDIO_DBF_SBAL_LEVEL 2
154 #endif /* CONFIG_QDIO_DEBUG */
156 #define QDIO_DBF_TRACE_NAME "qdio_trace"
157 #define QDIO_DBF_TRACE_LEN 8
158 #define QDIO_DBF_TRACE_NR_AREAS 2
159 #ifdef CONFIG_QDIO_DEBUG
160 #define QDIO_DBF_TRACE_PAGES 16
161 #define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
162 #else /* CONFIG_QDIO_DEBUG */
163 #define QDIO_DBF_TRACE_PAGES 4
164 #define QDIO_DBF_TRACE_LEVEL 2
165 #endif /* CONFIG_QDIO_DEBUG */
167 #define QDIO_DBF_SENSE_NAME "qdio_sense"
168 #define QDIO_DBF_SENSE_LEN 64
169 #define QDIO_DBF_SENSE_PAGES 2
170 #define QDIO_DBF_SENSE_NR_AREAS 1
171 #ifdef CONFIG_QDIO_DEBUG
172 #define QDIO_DBF_SENSE_LEVEL 6
173 #else /* CONFIG_QDIO_DEBUG */
174 #define QDIO_DBF_SENSE_LEVEL 2
175 #endif /* CONFIG_QDIO_DEBUG */
177 #ifdef CONFIG_QDIO_DEBUG
178 #define QDIO_TRACE_QTYPE QDIO_ZFCP_QFMT
180 #define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
181 #define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q
182 #define QDIO_DBF_SLSB_OUT_PAGES 256
183 #define QDIO_DBF_SLSB_OUT_NR_AREAS 1
184 #define QDIO_DBF_SLSB_OUT_LEVEL 6
186 #define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in"
187 #define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q
188 #define QDIO_DBF_SLSB_IN_PAGES 256
189 #define QDIO_DBF_SLSB_IN_NR_AREAS 1
190 #define QDIO_DBF_SLSB_IN_LEVEL 6
191 #endif /* CONFIG_QDIO_DEBUG */
193 #define QDIO_PRINTK_HEADER QDIO_NAME ": "
195 #if QDIO_VERBOSE_LEVEL>8
196 #define QDIO_PRINT_STUPID(x...) printk( KERN_DEBUG QDIO_PRINTK_HEADER x)
198 #define QDIO_PRINT_STUPID(x...) do { } while (0)
201 #if QDIO_VERBOSE_LEVEL>7
202 #define QDIO_PRINT_ALL(x...) printk( QDIO_PRINTK_HEADER x)
204 #define QDIO_PRINT_ALL(x...) do { } while (0)
207 #if QDIO_VERBOSE_LEVEL>6
208 #define QDIO_PRINT_INFO(x...) printk( QDIO_PRINTK_HEADER x)
210 #define QDIO_PRINT_INFO(x...) do { } while (0)
213 #if QDIO_VERBOSE_LEVEL>5
214 #define QDIO_PRINT_WARN(x...) printk( QDIO_PRINTK_HEADER x)
216 #define QDIO_PRINT_WARN(x...) do { } while (0)
219 #if QDIO_VERBOSE_LEVEL>4
220 #define QDIO_PRINT_ERR(x...) printk( QDIO_PRINTK_HEADER x)
222 #define QDIO_PRINT_ERR(x...) do { } while (0)
225 #if QDIO_VERBOSE_LEVEL>3
226 #define QDIO_PRINT_CRIT(x...) printk( QDIO_PRINTK_HEADER x)
228 #define QDIO_PRINT_CRIT(x...) do { } while (0)
231 #if QDIO_VERBOSE_LEVEL>2
232 #define QDIO_PRINT_ALERT(x...) printk( QDIO_PRINTK_HEADER x)
234 #define QDIO_PRINT_ALERT(x...) do { } while (0)
237 #if QDIO_VERBOSE_LEVEL>1
238 #define QDIO_PRINT_EMERG(x...) printk( QDIO_PRINTK_HEADER x)
240 #define QDIO_PRINT_EMERG(x...) do { } while (0)
243 #define QDIO_HEXDUMP16(importance,header,ptr) \
244 QDIO_PRINT_##importance(header "%02x %02x %02x %02x " \
245 "%02x %02x %02x %02x %02x %02x %02x %02x " \
246 "%02x %02x %02x %02x\n",*(((char*)ptr)), \
247 *(((char*)ptr)+1),*(((char*)ptr)+2), \
248 *(((char*)ptr)+3),*(((char*)ptr)+4), \
249 *(((char*)ptr)+5),*(((char*)ptr)+6), \
250 *(((char*)ptr)+7),*(((char*)ptr)+8), \
251 *(((char*)ptr)+9),*(((char*)ptr)+10), \
252 *(((char*)ptr)+11),*(((char*)ptr)+12), \
253 *(((char*)ptr)+13),*(((char*)ptr)+14), \
254 *(((char*)ptr)+15)); \
255 QDIO_PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \
256 "%02x %02x %02x %02x %02x %02x %02x %02x\n", \
257 *(((char*)ptr)+16),*(((char*)ptr)+17), \
258 *(((char*)ptr)+18),*(((char*)ptr)+19), \
259 *(((char*)ptr)+20),*(((char*)ptr)+21), \
260 *(((char*)ptr)+22),*(((char*)ptr)+23), \
261 *(((char*)ptr)+24),*(((char*)ptr)+25), \
262 *(((char*)ptr)+26),*(((char*)ptr)+27), \
263 *(((char*)ptr)+28),*(((char*)ptr)+29), \
264 *(((char*)ptr)+30),*(((char*)ptr)+31));
266 /****************** END OF DEBUG FACILITY STUFF *********************/
269 * Some instructions as assembly
273 do_sqbs(unsigned long sch
, unsigned char state
, int queue
,
274 unsigned int *start
, unsigned int *count
)
277 register unsigned long _ccq
asm ("0") = *count
;
278 register unsigned long _sch
asm ("1") = sch
;
279 unsigned long _queuestart
= ((unsigned long)queue
<< 32) | *start
;
282 " .insn rsy,0xeb000000008A,%1,0,0(%2)"
283 : "+d" (_ccq
), "+d" (_queuestart
)
284 : "d" ((unsigned long)state
), "d" (_sch
)
286 *count
= _ccq
& 0xff;
287 *start
= _queuestart
& 0xff;
289 return (_ccq
>> 32) & 0xff;
296 do_eqbs(unsigned long sch
, unsigned char *state
, int queue
,
297 unsigned int *start
, unsigned int *count
)
300 register unsigned long _ccq
asm ("0") = *count
;
301 register unsigned long _sch
asm ("1") = sch
;
302 unsigned long _queuestart
= ((unsigned long)queue
<< 32) | *start
;
303 unsigned long _state
= 0;
306 " .insn rrf,0xB99c0000,%1,%2,0,0"
307 : "+d" (_ccq
), "+d" (_queuestart
), "+d" (_state
)
310 *count
= _ccq
& 0xff;
311 *start
= _queuestart
& 0xff;
312 *state
= _state
& 0xff;
314 return (_ccq
>> 32) & 0xff;
322 do_siga_sync(struct subchannel_id schid
, unsigned int mask1
, unsigned int mask2
)
324 register unsigned long reg0
asm ("0") = 2;
325 register struct subchannel_id reg1
asm ("1") = schid
;
326 register unsigned long reg2
asm ("2") = mask1
;
327 register unsigned long reg3
asm ("3") = mask2
;
335 : "d" (reg0
), "d" (reg1
), "d" (reg2
), "d" (reg3
) : "cc");
340 do_siga_input(struct subchannel_id schid
, unsigned int mask
)
342 register unsigned long reg0
asm ("0") = 1;
343 register struct subchannel_id reg1
asm ("1") = schid
;
344 register unsigned long reg2
asm ("2") = mask
;
352 : "d" (reg0
), "d" (reg1
), "d" (reg2
) : "cc", "memory");
357 do_siga_output(unsigned long schid
, unsigned long mask
, __u32
*bb
,
360 register unsigned long __fc
asm("0") = fc
;
361 register unsigned long __schid
asm("1") = schid
;
362 register unsigned long __mask
asm("2") = mask
;
371 : "=d" (cc
), "+d" (__fc
), "+d" (__schid
), "+d" (__mask
)
372 : "0" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION
)
374 (*bb
) = ((unsigned int) __fc
) >> 31;
378 static inline unsigned long
379 do_clear_global_summary(void)
381 register unsigned long __fn
asm("1") = 3;
382 register unsigned long __tmp
asm("2");
383 register unsigned long __time
asm("3");
386 " .insn rre,0xb2650000,2,0"
387 : "+d" (__fn
), "=d" (__tmp
), "=d" (__time
));
392 * QDIO device commands returned by extended Sense-ID
394 #define DEFAULT_ESTABLISH_QS_CMD 0x1b
395 #define DEFAULT_ESTABLISH_QS_COUNT 0x1000
396 #define DEFAULT_ACTIVATE_QS_CMD 0x1f
397 #define DEFAULT_ACTIVATE_QS_COUNT 0
400 * additional CIWs returned by extended Sense-ID
402 #define CIW_TYPE_EQUEUE 0x3 /* establish QDIO queues */
403 #define CIW_TYPE_AQUEUE 0x4 /* activate QDIO queues */
405 #define QDIO_CHSC_RESPONSE_CODE_OK 1
406 /* flags for st qdio sch data */
407 #define CHSC_FLAG_QDIO_CAPABILITY 0x80
408 #define CHSC_FLAG_VALIDITY 0x40
410 #define CHSC_FLAG_SIGA_INPUT_NECESSARY 0x40
411 #define CHSC_FLAG_SIGA_OUTPUT_NECESSARY 0x20
412 #define CHSC_FLAG_SIGA_SYNC_NECESSARY 0x10
413 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_THININTS 0x08
414 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
416 struct qdio_perf_stats
{
419 atomic64_t outbound_tl_runs
;
420 atomic64_t outbound_tl_runs_resched
;
421 atomic64_t inbound_tl_runs
;
422 atomic64_t inbound_tl_runs_resched
;
423 atomic64_t inbound_thin_tl_runs
;
424 atomic64_t inbound_thin_tl_runs_resched
;
426 atomic64_t siga_outs
;
428 atomic64_t siga_syncs
;
431 atomic64_t fast_reqs
;
433 atomic64_t outbound_cnt
;
434 atomic64_t inbound_cnt
;
435 #else /* CONFIG_64BIT */
437 atomic_t outbound_tl_runs
;
438 atomic_t outbound_tl_runs_resched
;
439 atomic_t inbound_tl_runs
;
440 atomic_t inbound_tl_runs_resched
;
441 atomic_t inbound_thin_tl_runs
;
442 atomic_t inbound_thin_tl_runs_resched
;
451 atomic_t outbound_cnt
;
452 atomic_t inbound_cnt
;
453 #endif /* CONFIG_64BIT */
456 /* unlikely as the later the better */
457 #define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q)
458 #define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \
459 qdio_siga_sync(q,~0U,~0U)
460 #define SYNC_MEMORY_ALL_OUTB if (unlikely(q->siga_sync)) \
461 qdio_siga_sync(q,~0U,0)
463 #define NOW qdio_get_micros()
464 #define SAVE_TIMESTAMP(q) q->timing.last_transfer_time=NOW
465 #define GET_SAVED_TIMESTAMP(q) (q->timing.last_transfer_time)
466 #define SAVE_FRONTIER(q,val) q->last_move_ftc=val
467 #define GET_SAVED_FRONTIER(q) (q->last_move_ftc)
469 #define MY_MODULE_STRING(x) #x
472 #define QDIO_GET_ADDR(x) ((__u32)(unsigned long)x)
473 #else /* CONFIG_64BIT */
474 #define QDIO_GET_ADDR(x) ((__u32)(long)x)
475 #endif /* CONFIG_64BIT */
478 volatile struct slsb slsb
;
480 char unused
[QDIO_MAX_BUFFERS_PER_Q
];
482 __u32
* dev_st_chg_ind
;
485 struct subchannel_id schid
;
486 struct ccw_device
*cdev
;
488 unsigned int is_iqdio_q
;
489 unsigned int is_thinint_q
;
491 /* bit 0 means queue 0, bit 1 means queue 1, ... */
495 qdio_handler_t (*handler
);
497 /* points to the next buffer to be checked for having
498 * been processed by the card (outbound)
499 * or to the next buffer the program should check for (inbound) */
500 volatile int first_to_check
;
501 /* and the last time it was: */
502 volatile int last_move_ftc
;
504 atomic_t number_of_buffers_used
;
507 unsigned int siga_in
;
508 unsigned int siga_out
;
509 unsigned int siga_sync
;
510 unsigned int siga_sync_done_on_thinints
;
511 unsigned int siga_sync_done_on_outb_tis
;
512 unsigned int hydra_gives_outbound_pcis
;
514 /* used to save beginning position when calling dd_handlers */
515 int first_element_to_kick
;
518 atomic_t is_in_shutdown
;
522 struct timer_list timer
;
523 #ifdef QDIO_USE_TIMERS_FOR_POLLING
524 atomic_t timer_already_set
;
525 spinlock_t timer_lock
;
526 #else /* QDIO_USE_TIMERS_FOR_POLLING */
527 struct tasklet_struct tasklet
;
528 #endif /* QDIO_USE_TIMERS_FOR_POLLING */
531 enum qdio_irq_states state
;
533 /* used to store the error condition during a data transfer */
534 unsigned int qdio_error
;
535 unsigned int siga_error
;
536 unsigned int error_status_flags
;
538 /* list of interesting queues */
539 volatile struct qdio_q
*list_next
;
540 volatile struct qdio_q
*list_prev
;
543 volatile struct sbal
*sbal
[QDIO_MAX_BUFFERS_PER_Q
];
545 struct qdio_buffer
*qdio_buffers
[QDIO_MAX_BUFFERS_PER_Q
];
547 unsigned long int_parm
;
550 int in_bh_check_limit;
552 } threshold_classes[QDIO_STATS_CLASSES];*/
555 /* inbound: the time to stop polling
556 outbound: the time to kick peer */
557 int threshold
; /* the real value */
559 /* outbound: last time of do_QDIO
560 inbound: last time of noticing incoming data */
561 /*__u64 last_transfer_times[QDIO_STATS_NUMBER];
562 int last_transfer_index; */
564 __u64 last_transfer_time
;
567 atomic_t busy_siga_counter
;
568 unsigned int queue_type
;
569 unsigned int is_pci_out
;
571 /* leave this member at the end. won't be cleared in qdio_fill_qs */
572 struct slib
*slib
; /* a page is allocated under this pointer,
573 sl points into this page, offset PAGE_SIZE/2
575 } __attribute__ ((aligned(256)));
578 __u32
* volatile dev_st_chg_ind
;
580 unsigned long int_parm
;
581 struct subchannel_id schid
;
583 unsigned int is_iqdio_irq
;
584 unsigned int is_thinint_irq
;
585 unsigned int hydra_gives_outbound_pcis
;
586 unsigned int sync_done_on_outb_pcis
;
589 unsigned int is_qebsm
;
590 unsigned long sch_token
;
592 enum qdio_irq_states state
;
594 unsigned int no_input_qs
;
595 unsigned int no_output_qs
;
597 unsigned char qdioac
;
606 void (*original_int_handler
) (struct ccw_device
*,
607 unsigned long, struct irb
*);
609 /* leave these four members together at the end. won't be cleared in qdio_fill_irq */
611 struct qdio_q
*input_qs
[QDIO_MAX_QUEUES_PER_IRQ
];
612 struct qdio_q
*output_qs
[QDIO_MAX_QUEUES_PER_IRQ
];
613 struct semaphore setting_up_sema
;