aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2009-03-26 10:24:32 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-03-26 10:24:22 -0400
commit9c8a08d7a74b07ab2c47e259231d9d0f0047a3c1 (patch)
tree44222f7c11283a4aba13c33a75b5634929084a8e
parentd303b6fd858370c22d5c70c313669e3521a5f758 (diff)
[S390] qdio: merge inbound and outbound handler functions
The inbound and outbound handlers are nearly identical if the outbound handler uses first_to_check as end index instead of last_move. Since both values are identical at that point the handlers can be merged. Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/cio/qdio.h2
-rw-r--r--drivers/s390/cio/qdio_main.c62
-rw-r--r--drivers/s390/cio/qdio_thinint.c2
3 files changed, 21 insertions, 45 deletions
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 41171d741f38..13bcb8114388 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -356,7 +356,7 @@ int get_buf_state(struct qdio_q *q, unsigned int bufnr, unsigned char *state,
356 int auto_ack); 356 int auto_ack);
357void qdio_check_outbound_after_thinint(struct qdio_q *q); 357void qdio_check_outbound_after_thinint(struct qdio_q *q);
358int qdio_inbound_q_moved(struct qdio_q *q); 358int qdio_inbound_q_moved(struct qdio_q *q);
359void qdio_kick_inbound_handler(struct qdio_q *q); 359void qdio_kick_handler(struct qdio_q *q);
360void qdio_stop_polling(struct qdio_q *q); 360void qdio_stop_polling(struct qdio_q *q);
361int qdio_siga_sync_q(struct qdio_q *q); 361int qdio_siga_sync_q(struct qdio_q *q);
362 362
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index e53ac67e1e48..9e8a2914259b 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -570,29 +570,30 @@ static int qdio_inbound_q_done(struct qdio_q *q)
570 } 570 }
571} 571}
572 572
573void qdio_kick_inbound_handler(struct qdio_q *q) 573void qdio_kick_handler(struct qdio_q *q)
574{ 574{
575 int count, start, end; 575 int start = q->first_to_kick;
576 576 int end = q->first_to_check;
577 qdio_perf_stat_inc(&perf_stats.inbound_handler); 577 int count;
578
579 start = q->first_to_kick;
580 end = q->first_to_check;
581 if (end >= start)
582 count = end - start;
583 else
584 count = end + QDIO_MAX_BUFFERS_PER_Q - start;
585
586 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%3d c:%3d", start, count);
587 578
588 if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE)) 579 if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
589 return; 580 return;
590 581
591 q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, 582 count = sub_buf(end, start);
592 start, count, q->irq_ptr->int_parm); 583
584 if (q->is_input_q) {
585 qdio_perf_stat_inc(&perf_stats.inbound_handler);
586 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%3d c:%3d", start, count);
587 } else {
588 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: nr:%1d", q->nr);
589 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "s:%3d c:%3d", start, count);
590 }
591
592 q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count,
593 q->irq_ptr->int_parm);
593 594
594 /* for the next time */ 595 /* for the next time */
595 q->first_to_kick = q->first_to_check; 596 q->first_to_kick = end;
596 q->qdio_error = 0; 597 q->qdio_error = 0;
597} 598}
598 599
@@ -603,7 +604,7 @@ again:
603 if (!qdio_inbound_q_moved(q)) 604 if (!qdio_inbound_q_moved(q))
604 return; 605 return;
605 606
606 qdio_kick_inbound_handler(q); 607 qdio_kick_handler(q);
607 608
608 if (!qdio_inbound_q_done(q)) 609 if (!qdio_inbound_q_done(q))
609 /* means poll time is not yet over */ 610 /* means poll time is not yet over */
@@ -736,38 +737,13 @@ static int qdio_kick_outbound_q(struct qdio_q *q)
736 return cc; 737 return cc;
737} 738}
738 739
739static void qdio_kick_outbound_handler(struct qdio_q *q)
740{
741 int start, end, count;
742
743 start = q->first_to_kick;
744 end = q->last_move;
745 if (end >= start)
746 count = end - start;
747 else
748 count = end + QDIO_MAX_BUFFERS_PER_Q - start;
749
750 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kickouth: %1d", q->nr);
751 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "s:%3d c:%3d", start, count);
752
753 if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
754 return;
755
756 q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count,
757 q->irq_ptr->int_parm);
758
759 /* for the next time: */
760 q->first_to_kick = q->last_move;
761 q->qdio_error = 0;
762}
763
764static void __qdio_outbound_processing(struct qdio_q *q) 740static void __qdio_outbound_processing(struct qdio_q *q)
765{ 741{
766 qdio_perf_stat_inc(&perf_stats.tasklet_outbound); 742 qdio_perf_stat_inc(&perf_stats.tasklet_outbound);
767 BUG_ON(atomic_read(&q->nr_buf_used) < 0); 743 BUG_ON(atomic_read(&q->nr_buf_used) < 0);
768 744
769 if (qdio_outbound_q_moved(q)) 745 if (qdio_outbound_q_moved(q))
770 qdio_kick_outbound_handler(q); 746 qdio_kick_handler(q);
771 747
772 if (queue_type(q) == QDIO_ZFCP_QFMT) 748 if (queue_type(q) == QDIO_ZFCP_QFMT)
773 if (!pci_out_supported(q) && !qdio_outbound_q_done(q)) 749 if (!pci_out_supported(q) && !qdio_outbound_q_done(q))
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 96f0095f568d..c655d011a78d 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -161,7 +161,7 @@ static void __tiqdio_inbound_processing(struct qdio_q *q)
161 if (!qdio_inbound_q_moved(q)) 161 if (!qdio_inbound_q_moved(q))
162 return; 162 return;
163 163
164 qdio_kick_inbound_handler(q); 164 qdio_kick_handler(q);
165 165
166 if (!tiqdio_inbound_q_done(q)) { 166 if (!tiqdio_inbound_q_done(q)) {
167 qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop); 167 qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop);