summaryrefslogtreecommitdiff
path: root/drivers/s390/cio
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2009-03-26 15:24:32 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-03-26 15:24:22 +0100
commit9c8a08d7a74b07ab2c47e259231d9d0f0047a3c1 (patch)
tree44222f7c11283a4aba13c33a75b5634929084a8e /drivers/s390/cio
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>
Diffstat (limited to 'drivers/s390/cio')
-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,
int auto_ack);
void qdio_check_outbound_after_thinint(struct qdio_q *q);
int qdio_inbound_q_moved(struct qdio_q *q);
-void qdio_kick_inbound_handler(struct qdio_q *q);
+void qdio_kick_handler(struct qdio_q *q);
void qdio_stop_polling(struct qdio_q *q);
int qdio_siga_sync_q(struct qdio_q *q);
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)
}
}
-void qdio_kick_inbound_handler(struct qdio_q *q)
+void qdio_kick_handler(struct qdio_q *q)
{
- int count, start, end;
-
- qdio_perf_stat_inc(&perf_stats.inbound_handler);
-
- start = q->first_to_kick;
- end = q->first_to_check;
- if (end >= start)
- count = end - start;
- else
- count = end + QDIO_MAX_BUFFERS_PER_Q - start;
-
- DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%3d c:%3d", start, count);
+ int start = q->first_to_kick;
+ int end = q->first_to_check;
+ int count;
if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
return;
- q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr,
- start, count, q->irq_ptr->int_parm);
+ count = sub_buf(end, start);
+
+ if (q->is_input_q) {
+ qdio_perf_stat_inc(&perf_stats.inbound_handler);
+ DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%3d c:%3d", start, count);
+ } else {
+ DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: nr:%1d", q->nr);
+ DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "s:%3d c:%3d", start, count);
+ }
+
+ q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count,
+ q->irq_ptr->int_parm);
/* for the next time */
- q->first_to_kick = q->first_to_check;
+ q->first_to_kick = end;
q->qdio_error = 0;
}
@@ -603,7 +604,7 @@ again:
if (!qdio_inbound_q_moved(q))
return;
- qdio_kick_inbound_handler(q);
+ qdio_kick_handler(q);
if (!qdio_inbound_q_done(q))
/* means poll time is not yet over */
@@ -736,38 +737,13 @@ static int qdio_kick_outbound_q(struct qdio_q *q)
return cc;
}
-static void qdio_kick_outbound_handler(struct qdio_q *q)
-{
- int start, end, count;
-
- start = q->first_to_kick;
- end = q->last_move;
- if (end >= start)
- count = end - start;
- else
- count = end + QDIO_MAX_BUFFERS_PER_Q - start;
-
- DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kickouth: %1d", q->nr);
- DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "s:%3d c:%3d", start, count);
-
- if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
- return;
-
- q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count,
- q->irq_ptr->int_parm);
-
- /* for the next time: */
- q->first_to_kick = q->last_move;
- q->qdio_error = 0;
-}
-
static void __qdio_outbound_processing(struct qdio_q *q)
{
qdio_perf_stat_inc(&perf_stats.tasklet_outbound);
BUG_ON(atomic_read(&q->nr_buf_used) < 0);
if (qdio_outbound_q_moved(q))
- qdio_kick_outbound_handler(q);
+ qdio_kick_handler(q);
if (queue_type(q) == QDIO_ZFCP_QFMT)
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)
if (!qdio_inbound_q_moved(q))
return;
- qdio_kick_inbound_handler(q);
+ qdio_kick_handler(q);
if (!tiqdio_inbound_q_done(q)) {
qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop);