Skip to content

Commit 0b6f499

Browse files
julianwiedmannVasily Gorbik
authored andcommitted
s390/qdio: simplify ACK tracking
Current code uses a 'polling' flag to keep track of whether an Input Queue has any ACKed SBALs. QEBSM devices might have multiple ACKed SBALs, and those are tracked separately with 'ack_count'. By also setting ack_count for non-QEBSM devices (to a fixed value of 1), we can use 'ack_count != 0' as replacement for the polling flag. Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent fcd98d4 commit 0b6f499

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

drivers/s390/cio/qdio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,9 @@ enum qdio_queue_irq_states {
182182
};
183183

184184
struct qdio_input_q {
185-
/* input buffer acknowledgement flag */
186-
int polling;
187185
/* first ACK'ed buffer */
188186
int ack_start;
189-
/* how much sbals are acknowledged with qebsm */
187+
/* how many SBALs are acknowledged */
190188
int ack_count;
191189
/* last time of noticing incoming data */
192190
u64 timestamp;

drivers/s390/cio/qdio_debug.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ static int qstat_show(struct seq_file *m, void *v)
124124
seq_printf(m, "nr_used: %d ftc: %d\n",
125125
atomic_read(&q->nr_buf_used), q->first_to_check);
126126
if (q->is_input_q) {
127-
seq_printf(m, "polling: %d ack start: %d ack count: %d\n",
128-
q->u.in.polling, q->u.in.ack_start,
129-
q->u.in.ack_count);
127+
seq_printf(m, "ack start: %d ack count: %d\n",
128+
q->u.in.ack_start, q->u.in.ack_count);
130129
seq_printf(m, "DSCI: %x IRQs disabled: %u\n",
131130
*(u8 *)q->irq_ptr->dsci,
132131
test_bit(QDIO_QUEUE_IRQS_DISABLED,

drivers/s390/cio/qdio_main.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,15 @@ int debug_get_buf_state(struct qdio_q *q, unsigned int bufnr,
393393

394394
static inline void qdio_stop_polling(struct qdio_q *q)
395395
{
396-
if (!q->u.in.polling)
396+
if (!q->u.in.ack_count)
397397
return;
398398

399-
q->u.in.polling = 0;
400399
qperf_inc(q, stop_polling);
401400

402401
/* show the card that we are not polling anymore */
403-
if (is_qebsm(q)) {
404-
set_buf_states(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT,
405-
q->u.in.ack_count);
406-
q->u.in.ack_count = 0;
407-
} else
408-
set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
402+
set_buf_states(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT,
403+
q->u.in.ack_count);
404+
q->u.in.ack_count = 0;
409405
}
410406

411407
static inline void account_sbals(struct qdio_q *q, unsigned int count)
@@ -451,8 +447,7 @@ static inline void inbound_primed(struct qdio_q *q, unsigned int start,
451447

452448
/* for QEBSM the ACK was already set by EQBS */
453449
if (is_qebsm(q)) {
454-
if (!q->u.in.polling) {
455-
q->u.in.polling = 1;
450+
if (!q->u.in.ack_count) {
456451
q->u.in.ack_count = count;
457452
q->u.in.ack_start = start;
458453
return;
@@ -471,12 +466,12 @@ static inline void inbound_primed(struct qdio_q *q, unsigned int start,
471466
* or by the next inbound run.
472467
*/
473468
new = add_buf(start, count - 1);
474-
if (q->u.in.polling) {
469+
if (q->u.in.ack_count) {
475470
/* reset the previous ACK but first set the new one */
476471
set_buf_state(q, new, SLSB_P_INPUT_ACK);
477472
set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
478473
} else {
479-
q->u.in.polling = 1;
474+
q->u.in.ack_count = 1;
480475
set_buf_state(q, new, SLSB_P_INPUT_ACK);
481476
}
482477

@@ -1479,13 +1474,12 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags,
14791474

14801475
qperf_inc(q, inbound_call);
14811476

1482-
if (!q->u.in.polling)
1477+
if (!q->u.in.ack_count)
14831478
goto set;
14841479

14851480
/* protect against stop polling setting an ACK for an emptied slsb */
14861481
if (count == QDIO_MAX_BUFFERS_PER_Q) {
14871482
/* overwriting everything, just delete polling status */
1488-
q->u.in.polling = 0;
14891483
q->u.in.ack_count = 0;
14901484
goto set;
14911485
} else if (buf_in_between(q->u.in.ack_start, bufnr, count)) {
@@ -1495,15 +1489,14 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags,
14951489
diff = sub_buf(diff, q->u.in.ack_start);
14961490
q->u.in.ack_count -= diff;
14971491
if (q->u.in.ack_count <= 0) {
1498-
q->u.in.polling = 0;
14991492
q->u.in.ack_count = 0;
15001493
goto set;
15011494
}
15021495
q->u.in.ack_start = add_buf(q->u.in.ack_start, diff);
1496+
} else {
1497+
/* the only ACK will be deleted */
1498+
q->u.in.ack_count = 0;
15031499
}
1504-
else
1505-
/* the only ACK will be deleted, so stop polling */
1506-
q->u.in.polling = 0;
15071500
}
15081501

15091502
set:

0 commit comments

Comments
 (0)