Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qdio: simplify SBAL range calculation

When passing a range of ready-to-process SBALs to the upper-layer
driver, use the available 'count' instead of calculating the distance
between the first_to_check and first_to_kick cursors.

This simplifies the logic of the queue-scan path, and opens up the
possibility of scanning all 128 SBALs in one go (as determining the
reported count no longer requires wrap-around safe arithmetic on the
queue's cursors).

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Julian Wiedmann and committed by
Martin Schwidefsky
65e4f776 b39544c6

+9 -15
+9 -15
drivers/s390/cio/qdio_main.c
··· 636 636 return phys_aob; 637 637 } 638 638 639 - static void qdio_kick_handler(struct qdio_q *q) 639 + static void qdio_kick_handler(struct qdio_q *q, unsigned int count) 640 640 { 641 641 int start = q->first_to_kick; 642 - int end = q->first_to_check; 643 - int count; 644 642 645 643 if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE)) 646 644 return; 647 - 648 - count = sub_buf(end, start); 649 645 650 646 if (q->is_input_q) { 651 647 qperf_inc(q, inbound_handler); ··· 658 662 q->irq_ptr->int_parm); 659 663 660 664 /* for the next time */ 661 - q->first_to_kick = end; 665 + q->first_to_kick = add_buf(start, count); 662 666 q->qdio_error = 0; 663 667 } 664 668 ··· 681 685 if (count == 0) 682 686 return; 683 687 684 - qdio_kick_handler(q); 688 + qdio_kick_handler(q, count); 685 689 686 690 if (!qdio_inbound_q_done(q)) { 687 691 /* means poll time is not yet over */ ··· 839 843 840 844 count = qdio_outbound_q_moved(q); 841 845 if (count) 842 - qdio_kick_handler(q); 846 + qdio_kick_handler(q, count); 843 847 844 848 if (queue_type(q) == QDIO_ZFCP_QFMT && !pci_out_supported(q->irq_ptr) && 845 849 !qdio_outbound_q_done(q)) ··· 907 911 if (count == 0) 908 912 return; 909 913 910 - qdio_kick_handler(q); 914 + qdio_kick_handler(q, count); 911 915 912 916 if (!qdio_inbound_q_done(q)) { 913 917 qperf_inc(q, tasklet_inbound_resched); ··· 1670 1674 int *error) 1671 1675 { 1672 1676 struct qdio_q *q; 1673 - int start, end; 1674 1677 struct qdio_irq *irq_ptr = cdev->private->qdio_data; 1675 1678 int count; 1676 1679 ··· 1694 1699 if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE)) 1695 1700 return -EIO; 1696 1701 1697 - start = q->first_to_kick; 1698 - end = q->first_to_check; 1699 - *bufnr = start; 1702 + *bufnr = q->first_to_kick; 1700 1703 *error = q->qdio_error; 1701 1704 1702 1705 /* for the next time */ 1703 - q->first_to_kick = end; 1706 + q->first_to_kick = add_buf(q->first_to_kick, count); 1704 1707 q->qdio_error = 0; 1705 - return sub_buf(end, start); 1708 + 1709 + return count; 1706 1710 } 1707 1711 EXPORT_SYMBOL(qdio_get_next_buffers); 1708 1712